ocamlsdl-0.9.1/AUTHORS0000664000076400007640000000027210225746667013125 0ustar olivolivFrederic Brunel Luc Mazardo Sami Mäkelä Olivier Andrieu Julien Boulnois ocamlsdl-0.9.1/COPYING0000664000076400007640000006347407447726501013122 0ustar olivoliv GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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 Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] 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 Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these 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 other code 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. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. 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, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) 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. d) 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. e) 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 materials to be 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 with 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 Lesser 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 How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ocamlsdl-0.9.1/INSTALL0000664000076400007640000000142610177260120013065 0ustar olivoliv Building & Installing ===================== $ ./configure options for configure: --without-findlib do not install using findlib --with-installdir=DIR specify installation directory [default is +sdl] --with-lablgldir=DIR location of LablGL [default is +lablGL] --disable-sdl-ttf without SDL_ttf support --disable-sdl-image without SDL_image support --disable-sdl-mixer without SDL_mixer support $ make This will build the main OCamlSDL library (sdl.cma, sdl.cmxa) and the extra libraries, if available (sdlmixer.cma, sdlttf.cma, sdlloader.cma). $ make install This will install libraries using findlib if available or in the OCAMLSDLDIR directory (defaults to CAMLLIBDIR/sdl). For packagers, there's a DESTDIR makefile variable. ocamlsdl-0.9.1/INSTALL.win320000664000076400007640000000227510101051461014022 0ustar olivoliv Building OCamlSDL with MSVC =========================== - edit makefile.config.msvc, particularly the PARTS and SDL_LIBS variables if you do not want to build all extra libraries. You may have to specify include directories for SDL headers in the CPPFLAGS variable with the /I option - copy src/config.h.msvc to src/config.h and edit it if necessary - edit makefile.platform, use "Win32" for PLATFORM and "msvc" for OCAML_C_BACKEND Also, depending on the MS compiler you're using, you may need to do this (reported by Andrei de A. Formiga on the mailing list): ,---- | ocamlopt apparently calls `lib' to generate sdl.cmxa, so I created a | lib.bat (accessible from PATH) containing the single line: | | link /lib %1 %2 %3 %4 %5 %6 %7 %8 %9 `---- Then run (GNU) make. Building OCamlSDL with Mingw ============================ If you have the MSYS or Cygwin build environment, ./configure should work. If you're using the ocaml binaries from INRIA with a Cygwin build environment, you may have to add `-mno-cygwin' to CFLAGS in makefile.platform. Building OCamlSDL with full Cygwin ================================== It's considered an Unix platform. ./configure, make, make install should work. ocamlsdl-0.9.1/README0000664000076400007640000000526411363125112012717 0ustar olivolivOCamlSDL - An interface between OCaml and SDL Overview ======== The goal of OCamlSDL is to provide access the multimedia hardware in the ML programming language with the help of the SDL library. The Simple DirectMedia Layer is a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. OCamlSDL is hosted on SourceForge.net: http://ocamlsdl.sourceforge.net/ http://www.sourceforge.net/projects/ocamlsdl/ Requirements ============ OCamlSDL needs the following software and libraries: OCaml http://www.ocaml.org/ SDL http://www.libsdl.org/ (1.2.x) and optionally: SDL_ttf http://www.libsdl.org/projects/SDL_ttf/ (2.x) SDL_mixer http://www.libsdl.org/projects/SDL_mixer/ (1.2.x) SDL_image http://www.libsdl.org/projects/SDL_image/ (1.2.x) SDL_gfx http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx LablGL http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html findlib http://projects.camlcity.org/projects/findlib.html Using ===== See the INSTALL file (and INSTALL.win32) for information on how to compile and install the library. The library use the Bigarray module (distributed with OCaml), to interface with C so programs using OCamlSDL must also be linked with bigarray. Example : $ ocamlc -c -I /path/to/ocamlsdl my_prog.ml $ ocamlc -o my_prog -I /path/to/ocamlsdl bigarray.cma sdl.cma sdttf.cma my_prog.cmo If OCamlSDL was installed using findlib, the package manager will take care of that: $ ocamlfind ocamlc -c -package sdlttf -linkpkg my_prog.ml $ ocamlfind ocamlc -o my_prog -package sdlttf -linkpkg my_prog.cmo MacOSX users should also read README.macosx . Documentation ============= You can browse the ocaml API documentation at: http://ocamlsdl.sourceforge.net/docs/index.html You can find SDL documentation on the SDL website: http://www.libsdl.org/ Toplevel ======== You can build a custom toplevel including OCamlSDL libraries with: $ ocamlmktop -o ocamlsdl -I /path/to/ocamlsdl -custom bigarray.cma sdl.cma ... If you use OCaml >= 3.04, the static toplevel is not really necessary since you can dynamically load OCamlSDL in the toplevel: $ ocaml Objective Caml version 3.04 # #load "bigarray.cma" ;; # #load "sdl.cma" ;; # Feedback ======== Bugs can be reported on the SourceForge project page or on the mailing lists. There are two mailing lists: ocamlsdl-user@lists.sourceforge.net ocamlsdl-devel@lists.sourceforge.net Subscription information and archives are available here: http://lists.sourceforge.net/lists/listinfo/ocamlsdl-user http://lists.sourceforge.net/lists/listinfo/ocamlsdl-devel -- The OCamlSDL developers ocamlsdl-0.9.1/README.macosx0000664000076400007640000000530010177262227014212 0ustar olivolivUsing ===== 1. Native code. Same as in the README. 2. Byte code. You cannot use dynamic linking of stub code. This stub code must be statically linked into a custom runtime. $ ocamlc -I +sdl -c my_prog.ml $ ocamlc -I +sdl -custom -o my_prog bigarray.cma sdl.cma my_prog.cmo 3. Top-level. Here again you cannot use dynamic linking, you need to build a custom top level. $ ocamlmktop -I +sdl -custom -o ocamlsdl bigarray.cma sdl.cma ... $ ./ocamlsdl -I +sdl Note that in (2) and (3), if dynamic linking is used, the result is that a bunch of errors is printed on stdout and the process is aborted (but it doesn't segfault). Explanation =========== To use sdl on macos x you need to define a SDL_main() function [1] because sdl needs its own main() to register the application with the window system. So at runtime, your executable starts by executing the library's main which then calls your SDL_main() function. In C this is done transparently via the preprocessor. What you do is that you define your own main() in a file in which SDL.h is included. SDL.h will rename your main() to SDL_main() (via a #define). At link time you then need to link against one more lib, libSDLmain which has the real main(). As said before, this function just register your app with the window system and then calls your own main() renamed to SDL_main() (note that using sdl-config --libs at link time automatically adds -lSDLmain on macos x). So what I did is just to include the following code in sdl_stub.c [...] #ifdef __APPLE__ int main(int argc, char **argv) { caml_main(argv); return 0; } #endif [...] __APPLE__ is only defined when you use gcc on macos x. This means that finally in libsdlstub.a, the symbol _SDL_main will be defined with the above implementation (the symbol main above is replaced by SDL_main because of the inclusion of SDL.h). Now how does that work ? There are two cases to consider, native code and byte code compilation. a. Native code. When we will link, the _main of libSDLmain will become the entry point, this will register the app with the window system and then call _SDL_main of libsdlstub which will start the caml system via caml_main. b. Byte code. As I understand it, here the problem is that ocamlrun has his own _main and it will not use libSDLmain's _main. So the only solution I found is to link in -custom mode which statically links in the C primitives and apparently the _main of libSDLmain is then used when I start the executable. This main will then call _SDL_main of libsdlstub and start the ocaml system. For the toplevel it is the same, you need to create a custom toplevel. [1] -- Daniel Bünzli ocamlsdl-0.9.1/NEWS0000664000076400007640000000477411774640617012565 0ustar olivolivRelease 0.9.1: * fix the button index in Sdlevent.mousebutton_event * bugfixes (Sdlmixer.group_channels, Sdlmixer.volume_music, Sdlmixer.setvolume_music) Release 0.9.0: * add a variant in Sdlmouse.button for extra mouse buttons (seen with mouse events in Sdlevent) * ensure that the arrays returned by Sdlvideo.pixel_data keep the underlying SDL_surface alive * put SDL_GL_SwapBuffers in a blocking section * bind the Mix_QuickLoad_RAW function (Sdlmixer.load_string_raw) * fix a typo in META for Sdlgfx Release 0.8.0: * add SDL_gfx bindings (Julien Boulnois) * add UTF8 support in Sdlttf * put the IMG_Load function in a blocking section * rename some C functions to avoid conflicts (with Camlimages) * some compilation/installation fixes for MacOSX * autoconf update and cleanup Release 0.7.2: * support for MacOSX (thanks to Daniel Bünzli and Francesco Zappa Nardelli for testing) Release 0.7.1: * add missing doc/ directory in the tarball * add a small AWK script, xpm_to_ml for embedding XPM files in sources Release 0.7.0: * findlib support * bugfixes * build system improvments, hopefully builds on Windows Release 0.6.3: * bug fix for SDLRWops * sync with SDL 1.2.5 Release 0.6.2: * interfaced SDLRWops for reading images and sounds from memory buffers. * added SDL.putenv and SDL.getenv * some internal C-side changes Release 0.6.1: * GL-related functions in a new module Sdlgl better LablGL interaction * compiles with the Mingw port of ocaml (see doc/ocamlsdl-mingw.txt) * fixed typos in type and constructor names * fixed Sdlttf.set_font_style and Sdlttf.get_font_style * fixed Sdlvideo.save_BMP Release 0.6: * Rewrote Sdlvideo and Sdlevent modules. Added several other modules. Release 0.5: * Ocamlplayer has been added, it plays audio file (ogg,xm, s3m, wav) on the commande line. * Applying many patches. Release 0.5-pre3: * Adding documentation directory * new function char_of_key in Sdlevent module Release 0.5-pre2: * Adding install and uninstall target stuff Release 0.5-pre1: (no released at sourceforge) * bigarray support in sdlvideo module * SDL-1.2, SDL_image-1.2.0, SDL_mixer-1.2.0, SDL_ttf-1.2.2 support but not fully implemented. * major changes in the internal structure of directories * some bugfixes * works with ocaml-3.01 Release 0.4: * The initial was arbitrary numbered 0.4. ocamlsdl-0.9.1/Makefile0000664000076400007640000000466711363142232013507 0ustar olivoliv# # OCamlSDL - An ML interface to the SDL library # Copyright (C) 1999 Frederic Brunel # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser 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 # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: Makefile,v 1.24 2010/04/19 21:01:14 oliv__a Exp $ all doc clean install: $(MAKE) -C src $@ .PHONY: all doc clean install include makefile.platform include makefile.config.$(OCAML_C_BACKEND) ifeq ($(OCAML_C_BACKEND),gcc) makefile.config.gcc : makefile.config.gcc.in configure $(error "please run ./configure or edit makefile.platform") configure : configure.in aclocal -I support autoconf endif DISTSRC := AUTHORS COPYING INSTALL INSTALL.win32 README README.macosx NEWS \ Makefile META.in \ configure.in aclocal.m4 configure \ makefile.platform.in makefile.config.gcc.in makefile.config.msvc makefile.rules \ support/install-sh support/ocaml.m4 support/config.sub support/config.guess \ src/sdl*.ml src/sdl*.mli src/sdl*.c src/sdl*.h \ src/common.c src/common.h src/mlsdl_main.c \ src/config.h.in src/config.h.msvc \ src/Makefile src/.depend src/.depend_c \ doc/ocamlsdl.texi doc/ocamlsdl.info doc/ocamlsdl-mingw.txt \ doc/html xpm_to_ml # hackish targets to build tarballs dist : dist-zip dist-tgz dist-zip : ../ocamlsdl-$(VERSION).zip dist-tgz : ../ocamlsdl-$(VERSION).tar.gz .PHONY : dist dist-zip dist-tgz ../ocamlsdl-$(VERSION).zip : $(DISTSRC) export DIRNAME=$${PWD##*/} ; \ cd .. && mv $$DIRNAME ocamlsdl-$(VERSION) && \ zip -9rl $(@F) $(addprefix ocamlsdl-$(VERSION)/,$(DISTSRC)) && \ mv ocamlsdl-$(VERSION) $$DIRNAME ../ocamlsdl-$(VERSION).tar.gz : $(DISTSRC) export DIRNAME=$${PWD##*/} ; \ cd .. && mv $$DIRNAME ocamlsdl-$(VERSION) && \ tar zcvf $(@F) $(addprefix ocamlsdl-$(VERSION)/,$(DISTSRC)) && \ mv ocamlsdl-$(VERSION) $$DIRNAME ocamlsdl-0.9.1/META.in0000664000076400007640000000115111760734161013117 0ustar olivolivdescription = "Bindings for the SDL multimedia library" requires = "bigarray" version = "@PACKAGE_VERSION@" archive(byte) = "sdl.cma" archive(native) =" sdl.cmxa" package "sdlimage" ( requires = "sdl" archive(byte) = "sdlloader.cma" archive(native) = "sdlloader.cmxa" ) package "sdlmixer" ( requires = "sdl" archive(byte) = "sdlmixer.cma" archive(native) = "sdlmixer.cmxa" ) package "sdlttf" ( requires = "sdl" archive(byte) = "sdlttf.cma" archive(native) = "sdlttf.cmxa" ) package "sdlgfx" ( requires = "sdl" archive(byte) = "sdlgfx.cma" archive(native) = "sdlgfx.cmxa" ) ocamlsdl-0.9.1/configure.in0000644000076400007640000000770611774642214014366 0ustar olivolivdnl ****** -*- autoconf -*- dnl OCamlSdl autoconf input dnl ****** dnl dnl $Id: configure.in,v 1.44 2012/07/03 19:14:20 oliv__a Exp $ AC_INIT(ocamlsdl, 0.9.1) AC_CONFIG_AUX_DIR(./support) AC_CONFIG_HEADERS(src/config.h) # Check for OCaml programs AC_PROG_OCAML AC_PROG_FINDLIB if test "$OCAML" = no ; then AC_MSG_ERROR([Cannot find ocaml]) fi if test "$OCAMLFIND" = no ; then unset OCAMLFIND fi # OCaml platform AC_CHECK_OCAML_OS_TYPE PLATFORM="$OCAML_OS_TYPE" AC_SUBST(PLATFORM) # Check for programs if test -z "$CFLAGS" ; then CFLAGS="-g -O" fi AC_PROG_CC AC_OBJEXT AC_PROG_RANLIB AC_FUNC_ALLOCA AC_C_INLINE if test "$ac_cv_c_inline" != no ; then AC_DEFINE(HAVE_INLINE) fi AC_PROG_INSTALL # Checking for lablGL AC_ARG_WITH(lablgldir, [ --with-lablgldir=DIR specify location of lablgl], LABLGLDIR="$withval") AC_CHECK_OCAML_MODULE(LABLGLDIR,lablGL,Gl,+lablGL) if test "$LABLGLDIR" = no ; then unset LABLGLDIR ; fi # Where to install the library ? AC_ARG_WITH(installdir, [ --with-installdir=DIR specify installation directory [defaults to +sdl]], OCAMLSDLDIR="$withval", OCAMLSDLDIR="$OCAMLLIB/sdl") AC_SUBST(OCAMLSDLDIR) # Check for libraries # Check for SDL libraries SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) case $target in *-apple-darwin*) PLATFORM=Apple ;; esac LIBS="$LIBS $SDL_LIBS" CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" # cmdline options AC_ARG_ENABLE(sdl_ttf, [ --disable-sdl-ttf without freetype support [default is enabled]], sdl_ttf=$enableval, sdl_ttf=yes) AC_ARG_ENABLE(sdl_image, [ --disable-sdl-image without sdl image support [default is enabled]], sdl_image=$enableval, sdl_image=yes) AC_ARG_ENABLE(sdl_mixer, [ --disable-sdl-mixer without sdl mixer support [default is enabled]], sdl_mixer=$enableval, sdl_mixer=yes) AC_ARG_ENABLE(sdl_gfx, [ --disable-sdl-gfx without sdl gfx support [default is enabled]], sdl_gfx=$enableval, sdl_gfx=yes) AC_SUBST(PARTS) # Checking for lib SDL_ttf if test "$sdl_ttf" = yes ; then AC_CHECK_HEADERS(SDL_ttf.h, : , sdl_ttf=no) if test "$sdl_ttf" = yes ; then AC_CHECK_LIB(SDL_ttf, TTF_OpenFontRW, AC_DEFINE(OCAMLSDL_TTF_VERSION,206),[ AC_CHECK_LIB(SDL_ttf, TTF_OpenFontIndex, AC_DEFINE(OCAMLSDL_TTF_VERSION,204),[ AC_CHECK_LIB(SDL_ttf, TTF_OpenFont, AC_DEFINE(OCAMLSDL_TTF_VERSION,200), AC_MSG_ERROR(Cannot find SDL_tff library.)) ]) ]) PARTS="$PARTS ttf" fi fi # Checking for lib SDL_image if test "$sdl_image" = yes ; then AC_CHECK_HEADERS(SDL_image.h, : , sdl_image=no) if test "$sdl_image" = yes ; then AC_CHECK_LIB(SDL_image, IMG_ReadXPMFromArray, AC_DEFINE(OCAMLSDL_IMAGE_VERSION,121),[ AC_CHECK_LIB(SDL_image, IMG_Load_RW, AC_DEFINE(OCAMLSDL_IMAGE_VERSION,120), AC_MSG_ERROR(Cannot find SDL_image library.)) ]) PARTS="$PARTS loader" fi fi # Checking for lib SDL_mixer if test "$sdl_mixer" = yes ; then AC_CHECK_HEADERS(SDL_mixer.h, : , sdl_mixer=no) if test "$sdl_mixer" = yes ; then AC_CHECK_LIB(SDL_mixer, Mix_QuickLoad_WAV, :, AC_MSG_ERROR(Cannot find SDL_mixer library.)) PARTS="$PARTS mixer" fi fi # Checking for lib SDL_gfx if test "$sdl_gfx" = yes ; then AC_CHECK_HEADERS(SDL_gfxPrimitives.h, : , sdl_gfx=no) if test "$sdl_gfx" = yes ; then AC_CHECK_LIB(SDL_gfx, pixelColor, :, AC_MSG_ERROR(Cannot find SDL_gfx library.)) PARTS="$PARTS gfx" fi fi # Output configuration files AC_CONFIG_FILES([META makefile.platform makefile.config.gcc]) AC_OUTPUT # Output the configuration summary echo echo "Configure summary:" if test -n "$LABLGLDIR" ; then lablgl_support=yes ; else lablgl_support=no ; fi echo " LablGL " $lablgl_support echo " SDL_image " $sdl_image echo " SDL_mixer " $sdl_mixer echo " SDL_tff " $sdl_ttf echo " SDL_gfx " $sdl_gfx echo echo "Configure finished, type 'make' to build." ocamlsdl-0.9.1/aclocal.m40000664000076400007640000001575411774642777013737 0ustar olivoliv# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # 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_config_args="$sdl_config_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_config_args="$sdl_config_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi as_save_PATH="$PATH" if test "x$prefix" != xNONE; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) PATH="$as_save_PATH" 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 $sdl_config_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_config_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_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $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" CXXFLAGS="$ac_save_CXXFLAGS" 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" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main ], [ 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" CXXFLAGS="$ac_save_CXXFLAGS" 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 ]) m4_include([support/ocaml.m4]) ocamlsdl-0.9.1/configure0000775000076400007640000061516111774643000013760 0ustar olivoliv#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for ocamlsdl 0.9.1. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ocamlsdl' PACKAGE_TARNAME='ocamlsdl' PACKAGE_VERSION='0.9.1' PACKAGE_STRING='ocamlsdl 0.9.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS PARTS SDL_LIBS SDL_CFLAGS SDL_CONFIG OCAMLSDLDIR LABLGLDIR INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM ALLOCA EGREP GREP CPP RANLIB OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC PLATFORM OCAML_OS_TYPE OCAMLFIND OCAMLBUILD OCAMLDOC OCAMLMKLIB OCAMLMKTOP OCAMLDEP OCAML OCAMLOPTDOTOPT OCAMLCDOTOPT OCAMLBEST OCAMLOPT OCAMLLIB OCAMLVERSION OCAMLC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_lablgldir with_installdir with_sdl_prefix with_sdl_exec_prefix enable_sdltest enable_sdl_ttf enable_sdl_image enable_sdl_mixer enable_sdl_gfx ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures ocamlsdl 0.9.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/ocamlsdl] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of ocamlsdl 0.9.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-sdltest Do not try to compile and run a test SDL program --disable-sdl-ttf without freetype support default is enabled --disable-sdl-image without sdl image support default is enabled --disable-sdl-mixer without sdl mixer support default is enabled --disable-sdl-gfx without sdl gfx support default is enabled Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-lablgldir=DIR specify location of lablgl --with-installdir=DIR specify installation directory defaults to +sdl --with-sdl-prefix=PFX Prefix where SDL is installed (optional) --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF ocamlsdl configure 0.9.1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ocamlsdl $as_me 0.9.1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in ./support "$srcdir"/./support; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in ./support \"$srcdir\"/./support" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers src/config.h" # Check for OCaml programs # checking for ocamlc if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLC"; then ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLC=$ac_cv_prog_OCAMLC if test -n "$OCAMLC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5 $as_echo "$OCAMLC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLC"; then ac_ct_OCAMLC=$OCAMLC # Extract the first word of "ocamlc", so it can be a program name with args. set dummy ocamlc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLC"; then ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLC="ocamlc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC if test -n "$ac_ct_OCAMLC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5 $as_echo "$ac_ct_OCAMLC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLC" = x; then OCAMLC="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLC=$ac_ct_OCAMLC fi else OCAMLC="$ac_cv_prog_OCAMLC" fi if test "$OCAMLC" != "no"; then OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5 $as_echo "OCaml version is $OCAMLVERSION" >&6; } # If OCAMLLIB is set, use it if test "$OCAMLLIB" = ""; then OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4` else { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5 $as_echo "OCAMLLIB previously set; preserving it." >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5 $as_echo "OCaml library path is $OCAMLLIB" >&6; } # checking for ocamlopt if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLOPT"; then ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLOPT=$ac_cv_prog_OCAMLOPT if test -n "$OCAMLOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5 $as_echo "$OCAMLOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLOPT"; then ac_ct_OCAMLOPT=$OCAMLOPT # Extract the first word of "ocamlopt", so it can be a program name with args. set dummy ocamlopt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLOPT"; then ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT if test -n "$ac_ct_OCAMLOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5 $as_echo "$ac_ct_OCAMLOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLOPT" = x; then OCAMLOPT="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLOPT=$ac_ct_OCAMLOPT fi else OCAMLOPT="$ac_cv_prog_OCAMLOPT" fi OCAMLBEST=byte if test "$OCAMLOPT" = "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5 $as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;} else TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5 $as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; } OCAMLOPT=no else OCAMLBEST=opt fi fi # checking for ocamlc.opt if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLCDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLCDOTOPT"; then ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT if test -n "$OCAMLCDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5 $as_echo "$OCAMLCDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT # Extract the first word of "ocamlc.opt", so it can be a program name with args. set dummy ocamlc.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLCDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLCDOTOPT"; then ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT if test -n "$ac_ct_OCAMLCDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5 $as_echo "$ac_ct_OCAMLCDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLCDOTOPT" = x; then OCAMLCDOTOPT="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT fi else OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT" fi if test "$OCAMLCDOTOPT" != "no"; then TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5 $as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; } else OCAMLC=$OCAMLCDOTOPT fi fi # checking for ocamlopt.opt if test "$OCAMLOPT" != "no" ; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLOPTDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLOPTDOTOPT"; then ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT if test -n "$OCAMLOPTDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5 $as_echo "$OCAMLOPTDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT # Extract the first word of "ocamlopt.opt", so it can be a program name with args. set dummy ocamlopt.opt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLOPTDOTOPT"; then ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT if test -n "$ac_ct_OCAMLOPTDOTOPT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5 $as_echo "$ac_ct_OCAMLOPTDOTOPT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then OCAMLOPTDOTOPT="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT fi else OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT" fi if test "$OCAMLOPTDOTOPT" != "no"; then TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5 $as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; } else OCAMLOPT=$OCAMLOPTDOTOPT fi fi fi fi # checking for ocaml toplevel if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args. set dummy ${ac_tool_prefix}ocaml; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAML+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAML"; then ac_cv_prog_OCAML="$OCAML" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAML="${ac_tool_prefix}ocaml" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAML=$ac_cv_prog_OCAML if test -n "$OCAML"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5 $as_echo "$OCAML" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAML"; then ac_ct_OCAML=$OCAML # Extract the first word of "ocaml", so it can be a program name with args. set dummy ocaml; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAML+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAML"; then ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAML="ocaml" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML if test -n "$ac_ct_OCAML"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5 $as_echo "$ac_ct_OCAML" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAML" = x; then OCAML="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAML=$ac_ct_OCAML fi else OCAML="$ac_cv_prog_OCAML" fi # checking for ocamldep if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamldep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLDEP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLDEP"; then ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLDEP=$ac_cv_prog_OCAMLDEP if test -n "$OCAMLDEP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5 $as_echo "$OCAMLDEP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLDEP"; then ac_ct_OCAMLDEP=$OCAMLDEP # Extract the first word of "ocamldep", so it can be a program name with args. set dummy ocamldep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLDEP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLDEP"; then ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLDEP="ocamldep" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP if test -n "$ac_ct_OCAMLDEP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5 $as_echo "$ac_ct_OCAMLDEP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLDEP" = x; then OCAMLDEP="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLDEP=$ac_ct_OCAMLDEP fi else OCAMLDEP="$ac_cv_prog_OCAMLDEP" fi # checking for ocamlmktop if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLMKTOP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLMKTOP"; then ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP if test -n "$OCAMLMKTOP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5 $as_echo "$OCAMLMKTOP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLMKTOP"; then ac_ct_OCAMLMKTOP=$OCAMLMKTOP # Extract the first word of "ocamlmktop", so it can be a program name with args. set dummy ocamlmktop; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLMKTOP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLMKTOP"; then ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP if test -n "$ac_ct_OCAMLMKTOP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5 $as_echo "$ac_ct_OCAMLMKTOP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLMKTOP" = x; then OCAMLMKTOP="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLMKTOP=$ac_ct_OCAMLMKTOP fi else OCAMLMKTOP="$ac_cv_prog_OCAMLMKTOP" fi # checking for ocamlmklib if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlmklib", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlmklib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLMKLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLMKLIB"; then ac_cv_prog_OCAMLMKLIB="$OCAMLMKLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLMKLIB="${ac_tool_prefix}ocamlmklib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLMKLIB=$ac_cv_prog_OCAMLMKLIB if test -n "$OCAMLMKLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKLIB" >&5 $as_echo "$OCAMLMKLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLMKLIB"; then ac_ct_OCAMLMKLIB=$OCAMLMKLIB # Extract the first word of "ocamlmklib", so it can be a program name with args. set dummy ocamlmklib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLMKLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLMKLIB"; then ac_cv_prog_ac_ct_OCAMLMKLIB="$ac_ct_OCAMLMKLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLMKLIB="ocamlmklib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLMKLIB=$ac_cv_prog_ac_ct_OCAMLMKLIB if test -n "$ac_ct_OCAMLMKLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKLIB" >&5 $as_echo "$ac_ct_OCAMLMKLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLMKLIB" = x; then OCAMLMKLIB="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLMKLIB=$ac_ct_OCAMLMKLIB fi else OCAMLMKLIB="$ac_cv_prog_OCAMLMKLIB" fi # checking for ocamldoc if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamldoc", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamldoc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLDOC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLDOC"; then ac_cv_prog_OCAMLDOC="$OCAMLDOC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLDOC="${ac_tool_prefix}ocamldoc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLDOC=$ac_cv_prog_OCAMLDOC if test -n "$OCAMLDOC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLDOC" >&5 $as_echo "$OCAMLDOC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLDOC"; then ac_ct_OCAMLDOC=$OCAMLDOC # Extract the first word of "ocamldoc", so it can be a program name with args. set dummy ocamldoc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLDOC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLDOC"; then ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC if test -n "$ac_ct_OCAMLDOC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5 $as_echo "$ac_ct_OCAMLDOC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLDOC" = x; then OCAMLDOC="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLDOC=$ac_ct_OCAMLDOC fi else OCAMLDOC="$ac_cv_prog_OCAMLDOC" fi # checking for ocamlbuild if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLBUILD+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLBUILD"; then ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLBUILD=$ac_cv_prog_OCAMLBUILD if test -n "$OCAMLBUILD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5 $as_echo "$OCAMLBUILD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLBUILD"; then ac_ct_OCAMLBUILD=$OCAMLBUILD # Extract the first word of "ocamlbuild", so it can be a program name with args. set dummy ocamlbuild; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLBUILD+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLBUILD"; then ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD if test -n "$ac_ct_OCAMLBUILD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5 $as_echo "$ac_ct_OCAMLBUILD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLBUILD" = x; then OCAMLBUILD="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLBUILD=$ac_ct_OCAMLBUILD fi else OCAMLBUILD="$ac_cv_prog_OCAMLBUILD" fi # checking for ocamlfind if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args. set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OCAMLFIND+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OCAMLFIND"; then ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OCAMLFIND=$ac_cv_prog_OCAMLFIND if test -n "$OCAMLFIND"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5 $as_echo "$OCAMLFIND" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OCAMLFIND"; then ac_ct_OCAMLFIND=$OCAMLFIND # Extract the first word of "ocamlfind", so it can be a program name with args. set dummy ocamlfind; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OCAMLFIND+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OCAMLFIND"; then ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND if test -n "$ac_ct_OCAMLFIND"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5 $as_echo "$ac_ct_OCAMLFIND" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OCAMLFIND" = x; then OCAMLFIND="no" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OCAMLFIND=$ac_ct_OCAMLFIND fi else OCAMLFIND="$ac_cv_prog_OCAMLFIND" fi if test "$OCAML" = no ; then as_fn_error $? "Cannot find ocaml" "$LINENO" 5 fi if test "$OCAMLFIND" = no ; then unset OCAMLFIND fi # OCaml platform { $as_echo "$as_me:${as_lineno-$LINENO}: checking OCaml Sys.os_type" >&5 $as_echo_n "checking OCaml Sys.os_type... " >&6; } cat > conftest.ml <&5 $as_echo "$OCAML_OS_TYPE" >&6; } PLATFORM="$OCAML_OS_TYPE" # Check for programs if test -z "$CFLAGS" ; then CFLAGS="-g -O" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac if test "$ac_cv_c_inline" != no ; then $as_echo "#define HAVE_INLINE 1" >>confdefs.h fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Checking for lablGL # Check whether --with-lablgldir was given. if test "${with_lablgldir+set}" = set; then : withval=$with_lablgldir; LABLGLDIR="$withval" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OCaml module lablGL" >&5 $as_echo_n "checking for OCaml module lablGL... " >&6; } cat > conftest.ml <&5 2>&5 ; then found=yes break fi done if test "$found" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LABLGLDIR" >&5 $as_echo "$LABLGLDIR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } LABLGLDIR=no fi if test "$LABLGLDIR" = no ; then unset LABLGLDIR ; fi # Where to install the library ? # Check whether --with-installdir was given. if test "${with_installdir+set}" = set; then : withval=$with_installdir; OCAMLSDLDIR="$withval" else OCAMLSDLDIR="$OCAMLLIB/sdl" fi # Check for libraries # Check for SDL libraries SDL_VERSION=1.2.0 # Check whether --with-sdl-prefix was given. if test "${with_sdl_prefix+set}" = set; then : withval=$with_sdl_prefix; sdl_prefix="$withval" else sdl_prefix="" fi # Check whether --with-sdl-exec-prefix was given. if test "${with_sdl_exec_prefix+set}" = set; then : withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" else sdl_exec_prefix="" fi # Check whether --enable-sdltest was given. if test "${enable_sdltest+set}" = set; then : enableval=$enable_sdltest; else enable_sdltest=yes fi if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_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_config_args="$sdl_config_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi as_save_PATH="$PATH" if test "x$prefix" != xNONE; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SDL_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $SDL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" ;; esac fi SDL_CONFIG=$ac_cv_path_SDL_CONFIG if test -n "$SDL_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL_CONFIG" >&5 $as_echo "$SDL_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi PATH="$as_save_PATH" min_sdl_version=$SDL_VERSION { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 $as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_config_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_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest if test "$cross_compiling" = yes; then : echo $ac_n "cross compiling; assumed OK... $ac_c" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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; } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else no_sdl=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : 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" else 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" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5 fi rm -f conf.sdltest case $target in *-apple-darwin*) PLATFORM=Apple ;; esac LIBS="$LIBS $SDL_LIBS" CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" # cmdline options # Check whether --enable-sdl_ttf was given. if test "${enable_sdl_ttf+set}" = set; then : enableval=$enable_sdl_ttf; sdl_ttf=$enableval else sdl_ttf=yes fi # Check whether --enable-sdl_image was given. if test "${enable_sdl_image+set}" = set; then : enableval=$enable_sdl_image; sdl_image=$enableval else sdl_image=yes fi # Check whether --enable-sdl_mixer was given. if test "${enable_sdl_mixer+set}" = set; then : enableval=$enable_sdl_mixer; sdl_mixer=$enableval else sdl_mixer=yes fi # Check whether --enable-sdl_gfx was given. if test "${enable_sdl_gfx+set}" = set; then : enableval=$enable_sdl_gfx; sdl_gfx=$enableval else sdl_gfx=yes fi # Checking for lib SDL_ttf if test "$sdl_ttf" = yes ; then for ac_header in SDL_ttf.h do : ac_fn_c_check_header_mongrel "$LINENO" "SDL_ttf.h" "ac_cv_header_SDL_ttf_h" "$ac_includes_default" if test "x$ac_cv_header_SDL_ttf_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SDL_TTF_H 1 _ACEOF : else sdl_ttf=no fi done if test "$sdl_ttf" = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_OpenFontRW in -lSDL_ttf" >&5 $as_echo_n "checking for TTF_OpenFontRW in -lSDL_ttf... " >&6; } if ${ac_cv_lib_SDL_ttf_TTF_OpenFontRW+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TTF_OpenFontRW (); int main () { return TTF_OpenFontRW (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_ttf_TTF_OpenFontRW=yes else ac_cv_lib_SDL_ttf_TTF_OpenFontRW=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_ttf_TTF_OpenFontRW" >&5 $as_echo "$ac_cv_lib_SDL_ttf_TTF_OpenFontRW" >&6; } if test "x$ac_cv_lib_SDL_ttf_TTF_OpenFontRW" = xyes; then : $as_echo "#define OCAMLSDL_TTF_VERSION 206" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_OpenFontIndex in -lSDL_ttf" >&5 $as_echo_n "checking for TTF_OpenFontIndex in -lSDL_ttf... " >&6; } if ${ac_cv_lib_SDL_ttf_TTF_OpenFontIndex+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TTF_OpenFontIndex (); int main () { return TTF_OpenFontIndex (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_ttf_TTF_OpenFontIndex=yes else ac_cv_lib_SDL_ttf_TTF_OpenFontIndex=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_ttf_TTF_OpenFontIndex" >&5 $as_echo "$ac_cv_lib_SDL_ttf_TTF_OpenFontIndex" >&6; } if test "x$ac_cv_lib_SDL_ttf_TTF_OpenFontIndex" = xyes; then : $as_echo "#define OCAMLSDL_TTF_VERSION 204" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_OpenFont in -lSDL_ttf" >&5 $as_echo_n "checking for TTF_OpenFont in -lSDL_ttf... " >&6; } if ${ac_cv_lib_SDL_ttf_TTF_OpenFont+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TTF_OpenFont (); int main () { return TTF_OpenFont (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_ttf_TTF_OpenFont=yes else ac_cv_lib_SDL_ttf_TTF_OpenFont=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_ttf_TTF_OpenFont" >&5 $as_echo "$ac_cv_lib_SDL_ttf_TTF_OpenFont" >&6; } if test "x$ac_cv_lib_SDL_ttf_TTF_OpenFont" = xyes; then : $as_echo "#define OCAMLSDL_TTF_VERSION 200" >>confdefs.h else as_fn_error $? "Cannot find SDL_tff library." "$LINENO" 5 fi fi fi PARTS="$PARTS ttf" fi fi # Checking for lib SDL_image if test "$sdl_image" = yes ; then for ac_header in SDL_image.h do : ac_fn_c_check_header_mongrel "$LINENO" "SDL_image.h" "ac_cv_header_SDL_image_h" "$ac_includes_default" if test "x$ac_cv_header_SDL_image_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SDL_IMAGE_H 1 _ACEOF : else sdl_image=no fi done if test "$sdl_image" = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IMG_ReadXPMFromArray in -lSDL_image" >&5 $as_echo_n "checking for IMG_ReadXPMFromArray in -lSDL_image... " >&6; } if ${ac_cv_lib_SDL_image_IMG_ReadXPMFromArray+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_image $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IMG_ReadXPMFromArray (); int main () { return IMG_ReadXPMFromArray (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_image_IMG_ReadXPMFromArray=yes else ac_cv_lib_SDL_image_IMG_ReadXPMFromArray=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_image_IMG_ReadXPMFromArray" >&5 $as_echo "$ac_cv_lib_SDL_image_IMG_ReadXPMFromArray" >&6; } if test "x$ac_cv_lib_SDL_image_IMG_ReadXPMFromArray" = xyes; then : $as_echo "#define OCAMLSDL_IMAGE_VERSION 121" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IMG_Load_RW in -lSDL_image" >&5 $as_echo_n "checking for IMG_Load_RW in -lSDL_image... " >&6; } if ${ac_cv_lib_SDL_image_IMG_Load_RW+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_image $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IMG_Load_RW (); int main () { return IMG_Load_RW (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_image_IMG_Load_RW=yes else ac_cv_lib_SDL_image_IMG_Load_RW=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_image_IMG_Load_RW" >&5 $as_echo "$ac_cv_lib_SDL_image_IMG_Load_RW" >&6; } if test "x$ac_cv_lib_SDL_image_IMG_Load_RW" = xyes; then : $as_echo "#define OCAMLSDL_IMAGE_VERSION 120" >>confdefs.h else as_fn_error $? "Cannot find SDL_image library." "$LINENO" 5 fi fi PARTS="$PARTS loader" fi fi # Checking for lib SDL_mixer if test "$sdl_mixer" = yes ; then for ac_header in SDL_mixer.h do : ac_fn_c_check_header_mongrel "$LINENO" "SDL_mixer.h" "ac_cv_header_SDL_mixer_h" "$ac_includes_default" if test "x$ac_cv_header_SDL_mixer_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SDL_MIXER_H 1 _ACEOF : else sdl_mixer=no fi done if test "$sdl_mixer" = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mix_QuickLoad_WAV in -lSDL_mixer" >&5 $as_echo_n "checking for Mix_QuickLoad_WAV in -lSDL_mixer... " >&6; } if ${ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_mixer $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Mix_QuickLoad_WAV (); int main () { return Mix_QuickLoad_WAV (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV=yes else ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV" >&5 $as_echo "$ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV" >&6; } if test "x$ac_cv_lib_SDL_mixer_Mix_QuickLoad_WAV" = xyes; then : : else as_fn_error $? "Cannot find SDL_mixer library." "$LINENO" 5 fi PARTS="$PARTS mixer" fi fi # Checking for lib SDL_gfx if test "$sdl_gfx" = yes ; then for ac_header in SDL_gfxPrimitives.h do : ac_fn_c_check_header_mongrel "$LINENO" "SDL_gfxPrimitives.h" "ac_cv_header_SDL_gfxPrimitives_h" "$ac_includes_default" if test "x$ac_cv_header_SDL_gfxPrimitives_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SDL_GFXPRIMITIVES_H 1 _ACEOF : else sdl_gfx=no fi done if test "$sdl_gfx" = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pixelColor in -lSDL_gfx" >&5 $as_echo_n "checking for pixelColor in -lSDL_gfx... " >&6; } if ${ac_cv_lib_SDL_gfx_pixelColor+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_gfx $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pixelColor (); int main () { return pixelColor (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL_gfx_pixelColor=yes else ac_cv_lib_SDL_gfx_pixelColor=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_gfx_pixelColor" >&5 $as_echo "$ac_cv_lib_SDL_gfx_pixelColor" >&6; } if test "x$ac_cv_lib_SDL_gfx_pixelColor" = xyes; then : : else as_fn_error $? "Cannot find SDL_gfx library." "$LINENO" 5 fi PARTS="$PARTS gfx" fi fi # Output configuration files ac_config_files="$ac_config_files META makefile.platform makefile.config.gcc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by ocamlsdl $as_me 0.9.1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ ocamlsdl config.status 0.9.1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "META") CONFIG_FILES="$CONFIG_FILES META" ;; "makefile.platform") CONFIG_FILES="$CONFIG_FILES makefile.platform" ;; "makefile.config.gcc") CONFIG_FILES="$CONFIG_FILES makefile.config.gcc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi # Output the configuration summary echo echo "Configure summary:" if test -n "$LABLGLDIR" ; then lablgl_support=yes ; else lablgl_support=no ; fi echo " LablGL " $lablgl_support echo " SDL_image " $sdl_image echo " SDL_mixer " $sdl_mixer echo " SDL_tff " $sdl_ttf echo " SDL_gfx " $sdl_gfx echo echo "Configure finished, type 'make' to build." ocamlsdl-0.9.1/makefile.platform.in0000664000076400007640000000036311363142232015764 0ustar olivoliv# -*- makefile -*- # The ocamlsdl version, from configure.in VERSION = @PACKAGE_VERSION@ # The OCaml platform, should be Unix, Win32, Cygwin or Apple PLATFORM = @PLATFORM@ # The type of C compiler, either gcc or msvc OCAML_C_BACKEND = gcc ocamlsdl-0.9.1/makefile.config.gcc.in0000664000076400007640000000222710177260120016140 0ustar olivoliv# -*- makefile -*- PREFIX = @prefix@ OCAMLLIBDIR = @OCAMLLIB@ OCAMLSDLDIR = @OCAMLSDLDIR@ BINDIR = $(PREFIX)/bin LABLGLDIR = @LABLGLDIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ PARTS = @PARTS@ CC = @CC@ CPPFLAGS = @CPPFLAGS@ CFLAGS = @CFLAGS@ RANLIB = @RANLIB@ OBJEXT = @OBJEXT@ A = a SYSLIB = -l$(1) OCAMLC = @OCAMLC@ OCAMLOPT = @OCAMLOPT@ OCAMLDEP = @OCAMLDEP@ OCAMLMKLIB = @OCAMLMKLIB@ OCAMLDOC = @OCAMLDOC@ OCAMLFIND = @OCAMLFIND@ SDL_LIBS = @SDL_LIBS@ SYSLIB = @SDL_LIBS@ -l$(1) ifndef OCAMLMKLIB # 1 -> name # 2 -> clib name # 3 -> object files # 4 -> C libs & ld flags MKCMA = $(OCAMLC) -a -o $(1).cma -cclib -l$(2) -custom $(3) $(addprefix -cclib ,$(filter -l%,$(4))) $(addprefix -ccopt ,$(filter-out -l%,$(4))) MKCMXA = $(OCAMLOPT) -a -o $(1).cmxa -cclib -l$(2) $(3) $(addprefix -cclib ,$(filter -l%,$(4))) $(addprefix -ccopt ,$(filter-out -l%,$(4))) MKCLIB = ar cr lib$(2).$(A) $(3) ; $(RANLIB) lib$(2).$(A) else MKCMA = $(OCAMLMKLIB) -v -o $(1) -oc $(2) $(3) $(4) MKCMXA = $(OCAMLMKLIB) -v -o $(1) -oc $(2) $(3) $(4) MKCLIB = $(OCAMLMKLIB) -v -o $(1) -oc $(2) $(3) $(4) endif ocamlsdl-0.9.1/makefile.config.msvc0000664000076400007640000000117210101051461015736 0ustar olivoliv# -*- makefile -*- LABLGLDIR = PARTS = ttf loader mixer CPPFLAGS = /MT CFLAGS = /O RANLIB = OBJEXT = obj A = lib SYSLIB = $(1).lib OCAMLC = ocamlc OCAMLOPT = ocamlopt OCAMLDEP = ocamldep CAMLDOC = ocamldoc OCAMLMKLIB = OCAMLDOC = ocamldoc OCAMLFIND = SDL_LIBS = SDL.lib SDLmain.lib SYSLIB = $(1).lib # 1 -> name # 2 -> clib name # 3 -> object files # 4 -> C libs & ld flags MKCMA = $(OCAMLC) -a -o $(1).cma -cclib $(2).lib -custom $(3) $(addprefix -cclib ,$(4)) MKCMXA = $(OCAMLOPT) -a -o $(1).cma -cclib $(2).lib $(3) $(addprefix -cclib ,$(4)) MKCLIB = lib /out:lib$(2).$(A) $(3) ocamlsdl-0.9.1/makefile.rules0000664000076400007640000000101110101051461014644 0ustar olivoliv# -*- makefile -*- %.cmi : %.mli $(OCAMLC) $(MLINC) $< %.cmo : %.ml $(OCAMLC) -c $(MLINC) $(MLFLAGS) $< %.cmx : %.ml $(OCAMLOPT) -c $(MLINC) $(OMLFLAGS) $< %.$(OBJEXT) : %.c $(OCAMLC) -ccopt "$(CPPFLAGS) $(CFLAGS)" $< STUB_SRCS = $(patsubst %,%_stub.c,$($(1)_MODULES)) $($(1)_C_SRC) STUB_OBJS = $(patsubst %.c,%.$(OBJEXT),$(call STUB_SRCS,$(1))) ML_SRCS = $(patsubst %,%.ml,$($(1)_MODULES)) ML_OBJS = $(patsubst %.ml,%.cmo,$(call ML_SRCS,$(1))) ML_OPT_OBJS = $(patsubst %.ml,%.cmx,$(call ML_SRCS,$(1))) ocamlsdl-0.9.1/support/install-sh0000775000076400007640000003253711363125112015562 0ustar olivoliv#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # 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. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # 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 $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: ocamlsdl-0.9.1/support/ocaml.m40000664000076400007640000001345011363125112015104 0ustar olivolivdnl autoconf macros for OCaml dnl dnl Copyright © 2009 Richard W.M. Jones dnl Copyright © 2009 Stefano Zacchiroli dnl Copyright © 2000-2005 Olivier Andrieu dnl Copyright © 2000-2005 Jean-Christophe Filliâtre dnl Copyright © 2000-2005 Georges Mariano dnl dnl For documentation, please read the ocaml.m4 man page. AC_DEFUN([AC_PROG_OCAML], [dnl # checking for ocamlc AC_CHECK_TOOL([OCAMLC],[ocamlc],[no]) if test "$OCAMLC" != "no"; then OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` AC_MSG_RESULT([OCaml version is $OCAMLVERSION]) # If OCAMLLIB is set, use it if test "$OCAMLLIB" = ""; then OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4` else AC_MSG_RESULT([OCAMLLIB previously set; preserving it.]) fi AC_MSG_RESULT([OCaml library path is $OCAMLLIB]) AC_SUBST([OCAMLVERSION]) AC_SUBST([OCAMLLIB]) # checking for ocamlopt AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no]) OCAMLBEST=byte if test "$OCAMLOPT" = "no"; then AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.]) else TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.]) OCAMLOPT=no else OCAMLBEST=opt fi fi AC_SUBST([OCAMLBEST]) # checking for ocamlc.opt AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no]) if test "$OCAMLCDOTOPT" != "no"; then TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.]) else OCAMLC=$OCAMLCDOTOPT fi fi # checking for ocamlopt.opt if test "$OCAMLOPT" != "no" ; then AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no]) if test "$OCAMLOPTDOTOPT" != "no"; then TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.]) else OCAMLOPT=$OCAMLOPTDOTOPT fi fi fi AC_SUBST([OCAMLOPT]) fi AC_SUBST([OCAMLC]) # checking for ocaml toplevel AC_CHECK_TOOL([OCAML],[ocaml],[no]) # checking for ocamldep AC_CHECK_TOOL([OCAMLDEP],[ocamldep],[no]) # checking for ocamlmktop AC_CHECK_TOOL([OCAMLMKTOP],[ocamlmktop],[no]) # checking for ocamlmklib AC_CHECK_TOOL([OCAMLMKLIB],[ocamlmklib],[no]) # checking for ocamldoc AC_CHECK_TOOL([OCAMLDOC],[ocamldoc],[no]) # checking for ocamlbuild AC_CHECK_TOOL([OCAMLBUILD],[ocamlbuild],[no]) ]) AC_DEFUN([AC_PROG_OCAMLLEX], [dnl # checking for ocamllex AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no]) if test "$OCAMLLEX" != "no"; then AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no]) if test "$OCAMLLEXDOTOPT" != "no"; then OCAMLLEX=$OCAMLLEXDOTOPT fi fi AC_SUBST([OCAMLLEX]) ]) AC_DEFUN([AC_PROG_OCAMLYACC], [dnl AC_CHECK_TOOL([OCAMLYACC],[ocamlyacc],[no]) AC_SUBST([OCAMLYACC]) ]) AC_DEFUN([AC_PROG_CAMLP4], [dnl AC_REQUIRE([AC_PROG_OCAML])dnl # checking for camlp4 AC_CHECK_TOOL([CAMLP4],[camlp4],[no]) if test "$CAMLP4" != "no"; then TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'` if test "$TMPVERSION" != "$OCAMLVERSION" ; then AC_MSG_RESULT([versions differs from ocamlc]) CAMLP4=no fi fi AC_SUBST([CAMLP4]) # checking for companion tools AC_CHECK_TOOL([CAMLP4BOOT],[camlp4boot],[no]) AC_CHECK_TOOL([CAMLP4O],[camlp4o],[no]) AC_CHECK_TOOL([CAMLP4OF],[camlp4of],[no]) AC_CHECK_TOOL([CAMLP4OOF],[camlp4oof],[no]) AC_CHECK_TOOL([CAMLP4ORF],[camlp4orf],[no]) AC_CHECK_TOOL([CAMLP4PROF],[camlp4prof],[no]) AC_CHECK_TOOL([CAMLP4R],[camlp4r],[no]) AC_CHECK_TOOL([CAMLP4RF],[camlp4rf],[no]) AC_SUBST([CAMLP4BOOT]) AC_SUBST([CAMLP4O]) AC_SUBST([CAMLP4OF]) AC_SUBST([CAMLP4OOF]) AC_SUBST([CAMLP4ORF]) AC_SUBST([CAMLP4PROF]) AC_SUBST([CAMLP4R]) AC_SUBST([CAMLP4RF]) ]) AC_DEFUN([AC_PROG_FINDLIB], [dnl AC_REQUIRE([AC_PROG_OCAML])dnl # checking for ocamlfind AC_CHECK_TOOL([OCAMLFIND],[ocamlfind],[no]) AC_SUBST([OCAMLFIND]) ]) dnl Thanks to Jim Meyering for working this next bit out for us. dnl XXX We should define AS_TR_SH if it's not defined already dnl (eg. for old autoconf). AC_DEFUN([AC_CHECK_OCAML_PKG], [dnl AC_REQUIRE([AC_PROG_FINDLIB])dnl AC_MSG_CHECKING([for OCaml findlib package $1]) unset found unset pkg found=no for pkg in $1 $2 ; do if $OCAMLFIND query $pkg >/dev/null 2>/dev/null; then AC_MSG_RESULT([found]) AS_TR_SH([OCAML_PKG_$1])=$pkg found=yes break fi done if test "$found" = "no" ; then AC_MSG_RESULT([not found]) AS_TR_SH([OCAML_PKG_$1])=no fi AC_SUBST(AS_TR_SH([OCAML_PKG_$1])) ]) AC_DEFUN([AC_CHECK_OCAML_MODULE], [dnl AC_MSG_CHECKING([for OCaml module $2]) cat > conftest.ml <&5 2>&5 ; then found=yes break fi done if test "$found" ; then AC_MSG_RESULT([$$1]) else AC_MSG_RESULT([not found]) $1=no fi AC_SUBST([$1]) ]) dnl XXX Cross-compiling AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE], [dnl AC_REQUIRE([AC_PROG_OCAML])dnl AC_MSG_CHECKING([for OCaml compiler word size]) cat > conftest.ml < conftest.ml <. Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # 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, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # 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 ;; * ) 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* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -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/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # 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 ;; abacus) basic_machine=abacus-unknown ;; 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 ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; 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 ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; 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 ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -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* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -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 ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -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 ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -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 score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-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 ;; -cnk*|-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ocamlsdl-0.9.1/support/config.guess0000775000076400007640000012761511363125112016100 0ustar olivoliv#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-20' # 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; 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 ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ 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 # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # 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 ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # 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. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; 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 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; 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 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; 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 ;; 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 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # 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 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; 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 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????: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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; 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 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi 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 ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; 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 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; 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 i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; 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 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; 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 ;; 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 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; 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 ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; 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 i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; 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 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' 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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *: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 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; 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 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *: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 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); 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 -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # 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 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; 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: ocamlsdl-0.9.1/src/sdlcdrom.ml0000664000076400007640000000517207524743130014777 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlcdrom.ml,v 1.6 2002/08/09 13:40:40 oliv__a Exp $ *) (* Define a new exception for CD-ROM errors and register it to be callable from C code. *) exception SDLcdrom_exception of string exception Trayempty let _ = Callback.register_exception "SDLcdrom_exception" (SDLcdrom_exception "") ; Callback.register_exception "SDLcdrom_nocd" Trayempty (* Types *) type cdrom_drive type cdrom_drive_status = | CD_TRAYEMPTY | CD_STOPPED | CD_PLAYING | CD_PAUSED type track_type = | TRACK_AUDIO | TRACK_DATA type track = { id : int ; kind : track_type ; length : int ; offset : int ; } type cdrom_info = { num_tracks : int ; curr_track : int ; curr_frame : int ; tracks : track array ; } (* Native C external functions *) external get_num_drives : unit -> int = "sdlcdrom_get_num_drives" external drive_name : int -> string = "sdlcdrom_drive_name" external cd_open : int -> cdrom_drive = "sdlcdrom_open" external cd_close : cdrom_drive -> unit = "sdlcdrom_close" external cd_status : cdrom_drive -> cdrom_drive_status = "sdlcdrom_status" external cd_info : cdrom_drive -> cdrom_info = "sdlcdrom_info" external cd_play_tracks : cdrom_drive -> start_track:int -> start_frame:int -> num_tracks:int -> num_frames:int -> unit = "sdlcdrom_play_tracks" external cd_pause : cdrom_drive -> unit = "sdlcdrom_pause" external cd_resume : cdrom_drive -> unit = "sdlcdrom_resume" external cd_stop : cdrom_drive -> unit = "sdlcdrom_stop" external cd_eject : cdrom_drive -> unit = "sdlcdrom_eject" (* ML functions *) let cd_play_track cdrom { id = num } = cd_play_tracks cdrom (num - 1) 0 1 0;; let msf_of_frames f = let s' = f / 75 in let m = s' / 60 in (m, s' mod 60, f mod 75) let frames_of_msf (m, s, f) = m * 60 * 75 + s * 75 + f ocamlsdl-0.9.1/src/sdlevent.ml0000664000076400007640000002145311363140165015007 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlevent.ml,v 1.13 2010/04/19 20:43:33 oliv__a Exp $ *) exception Event_exn of string let _ = Callback.register_exception "sdlevent_exn" (Event_exn "") type active_state = | MOUSEFOCUS | INPUTFOCUS | APPACTIVE external get_app_state : unit -> active_state list = "mlsdlevent_get_app_state" type active_event = { gain : bool ; ae_state : active_state list ; } type switch_state = | RELEASED | PRESSED type keyboard_event = { ke_which : int ; ke_state : switch_state ; keysym : Sdlkey.t ; keymod : Sdlkey.mod_state ; keycode : char ; unicode : int ; } type mousemotion_event = { mme_which : int ; mme_state : Sdlmouse.button list ; mme_x : int ; mme_y : int ; mme_xrel : int ; mme_yrel : int ; } type mousebutton_event = { mbe_which : int ; mbe_button : Sdlmouse.button ; mbe_state : switch_state ; mbe_x : int ; mbe_y : int ; } type joyaxis_event = { jae_which : int ; jae_axis : int ; jae_value : int ; } type joyball_event = { jle_which : int ; jle_ball : int ; jle_xrel : int ; jle_yrel : int ; } type joyhat_event = { jhe_which : int ; jhe_hat : int ; jhe_value : Sdljoystick.hat_value ; } type joybutton_event = { jbe_which : int ; jbe_button : int ; jbe_state : switch_state ; } type event = | ACTIVE of active_event | KEYDOWN of keyboard_event | KEYUP of keyboard_event | MOUSEMOTION of mousemotion_event | MOUSEBUTTONDOWN of mousebutton_event | MOUSEBUTTONUP of mousebutton_event | JOYAXISMOTION of joyaxis_event | JOYBALLMOTION of joyball_event | JOYHATMOTION of joyhat_event | JOYBUTTONDOWN of joybutton_event | JOYBUTTONUP of joybutton_event | QUIT | SYSWM | VIDEORESIZE of int * int | VIDEOEXPOSE | USER of int let string_of_event = function | ACTIVE _ -> "active" | KEYDOWN _ -> "key down" | KEYUP _ -> "key up" | MOUSEMOTION _ -> "mouse motion" | MOUSEBUTTONDOWN _ -> "mouse button down" | MOUSEBUTTONUP _ -> "mouse button up" | JOYAXISMOTION _ -> "joystick axis motion" | JOYBALLMOTION _ -> "joystick ball motion" | JOYHATMOTION _ -> "joystick hat motion" | JOYBUTTONDOWN _ -> "joystick button down" | JOYBUTTONUP _ -> "joystick button up" | QUIT -> "quit" | SYSWM -> "syswm" | VIDEORESIZE _ -> "resize" | VIDEOEXPOSE -> "expose" | USER c -> "user " ^ (string_of_int c) type event_kind = | ACTIVE_EVENT | KEYDOWN_EVENT | KEYUP_EVENT | MOUSEMOTION_EVENT | MOUSEBUTTONDOWN_EVENT | MOUSEBUTTONUP_EVENT | JOYAXISMOTION_EVENT | JOYBALL_EVENT | JOYHAT_EVENT | JOYBUTTONDOWN_EVENT | JOYBUTTONUP_EVENT | QUIT_EVENT | SYSWM_EVENT | RESIZE_EVENT | EXPOSE_EVENT | USER_EVENT type event_mask = int let active_mask = 0x02 let keydown_mask = 0x04 let keyup_mask = 0x08 let mousemotion_mask = 0x10 let mousebuttondown_mask = 0x20 let mousebuttonup_mask = 0x40 let joyaxismotion_mask = 0x80 let joyballmotion_mask = 0x100 let joyhatmotion_mask = 0x200 let joybuttondown_mask = 0x400 let joybuttonup_mask = 0x800 let quit_mask = 0x1000 let syswmevent_mask = 0x2000 let videoresize_mask = 0x10000 let videoexpose_mask = 0x20000 let userevent_mask = 0x1000000 let keyboard_event_mask = 0x0C let mouse_event_mask = 0x70 let joystick_event_mask = 0xF80 let all_events_mask = 0x7FFFFFFF let make_mask = List.fold_left (fun acc evt -> acc lor ( match evt with | ACTIVE_EVENT -> active_mask | KEYDOWN_EVENT -> keydown_mask | KEYUP_EVENT -> keyup_mask | MOUSEMOTION_EVENT -> mousemotion_mask | MOUSEBUTTONDOWN_EVENT -> mousebuttondown_mask | MOUSEBUTTONUP_EVENT -> mousebuttonup_mask | JOYAXISMOTION_EVENT -> joyaxismotion_mask | JOYBALL_EVENT -> joyballmotion_mask | JOYHAT_EVENT -> joyhatmotion_mask | JOYBUTTONDOWN_EVENT -> joybuttondown_mask | JOYBUTTONUP_EVENT -> joybuttonup_mask | QUIT_EVENT -> quit_mask | SYSWM_EVENT -> syswmevent_mask | RESIZE_EVENT -> videoresize_mask | EXPOSE_EVENT -> videoexpose_mask | USER_EVENT-> userevent_mask ) ) 0x00 external pump : unit -> unit = "ml_SDL_PumpEvents" external peek : ?mask:event_mask -> int -> event list = "mlsdlevent_peek" external get : ?mask:event_mask -> int -> event list = "mlsdlevent_get" external add : event list -> unit = "mlsdlevent_add" external has_event : unit -> bool = "mlsdlevent_has_event" external poll : unit -> event option = "mlsdlevent_poll" external wait : unit -> unit = "mlsdlevent_wait" external wait_event : unit -> event = "mlsdlevent_wait_event" (* SDL_PushEvent ? *) (* SDL_SetEventFilter *) (* SDL_GetEventFilter *) external get_state : event_kind -> bool = "mlsdlevent_get_state" external set_state : bool -> event_kind -> unit = "mlsdlevent_set_state" external set_state_by_mask : event_mask -> bool -> unit = "mlsdlevent_set_state_by_mask" let enable_events mask = set_state_by_mask mask true let disable_events mask = set_state_by_mask mask false external get_enabled_events : unit -> event_mask = "mlsdlevent_get_enabled" let of_mask mask = List.fold_left (fun acc (evt_t, m) -> if mask land m <> 0 then evt_t :: acc else acc ) [] [ ( ACTIVE_EVENT, active_mask ) ; ( KEYDOWN_EVENT, keydown_mask ) ; ( KEYUP_EVENT, keyup_mask ) ; ( MOUSEMOTION_EVENT, mousemotion_mask ) ; ( MOUSEBUTTONDOWN_EVENT, mousebuttondown_mask ) ; ( MOUSEBUTTONUP_EVENT, mousebuttonup_mask ) ; ( JOYAXISMOTION_EVENT, joyaxismotion_mask ) ; ( JOYBALL_EVENT, joyballmotion_mask ) ; ( JOYHAT_EVENT, joyhatmotion_mask ) ; ( JOYBUTTONDOWN_EVENT, joybuttondown_mask ) ; ( JOYBUTTONUP_EVENT, joybuttonup_mask ) ; ( QUIT_EVENT, quit_mask ) ; ( SYSWM_EVENT, syswmevent_mask ) ; ( RESIZE_EVENT, videoresize_mask ) ; ( EXPOSE_EVENT, videoexpose_mask ) ; ( USER_EVENT, userevent_mask ) ; ] let link_me = (* I need Sdlkey so that keysyms lookup tables are initialised and registered *) Sdlkey.link_me module Old = struct type keyboard_event_func = Sdlkey.t -> switch_state -> int -> int -> unit type mouse_event_func = Sdlmouse.button -> switch_state -> int -> int -> unit type mousemotion_event_func = int -> int -> unit type idle_event_func = unit -> unit type resize_event_func = int -> int -> unit let keyboard_event_func = ref (fun _ _ _ _ -> ()) let mouse_event_func = ref (fun _ _ _ _ -> ()) let mousemotion_event_func = ref (fun _ _ -> ()) let idle_event_func = ref ignore let resize_event_func = ref (fun _ _ -> ()) let set_keyboard_event_func f = keyboard_event_func := f let set_mouse_event_func f = mouse_event_func := f let set_mousemotion_event_func f = mousemotion_event_func := f let set_idle_event_func f = idle_event_func := f let set_resize_event_func f = resize_event_func := f exception Quit let in_loop = ref false let exit_event_loop () = if !in_loop then raise Quit let start_event_loop () = let do_loop () = match poll () with | Some (KEYDOWN ev | KEYUP ev) -> let x,y,_ = Sdlmouse.get_state () in !keyboard_event_func ev.keysym ev.ke_state x y | Some (MOUSEBUTTONDOWN ev | MOUSEBUTTONUP ev) -> let b = ev.mbe_button in let x = ev.mbe_x in let y = ev.mbe_y in let st = ev.mbe_state in !mouse_event_func b st x y | Some (MOUSEMOTION ev) -> let x = ev.mme_x in let y = ev.mme_y in !mousemotion_event_func x y | Some (VIDEORESIZE (x,y)) -> !resize_event_func x y | None -> !idle_event_func () | _ -> () in disable_events all_events_mask ; enable_events (make_mask [ KEYDOWN_EVENT ; KEYUP_EVENT ; MOUSEMOTION_EVENT ; MOUSEBUTTONUP_EVENT ; MOUSEBUTTONDOWN_EVENT ; RESIZE_EVENT ; ]) ; try in_loop := true; while true do do_loop () done with Quit -> in_loop := false end ocamlsdl-0.9.1/src/sdlgfx.ml0000664000076400007640000000535310225746431014457 0ustar olivolivopen Sdlvideo (* Primitives *) (* pixel *) external pixelColor : surface -> int -> int -> int32 -> bool = "ml_pixelColor" external pixelRGBA : surface -> int -> int -> color -> int -> bool = "ml_pixelRGBA" (* rectangle *) external rectangleColor : surface -> rect -> rect -> int32 -> bool = "ml_rectangleColor" external rectangleRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_rectangleRGBA" external boxColor : surface -> rect -> rect -> int32 -> bool = "ml_boxColor" external boxRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_boxRGBA" (* line *) external lineColor : surface -> rect -> rect -> int32 -> bool = "ml_lineColor" external lineRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_lineRGBA" external aalineColor : surface -> rect -> rect -> int32 -> bool = "ml_aalineColor" external aalineRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_aalineRGBA" (* circle *) external circleColor : surface -> rect -> int -> int32 -> bool = "ml_circleColor" external circleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_circleRGBA" external aacircleColor : surface -> rect -> int -> int32 -> bool = "ml_aacircleColor" external aacircleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_aacircleRGBA" external filledCircleColor : surface -> rect -> int -> int32 -> bool = "ml_filledCircleColor" external filledCircleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_filledCircleRGBA" (* ellipse *) external ellipseColor : surface -> rect -> rect -> int32 -> bool = "ml_ellipseColor" external ellipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_ellipseRGBA" external aaellipseColor : surface -> rect -> rect -> int32 -> bool = "ml_aaellipseColor" external aaellipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_aaellipseRGBA" external filledEllipseColor : surface -> rect -> rect -> int32 -> bool = "ml_filledEllipseColor" external filledEllipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_filledEllipseRGBA" (* text *) external characterColor : surface -> rect -> char -> int32 -> bool = "ml_characterColor" external characterRGBA : surface -> rect -> char -> color ->int -> bool = "ml_characterRGBA" external stringColor : surface -> rect -> string -> int32 -> bool = "ml_stringColor" external stringRGBA : surface -> rect -> string -> color ->int -> bool = "ml_stringRGBA" external gfxPrimitivesSetFont : string -> int -> int -> unit = "ml_gfxPrimitivesSetFont" (* Rotozoom *) external rotozoomSurface : surface -> float -> float-> bool->surface="ml_rotozoomSurface" external rotozoomSurfaceXY : surface -> float -> float->float-> bool->surface="ml_rotozoomSurfaceXY" external zoomSurface : surface -> float -> float -> bool -> surface="ml_zoomSurface" ocamlsdl-0.9.1/src/sdlgl.ml0000664000076400007640000000113507640100322014255 0ustar olivolivexternal swap_buffers : unit -> unit = "ml_SDL_GL_SwapBuffers" type attr = | RED_SIZE of int | GREEN_SIZE of int | BLUE_SIZE of int | ALPHA_SIZE of int | BUFFER_SIZE of int | DOUBLEBUFFER of bool | DEPTH_SIZE of int | STENCIL_SIZE of int | ACCUM_RED_SIZE of int | ACCUM_GREEN_SIZE of int | ACCUM_BLUE_SIZE of int | ACCUM_ALPHA_SIZE of int | STEREO of int external set_attr : attr list -> unit = "ml_SDL_GL_SetAttribute" external get_attr : unit -> attr list = "ml_SDL_GL_GetAttribute" external to_raw : Sdlvideo.surface -> [`ubyte] Raw.t = "ml_SDL_GL_to_raw" ocamlsdl-0.9.1/src/sdljoystick.ml0000664000076400007640000000444507532005510015524 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdljoystick.ml,v 1.2 2002/08/24 22:40:08 oliv__a Exp $ *) (** Joystick handling *) exception SDLjoystick_exception of string let _ = Callback.register_exception "SDLjoystick_exception" (SDLjoystick_exception "") type t external num_joysticks : unit -> int = "ml_SDL_NumJoysticks" external name : int -> string = "ml_SDL_JoystickName" external open_joystick : int -> t = "ml_SDL_JoystickOpen" external opened : int -> bool = "ml_SDL_JoystickOpened" external index : t -> int = "ml_SDL_JoystickIndex" external num_axes : t -> int = "ml_SDL_JoystickNumAxes" external num_balls : t -> int = "ml_SDL_JoystickNumBalls" external num_hats : t -> int = "ml_SDL_JoystickNumHats" external num_buttons : t -> int = "ml_SDL_JoystickNumButtons" external update : t -> unit = "ml_SDL_JoystickUpdate" external set_event_state : bool -> unit = "ml_SDL_JoystickSetEventState" external get_event_state : unit -> bool = "ml_SDL_JoystickGetEventState" type hat_value = int let hat_centered = 0x00 let hat_up = 0x01 let hat_right = 0x02 let hat_down = 0x04 let hat_left = 0x08 let hat_rightup = 0x03 let hat_rightdown = 0x06 let hat_leftup = 0x09 let hat_leftdown = 0x0C external get_axis : t -> int -> int = "ml_SDL_JoystickGetAxis" external get_hat : t -> int -> hat_value = "ml_SDL_JoystickGetHat" external get_ball : t -> int -> int * int = "ml_SDL_JoystickGetBall" external get_button : t -> int -> bool = "ml_SDL_JoystickGetButton" external close : t -> unit = "ml_SDL_JoystickClose" ocamlsdl-0.9.1/src/sdlkey.ml0000664000076400007640000001416507555026021014462 0ustar olivolivtype t = | KEY_UNKNOWN | KEY_BACKSPACE | KEY_TAB | KEY_CLEAR | KEY_RETURN | KEY_PAUSE | KEY_ESCAPE | KEY_SPACE | KEY_EXCLAIM | KEY_QUOTEDBL | KEY_HASH | KEY_DOLLAR | KEY_AMPERSAND | KEY_QUOTE | KEY_LEFTPAREN | KEY_RIGHTPAREN | KEY_ASTERISK | KEY_PLUS | KEY_COMMA | KEY_MINUS | KEY_PERIOD | KEY_SLASH | KEY_0 | KEY_1 | KEY_2 | KEY_3 | KEY_4 | KEY_5 | KEY_6 | KEY_7 | KEY_8 | KEY_9 | KEY_COLON | KEY_SEMICOLON | KEY_LESS | KEY_EQUALS | KEY_GREATER | KEY_QUESTION | KEY_AT (* Skip uppercase letters *) | KEY_LEFTBRACKET | KEY_BACKSLASH | KEY_RIGHTBRACKET | KEY_CARET | KEY_UNDERSCORE | KEY_BACKQUOTE | KEY_a | KEY_b | KEY_c | KEY_d | KEY_e | KEY_f | KEY_g | KEY_h | KEY_i | KEY_j | KEY_k | KEY_l | KEY_m | KEY_n | KEY_o | KEY_p | KEY_q | KEY_r | KEY_s | KEY_t | KEY_u | KEY_v | KEY_w | KEY_x | KEY_y | KEY_z | KEY_DELETE (* End of ASCII mapped keysyms *) (* International keyboard syms *) | KEY_WORLD_0 | KEY_WORLD_1 | KEY_WORLD_2 | KEY_WORLD_3 | KEY_WORLD_4 | KEY_WORLD_5 | KEY_WORLD_6 | KEY_WORLD_7 | KEY_WORLD_8 | KEY_WORLD_9 | KEY_WORLD_10 | KEY_WORLD_11 | KEY_WORLD_12 | KEY_WORLD_13 | KEY_WORLD_14 | KEY_WORLD_15 | KEY_WORLD_16 | KEY_WORLD_17 | KEY_WORLD_18 | KEY_WORLD_19 | KEY_WORLD_20 | KEY_WORLD_21 | KEY_WORLD_22 | KEY_WORLD_23 | KEY_WORLD_24 | KEY_WORLD_25 | KEY_WORLD_26 | KEY_WORLD_27 | KEY_WORLD_28 | KEY_WORLD_29 | KEY_WORLD_30 | KEY_WORLD_31 | KEY_WORLD_32 | KEY_WORLD_33 | KEY_WORLD_34 | KEY_WORLD_35 | KEY_WORLD_36 | KEY_WORLD_37 | KEY_WORLD_38 | KEY_WORLD_39 | KEY_WORLD_40 | KEY_WORLD_41 | KEY_WORLD_42 | KEY_WORLD_43 | KEY_WORLD_44 | KEY_WORLD_45 | KEY_WORLD_46 | KEY_WORLD_47 | KEY_WORLD_48 | KEY_WORLD_49 | KEY_WORLD_50 | KEY_WORLD_51 | KEY_WORLD_52 | KEY_WORLD_53 | KEY_WORLD_54 | KEY_WORLD_55 | KEY_WORLD_56 | KEY_WORLD_57 | KEY_WORLD_58 | KEY_WORLD_59 | KEY_WORLD_60 | KEY_WORLD_61 | KEY_WORLD_62 | KEY_WORLD_63 | KEY_WORLD_64 | KEY_WORLD_65 | KEY_WORLD_66 | KEY_WORLD_67 | KEY_WORLD_68 | KEY_WORLD_69 | KEY_WORLD_70 | KEY_WORLD_71 | KEY_WORLD_72 | KEY_WORLD_73 | KEY_WORLD_74 | KEY_WORLD_75 | KEY_WORLD_76 | KEY_WORLD_77 | KEY_WORLD_78 | KEY_WORLD_79 | KEY_WORLD_80 | KEY_WORLD_81 | KEY_WORLD_82 | KEY_WORLD_83 | KEY_WORLD_84 | KEY_WORLD_85 | KEY_WORLD_86 | KEY_WORLD_87 | KEY_WORLD_88 | KEY_WORLD_89 | KEY_WORLD_90 | KEY_WORLD_91 | KEY_WORLD_92 | KEY_WORLD_93 | KEY_WORLD_94 | KEY_WORLD_95 (* Numeric keypad *) | KEY_KP0 | KEY_KP1 | KEY_KP2 | KEY_KP3 | KEY_KP4 | KEY_KP5 | KEY_KP6 | KEY_KP7 | KEY_KP8 | KEY_KP9 | KEY_KP_PERIOD | KEY_KP_DIVIDE | KEY_KP_MULTIPLY | KEY_KP_MINUS | KEY_KP_PLUS | KEY_KP_ENTER | KEY_KP_EQUALS (* Arrows + Home/End pad *) | KEY_UP | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_INSERT | KEY_HOME | KEY_END | KEY_PAGEUP | KEY_PAGEDOWN (* Function keys *) | KEY_F1 | KEY_F2 | KEY_F3 | KEY_F4 | KEY_F5 | KEY_F6 | KEY_F7 | KEY_F8 | KEY_F9 | KEY_F10 | KEY_F11 | KEY_F12 | KEY_F13 | KEY_F14 | KEY_F15 (* Key state modifier keys *) | KEY_NUMLOCK | KEY_CAPSLOCK | KEY_SCROLLOCK | KEY_RSHIFT | KEY_LSHIFT | KEY_RCTRL | KEY_LCTRL | KEY_RALT | KEY_LALT | KEY_RMETA | KEY_LMETA | KEY_LSUPER (* Left "Windows" key *) | KEY_RSUPER (* Right "Windows" key *) | KEY_MODE (* "Alt Gr" key *) | KEY_COMPOSE (* Multi-key compose key *) (* Miscellaneous function keys *) | KEY_HELP | KEY_PRINT | KEY_SYSREQ | KEY_BREAK | KEY_MENU | KEY_POWER (* Power Macintosh power key *) | KEY_EURO (* Some european keyboards *) | KEY_UNDO (* Atari keyboard has Undo *) let keycodes = [ (0, 0); (8, 9); (12, 13); (19, 19); (27, 27); (32, 36); (38, 64); (91, 122); (127, 127); (160, 296); (300, 322); ] let num_keys = (Obj.magic KEY_UNDO) + 1 let keycode_table = let table = Array.make num_keys 0 in let rec proc i = function | (a, b) :: l -> for j=0 to b-a do table.(i+j) <- a+j done ; proc (i + b-a+1) l | [] -> () in proc 0 keycodes ; Callback.register "keycode_table" table ; table let max_code = keycode_table.( num_keys-1 ) let int_of_key (key : t) = keycode_table.(Obj.magic key) let char_of_key key = let code = int_of_key key in if code < 256 then Char.chr code else invalid_arg "Sdlkey.char_of_key" let rev_keycode_table = let table = Array.make (max_code +1) (-1) in for i=0 to pred num_keys do table.( keycode_table.(i) ) <- i done ; Callback.register "rev_keycode_table" table ; table let key_of_int n = if n < 0 || n > max_code then invalid_arg "Sdlkey.key_of_int" ; let k = rev_keycode_table.(n) in if k < 0 then invalid_arg "Sdlkey.key_of_int" else (Obj.magic k : t) external _name : int -> string = "ml_SDL_GetKeyName" let name key = _name (int_of_key key) external enable_unicode : bool -> unit = "ml_SDL_EnableUNICODE" external query_unicode : unit -> bool = "ml_SDL_QueryUNICODE" external disable_key_repeat : unit -> unit = "ml_SDL_DisableKeyRepeat" external enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit = "ml_SDL_EnableKeyRepeat" open Bigarray external get_key_state : unit -> (int, int8_unsigned_elt, c_layout) Array1.t = "ml_SDL_GetKeyState" external _is_key_pressed : int -> bool = "ml_sdl_key_pressed" let is_key_pressed key = _is_key_pressed (int_of_key key) type mod_state = int let kmod_none = 0x0000 let kmod_lshift= 0x0001 let kmod_rshift= 0x0002 let kmod_lctrl = 0x0040 let kmod_rctrl = 0x0080 let kmod_lalt = 0x0100 let kmod_ralt = 0x0200 let kmod_lmeta = 0x0400 let kmod_rmeta = 0x0800 let kmod_num = 0x1000 let kmod_caps = 0x2000 let kmod_mode = 0x4000 let kmod_ctrl = 0x00C0 let kmod_shift = 0x0003 let kmod_alt = 0x0300 let kmod_meta = 0x0C00 external get_mod_state : unit -> mod_state = "ml_SDL_GetModState" external set_mod_state : mod_state -> unit = "ml_SDL_SetModState" let link_me = () ocamlsdl-0.9.1/src/sdlloader.ml0000664000076400007640000000267107626522621015145 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlloader.ml,v 1.8 2003/02/24 23:06:57 oliv__a Exp $ *) (* Define a new exception for loader errors and register it to be callable from C code. *) exception SDLloader_exception of string let _ = Callback.register_exception "SDLloader_exception" (SDLloader_exception "") external load_image : string -> Sdlvideo.surface = "ml_IMG_Load" external load_image_RW : ?autoclose:bool -> Sdl.rwops_in -> Sdlvideo.surface = "ml_IMG_Load_RW" let load_image_from_mem buff = load_image_RW (Sdl.rwops_from_mem buff) external read_XPM_from_array : string array -> Sdlvideo.surface = "ml_IMG_ReadXPMFromArray" ocamlsdl-0.9.1/src/sdlmixer.ml0000644000076400007640000001324311766411256015017 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlmixer.ml,v 1.14 2012/06/14 16:34:54 oliv__a Exp $ *) (* Define a new exception for loader errors and register it to be callable from C code. *) exception SDLmixer_exception of string let _ = Callback.register_exception "SDLmixer_exception" (SDLmixer_exception "") type format = | AUDIO_FORMAT_U8 | AUDIO_FORMAT_S8 | AUDIO_FORMAT_U16LSB | AUDIO_FORMAT_S16LSB | AUDIO_FORMAT_U16MSB | AUDIO_FORMAT_S16MSB | AUDIO_FORMAT_U16SYS | AUDIO_FORMAT_S16SYS type fade_status = | NO_FADING | FADING_OUT | FADING_IN type music_kind = | NONE | CMD | WAV | MOD | MID | OGG | MP3 type channels = MONO | STEREO type chunk type music type channel = int type group = int type specs = { frequency : int; format : format; channels : channels } external open_audio : ?freq:int -> ?format:format -> ?chunksize:int -> ?channels:channels -> unit -> unit = "sdlmixer_open_audio" external close_audio : unit -> unit = "sdlmixer_close_audio" external version : unit -> Sdl.version ="sdlmixer_version" external query_specs : unit -> specs = "sdlmixer_query_specs" (* Loading and freeing sounds *) external loadWAV : string -> chunk = "sdlmixer_loadWAV" external loadWAV_RW : ?autoclose:bool -> Sdl.rwops_in -> chunk = "sdlmixer_loadWAV_RW" let loadWAV_from_mem buff = loadWAV_RW (Sdl.rwops_from_mem buff) external load_string : string -> chunk = "sdlmixer_load_string" external load_string_raw : string -> chunk = "sdlmixer_load_string_raw" external load_music : string -> music = "sdlmixer_loadMUS" external music_type : music option -> music_kind = "sdlmixer_get_music_type" external set_music_cmd : string -> unit = "sdlmixer_set_music_cmd" external unset_music_cmd : unit -> unit = "sdlmixer_unset_music_cmd" external free_chunk : chunk -> unit = "sdlmixer_free_chunk" external free_music : music -> unit = "sdlmixer_free_music" (* Groups and channels *) let all_channels = -1 let default_group = -1 external allocate_channels : int -> int = "sdlmixer_allocate_channels" let num_channels () = allocate_channels ~-1 external reserve_channels : int -> int = "sdlmixer_reserve_channels" external group_channel : channel -> group -> unit = "sdlmixer_group_channel" external group_channels : from_c:channel -> to_c:channel -> group -> unit = "sdlmixer_group_channels" external group_available : group -> channel = "sdlmixer_group_available" external group_count : group -> int = "sdlmixer_group_count" external group_oldest : group -> channel = "sdlmixer_group_oldest" external group_newer : group -> channel = "sdlmixer_group_newer" (* Playing *) external play_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> unit = "sdlmixer_play_channel_timed" external play_music : ?loops:int -> music -> unit = "sdlmixer_play_music" external fadein_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> float -> unit = "sdlmixer_fadein_channel" external fadein_music : ?loops:int -> music -> float -> unit = "sdlmixer_fadein_music" let play_sound chunk = ignore (play_channel chunk) (* Volume control *) external volume_channel : channel -> float = "sdlmixer_volume_channel" external volume_chunk : chunk -> float = "sdlmixer_volume_chunk" external volume_music : unit -> float = "sdlmixer_volume_music" external setvolume_channel : channel -> float -> unit = "sdlmixer_setvolume_channel" external setvolume_chunk : chunk -> float -> unit = "sdlmixer_setvolume_chunk" external setvolume_music : float -> unit = "sdlmixer_setvolume_music" (* Stopping playing *) external halt_channel : channel -> unit = "sdlmixer_halt_channel" external halt_group : group -> unit = "sdlmixer_halt_group" external halt_music : unit -> unit = "sdlmixer_halt_music" external expire_channel : channel -> float option -> unit = "sdlmixer_expire_channel" external fadeout_channel : channel -> float -> unit = "sdlmixer_fadeout_channel" external fadeout_group : group -> float -> unit = "sdlmixer_fadeout_group" external fadeout_music : float -> unit = "sdlmixer_fadeout_music" external fading_music : unit -> fade_status = "sdlmixer_fading_music" external fading_channel : channel -> fade_status = "sdlmixer_fading_channel" (* Pausing / resuming *) external pause_channel : channel -> unit = "sdlmixer_pause_channel" external pause_music : unit -> unit = "sdlmixer_pause_music" external resume_channel : channel -> unit = "sdlmixer_resume_channel" external resume_music : unit -> unit = "sdlmixer_resume_music" external rewind_music : unit -> unit = "sdlmixer_rewind_music" external num_paused_channel : unit -> int = "sdlmixer_numpaused_channel" external paused_channel : channel -> bool = "sdlmixer_paused_channel" external paused_music : unit -> bool = "sdlmixer_paused_music" external num_playing_channel : unit -> int = "sdlmixer_numplaying" external playing_channel : channel -> bool = "sdlmixer_playing" external playing_music : unit -> bool = "sdlmixer_playing_music" ocamlsdl-0.9.1/src/sdl.ml0000664000076400007640000000500107626521315013743 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdl.ml,v 1.8 2003/02/24 22:55:09 oliv__a Exp $ *) (* Define a new exception for Sdl initialization errors and register it to be callable from C code. *) exception SDL_init_exception of string let _ = Callback.register_exception "SDL_init_exception" (SDL_init_exception "Any string") (* Native C external functions *) (* Initialization. *) type subsystem = [ | `TIMER (** init flag for the timer subsystem *) | `AUDIO (** init flag for the audio subsystem *) | `VIDEO (** init flag for the video subsystem *) | `CDROM (** init flag for the cdrom subsystem *) | `JOYSTICK (** init flag for the joystick subsystem *) ] external init : ?auto_clean:bool -> [< subsystem | `NOPARACHUTE | `EVENTTHREAD | `EVERYTHING ] list -> unit = "sdl_init" external init_subsystem : subsystem list -> unit = "sdl_init_subsystem" external was_init : unit -> subsystem list = "sdl_was_init" external quit : unit -> unit = "sdl_quit" external quit_subsystem : subsystem list -> unit = "sdl_quit_subsystem" type version = { major : int ; minor : int ; patch : int ; } external version : unit -> version = "sdl_version" let string_of_version v = String.concat "." (List.map string_of_int [ v.major; v.minor; v.patch ]) let getenv = Sys.getenv external putenv : string -> string -> unit = "sdl_putenv" (**/**) type rwops_in external _rwops_from_mem : string -> rwops_in = "mlsdl_rw_from_mem" external _rwops_in_finalise : rwops_in -> unit = "mlsdl_rwops_finalise" let rwops_from_mem buff = let rw = _rwops_from_mem buff in Gc.finalise _rwops_in_finalise rw ; rw external rwops_in_close : rwops_in -> unit = "mlsdl_rwops_close" ocamlsdl-0.9.1/src/sdlmouse.ml0000664000076400007640000000440511550346740015021 0ustar olivolivopen Bigarray type button = | BUTTON_LEFT | BUTTON_MIDDLE | BUTTON_RIGHT | BUTTON_WHEELUP | BUTTON_WHEELDOWN | BUTTON_X of int external get_state : ?relative:bool -> unit -> int * int * button list = "mlsdlevent_get_mouse_state" external warp : int -> int -> unit = "ml_SDL_WarpMouse" type cursor type cursor_data = { data : (int, int8_unsigned_elt, c_layout) Array2.t ; mask : (int, int8_unsigned_elt, c_layout) Array2.t ; w : int ; h : int ; hot_x : int ; hot_y : int ; } external make_cursor : data:(int, int8_unsigned_elt, c_layout) Array2.t -> mask:(int, int8_unsigned_elt, c_layout) Array2.t -> hot_x:int -> hot_y:int -> cursor = "ml_SDL_CreateCursor" external free_cursor : cursor -> unit = "ml_SDL_FreeCursor" external set_cursor : cursor -> unit = "ml_SDL_SetCursor" external cursor_visible : unit -> bool = "ml_SDL_ShowCursor_query" external show_cursor : bool -> unit = "ml_SDL_ShowCursor" external get_cursor : unit -> cursor = "ml_SDL_GetCursor" external cursor_data : cursor -> cursor_data = "ml_SDL_Cursor_data" let string_of_bits x = let s = String.make 8 ' ' in for i=0 to 7 do if x land (1 lsl i) <> 0 then s.[7-i] <- '@' done ; s let pprint_cursor c = let { data = data ; mask = mask } = cursor_data c in let h = Array2.dim1 data in let w = Array2.dim2 data in print_endline "data :" ; for i=0 to pred h do for j=0 to pred w do print_string (string_of_bits data.{i, j}) done ; print_newline () done ; print_newline () ; print_endline "mask :" ; for i=0 to pred h do for j=0 to pred w do print_string (string_of_bits mask.{i, j}) done ; print_newline () done let convert_to_cursor ~data ~mask ~w ~h ~hot_x ~hot_y = if Array.length data <> Array.length mask || w mod 8 <> 0 || Array.length data <> h * w / 8 then invalid_arg "Sdlmouse.convert_to_cursor" ; let w' = w / 8 in let b_data = Array2.create int8_unsigned c_layout h w' in let b_mask = Array2.create int8_unsigned c_layout h w' in for i=0 to pred h do for j=0 to pred w' do b_data.{i, j} <- data.( w' * i + j) ; b_mask.{i, j} <- mask.( w' * i + j) done done ; make_cursor ~data:b_data ~mask:b_mask ~hot_x ~hot_y ocamlsdl-0.9.1/src/sdltimer.ml0000664000076400007640000000202710225746077015014 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdltimer.ml,v 1.5 2005/04/09 12:36:15 oliv__a Exp $ *) (* Native C external functions *) external delay : int -> unit = "sdltimer_delay" external get_ticks : unit -> int = "sdltimer_get_ticks" "noalloc" ocamlsdl-0.9.1/src/sdlttf.ml0000664000076400007640000000731510504215071014457 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlttf.ml,v 1.13 2006/09/20 10:38:49 jboulnois Exp $ *) (* Define a new exception for TTF errors and register it to be callable from C code. *) exception SDLttf_exception of string let _ = Callback.register_exception "SDLttf_exception" (SDLttf_exception "") (* Types *) type font external init : unit -> unit = "sdlttf_init" external quit : unit -> unit = "sdlttf_kill" (* Native C external functions *) external open_font : string -> ?index:int -> int -> font = "sdlttf_open_font" type font_style = | NORMAL | BOLD | ITALIC | UNDERLINE external get_font_style : font -> font_style list = "sdlttf_get_font_style" external set_font_style : font -> font_style list -> unit = "sdlttf_set_font_style" external font_height : font -> int = "sdlttf_font_height" external font_ascent : font -> int = "sdlttf_font_ascent" external font_descent : font -> int = "sdlttf_font_descent" external font_lineskip : font -> int = "ml_TTF_FontLineSkip" external font_faces : font -> int = "ml_TTF_FontFaces" external is_fixed_width : font -> bool = "ml_TTF_FontFaceIsFixedWidth" external family_name : font -> string = "ml_TTF_FontFaceFamilyName" external style_name : font -> string = "ml_TTF_FontFaceStyleName" external size_text : font -> string -> int * int = "sdlttf_size_text" (* UTF8 *) external size_utf8 : font -> string -> int * int = "sdlttf_size_utf8" open Sdlvideo external render_text_solid : font -> string -> fg:color -> surface = "sdlttf_render_text_solid" external render_text_shaded : font -> string -> fg:color -> bg:color -> surface = "sdlttf_render_text_shaded" external render_text_blended : font -> string -> fg:color -> surface = "sdlttf_render_text_blended" (* UTF8 *) external render_utf8_solid : font -> string -> fg:color -> surface = "sdlttf_render_utf8_solid" external render_utf8_shaded : font -> string -> fg:color -> bg:color -> surface = "sdlttf_render_utf8_shaded" external render_utf8_blended : font -> string -> fg:color -> surface = "sdlttf_render_utf8_blended" type render_kind = | SOLID of color | SHADED of color * color | BLENDED of color let render_text font kind txt = match kind with | SOLID fg -> render_text_solid font txt ~fg | SHADED (fg, bg) -> render_text_shaded font txt ~fg ~bg | BLENDED fg -> render_text_blended font txt ~fg external render_glyph_solid : font -> char -> fg:color -> surface = "sdlttf_render_glyph_solid" external render_glyph_shaded : font -> char -> fg:color -> bg:color -> surface = "sdlttf_render_glyph_shaded" external render_glyph_blended : font -> char -> fg:color -> surface = "sdlttf_render_glyph_blended" let render_glyph font kind c = match kind with | SOLID fg -> render_glyph_solid font c ~fg | SHADED (fg, bg) -> render_glyph_shaded font c ~fg ~bg | BLENDED fg -> render_glyph_blended font c ~fg external glyph_metrics : font -> char -> int * int * int * int = "sdlttf_glyph_metrics" ocamlsdl-0.9.1/src/sdlvideo.ml0000664000076400007640000002121011550346636014774 0ustar olivoliv open Bigarray exception Video_exn of string let _ = Callback.register_exception "SDLvideo2_exception" (Video_exn "") type rect = { mutable r_x : int ; mutable r_y : int ; mutable r_w : int ; mutable r_h : int ; } (** (x, y, w, h) *) let rect ~x ~y ~w ~h = { r_x = x ; r_y = y ; r_w = w ; r_h = h } let copy_rect r = { r with r_x = r.r_x } type pixel_format_info = { palette : bool ; bits_pp : int ; bytes_pp : int ; rmask : int32 ; gmask : int32 ; bmask : int32 ; amask : int32 ; rshift : int ; gshift : int ; bshift : int ; ashift : int ; rloss : int ; gloss : int ; bloss : int ; aloss : int ; colorkey : int32 ; alpha : int ; } type video_info = { hw_available : bool; (** Hardware surfaces? *) wm_available : bool; (** Window manager present? *) blit_hw : bool; (** Accelerated blits HW -> HW *) blit_hw_color_key : bool; (** Accelerated blits with color key *) blit_hw_alpha : bool; (** Accelerated blits with alpha *) blit_sw : bool; (** Accelerated blits SW -> HW *) blit_sw_color_key : bool; (** Accelerated blits with color key *) blit_sw_alpha : bool; (** Accelerated blits with alpha *) blit_fill : bool; (** Accelerated color fill *) video_mem : int; (** Total amount of video memory (Ko) *) } type video_flag = [ | `SWSURFACE (* Surface is in system memory *) | `HWSURFACE (* Surface is in video memory *) | `ASYNCBLIT (* Enables the use of asynchronous to the display surface *) | `ANYFORMAT (* Allow any video pixel format *) | `HWPALETTE (* Give SDL exclusive palette access *) | `DOUBLEBUF (* Set up double-buffered video mode *) | `FULLSCREEN (* Surface is a full screen display *) | `OPENGL (* OpenGL rendering *) | `OPENGLBLIT | `RESIZABLE (* Create a resizable window *) | `NOFRAME (* Frame without titlebar *) ] external get_video_info : unit -> video_info = "ml_SDL_GetVideoInfo" external get_video_info_format : unit -> pixel_format_info = "ml_SDL_GetVideoInfo_format" external driver_name : unit -> string = "ml_SDL_VideoDriverName" type modes = | NOMODE | ANY | DIM of (int * int) list external list_modes : ?bpp:int -> video_flag list -> modes = "ml_SDL_ListModes" external video_mode_ok : w:int -> h:int -> bpp:int -> video_flag list -> int = "ml_SDL_VideoModeOK" (** Check to see if a particular video mode is supported. *) type surface_flags = [ | video_flag | `HWACCEL | `SRCCOLORKEY (** Blit uses a source color key *) | `RLEACCEL | `SRCALPHA (** Blit uses source alpha blending *) | `PREALLOC ] type surface type surface_info = { flags : surface_flags list ; w : int ; h : int ; pitch : int ; clip_rect : rect ; refcount : int ; } external surface_info : surface -> surface_info = "ml_sdl_surface_info" let surface_dims s = let { w = w; h = h; pitch = pitch } = surface_info s in (w, h, pitch) external surface_format : surface -> pixel_format_info = "ml_sdl_surface_info_format" let surface_flags s = (surface_info s).flags let surface_bpp s = (surface_format s).bits_pp type color = int * int * int (** (r, g, b) *) let black:color = (0, 0, 0) let white:color = (255, 255, 255) let red:color = (255, 0, 0) let green:color = (0, 255, 0) let blue:color = (0, 0, 255) let yellow:color = (255, 255, 0) let cyan:color = (0, 255, 255) let magenta:color = (255, 0, 255) external use_palette : surface -> bool = "ml_sdl_surface_use_palette" external palette_ncolors : surface -> int = "ml_sdl_palette_ncolors" external get_palette_color : surface -> int -> color = "ml_sdl_palette_get_color" type palette_flag = | LOGPAL | PHYSPAL | LOGPHYSPAL external set_palette : surface -> ?flag:palette_flag -> ?firstcolor:int -> color array -> unit = "ml_SDL_SetPalette" external get_video_surface : unit -> surface = "ml_SDL_GetVideoSurface" external set_video_mode : w:int -> h:int -> ?bpp:int -> video_flag list -> surface = "ml_SDL_SetVideoMode" external update_rect : ?rect:rect -> surface -> unit = "ml_SDL_UpdateRect" external update_rects : rect list -> surface -> unit = "ml_SDL_UpdateRects" external flip : surface -> unit = "ml_SDL_Flip" external set_gamma : r:float -> g:float -> b:float -> unit = "ml_SDL_SetGamma" external map_RGB : surface -> ?alpha:int -> color -> int32 = "ml_SDL_MapRGB" external get_RGB : surface -> int32 -> color = "ml_SDL_GetRGB" external get_RGBA : surface -> int32 -> color * int = "ml_SDL_GetRGBA" external create_RGB_surface : [ `SWSURFACE | `HWSURFACE | `ASYNCBLIT | `SRCCOLORKEY | `SRCALPHA ] list -> w:int -> h:int -> bpp:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface = "ml_SDL_CreateRGBSurface_bc" "ml_SDL_CreateRGBSurface" external create_RGB_surface_format : surface -> [ `SWSURFACE | `HWSURFACE | `ASYNCBLIT | `SRCCOLORKEY | `SRCALPHA ] list -> w:int -> h:int -> surface = "ml_SDL_CreateRGBSurface_format" external _create_RGB_surface_from : ('a, 'b, c_layout) Array1.t -> w:int -> h:int -> bpp:int -> pitch:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface = "ml_SDL_CreateRGBSurfaceFrom_bc" "ml_SDL_CreateRGBSurfaceFrom" let create_RGB_surface_from_32 = _create_RGB_surface_from ~bpp:32 let create_RGB_surface_from_24 a ~w ~h ~pitch ~rmask ~gmask ~bmask ~amask = _create_RGB_surface_from a ~w ~h ~pitch ~bpp:24 ~rmask:(Int32.of_int rmask) ~gmask:(Int32.of_int gmask) ~bmask:(Int32.of_int bmask) ~amask:(Int32.of_int amask) let create_RGB_surface_from_16 a ~w ~h ~pitch ~rmask ~gmask ~bmask ~amask = _create_RGB_surface_from a ~w ~h ~pitch ~bpp:16 ~rmask:(Int32.of_int rmask) ~gmask:(Int32.of_int gmask) ~bmask:(Int32.of_int bmask) ~amask:(Int32.of_int amask) let create_RGB_surface_from_8 a ~w ~h ~pitch ~rmask ~gmask ~bmask ~amask = _create_RGB_surface_from a ~w ~h ~pitch ~bpp:8 ~rmask:(Int32.of_int rmask) ~gmask:(Int32.of_int gmask) ~bmask:(Int32.of_int bmask) ~amask:(Int32.of_int amask) external must_lock : surface -> bool = "ml_SDL_MustLock" "noalloc" external lock : surface -> unit = "ml_SDL_LockSurface" external unlock : surface -> unit = "ml_SDL_UnlockSurface" "noalloc" external load_BMP : string -> surface = "ml_SDL_LoadBMP" external load_BMP_RW : ?autoclose:bool -> Sdl.rwops_in -> surface = "ml_SDL_LoadBMP_RW" let load_BMP_from_mem buff = load_BMP_RW (Sdl.rwops_from_mem buff) external save_BMP : surface -> string -> unit = "ml_SDL_SaveBMP" external unset_color_key : surface -> unit = "ml_SDL_unset_color_key" external set_color_key : surface -> ?rle:bool -> int32 -> unit = "ml_SDL_SetColorKey" external get_color_key : surface -> int32 = "ml_SDL_get_color_key" external unset_alpha : surface -> unit = "ml_SDL_unset_alpha" external set_alpha : surface -> ?rle:bool -> int -> unit = "ml_SDL_SetAlpha" external get_alpha : surface -> int = "ml_SDL_get_alpha" external unset_clip_rect : surface -> unit = "ml_SDL_UnsetClipRect" external set_clip_rect : surface -> rect -> unit = "ml_SDL_SetClipRect" external get_clip_rect : surface -> rect = "ml_SDL_GetClipRect" external blit_surface : src:surface -> ?src_rect:rect -> dst:surface -> ?dst_rect:rect -> unit -> unit = "ml_SDL_BlitSurface" external fill_rect : ?rect:rect -> surface -> int32 -> unit = "ml_SDL_FillRect" external display_format : ?alpha:bool -> surface -> surface = "ml_SDL_DisplayFormat" external __pixel_data : surface -> int -> ('a, 'b, c_layout) Array1.t = "ml_bigarray_pixels" let _pixel_data_final s ba = (* nothing to do, but this ensures that s is kept alive until ba is collected) *) () let _pixel_data surf bpp = let ba = __pixel_data surf bpp in Gc.finalise (_pixel_data_final surf) ba ; ba let pixel_data s = (_pixel_data s 0 : (int, int8_unsigned_elt, c_layout) Array1.t) let pixel_data_8 s = (_pixel_data s 1 : (int, int8_unsigned_elt, c_layout) Array1.t) let pixel_data_16 s = (_pixel_data s 2 : (int, int16_unsigned_elt, c_layout) Array1.t) let pixel_data_24 s = (_pixel_data s 3 : (int, int8_unsigned_elt, c_layout) Array1.t) let pixel_data_32 s = (_pixel_data s 4 : (int32, int32_elt, c_layout) Array1.t) external get_pixel : surface -> x:int -> y:int -> int32 = "ml_SDL_get_pixel" external put_pixel : surface -> x:int -> y:int -> int32 -> unit = "ml_SDL_put_pixel" external get_pixel_color : surface -> x:int -> y:int -> color = "ml_SDL_get_pixel_color" external put_pixel_color : surface -> x:int -> y:int -> color -> unit = "ml_SDL_put_pixel_color" ocamlsdl-0.9.1/src/sdlwm.ml0000664000076400007640000000077607562320106014317 0ustar olivoliv external set_caption : title:string -> icon:string -> unit = "ml_SDL_WM_SetCaption" external get_caption : unit -> string * string = "ml_SDL_WM_GetCaption" external set_icon : Sdlvideo.surface -> unit = "ml_SDL_WM_SetIcon" external iconify : unit -> bool = "ml_SDL_WM_IconifyWindow" external toggle_fullscreen : unit -> bool = "ml_SDL_WM_ToggleFullScreen" external grab_input : bool -> unit = "ml_SDL_WM_GrabInput" external query_grab : unit -> bool = "ml_SDL_WM_GetGrabInput" ocamlsdl-0.9.1/src/sdlcdrom.mli0000644000076400007640000000703311770141413015136 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlcdrom.mli,v 1.12 2012/06/19 18:20:59 oliv__a Exp $ *) (** This module provides CD-ROM handling *) exception SDLcdrom_exception of string (** Exception used to report errors *) exception Trayempty (** Exception to report that thre's no cd in the drive *) (** {3 Types} *) type cdrom_drive (** abstract type for handling cdrom *) type cdrom_drive_status = | CD_TRAYEMPTY (** cdrom drive is empty *) | CD_STOPPED (** cdrom drive is stopped *) | CD_PLAYING (** cdrom drive is playing *) | CD_PAUSED (** cdrom drive is paused *) (** enumeration of different status cdrom drive *) type track_type = | TRACK_AUDIO (** audio track type *) | TRACK_DATA (** data track type *) (** the types of CD-ROM track possible *) type track = { id : int ; kind : track_type ; length : int ; offset : int ; } type cdrom_info = { num_tracks : int ; curr_track : int ; curr_frame : int ; tracks : track array ; } (** {3 General API} *) (** An SDLcdrom_exception is raised on errors *) val get_num_drives : unit -> int (** [get_num_drives] returns the number of CD-ROM drives on the system *) val drive_name : int -> string (** [drive_name drive] 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 [get_num_drives()-1].*) (** {3 CD-ROM drive handling} *) val cd_open : int -> cdrom_drive (** [cd_open drive] open a CD-ROM drive for access *) val cd_close : cdrom_drive -> unit (** Closes the handle for the cdrom_drive *) val cd_status : cdrom_drive -> cdrom_drive_status (** @return the current status of the given drive. *) val cd_info : cdrom_drive -> cdrom_info (** @return the table of contents of the CD and current play position @raise Trayempty if there's no cd in the drive *) (** {3 Playing audio tracks } *) val msf_of_frames : int -> int * int * int val frames_of_msf : int * int * int -> int val cd_play_tracks : cdrom_drive -> start_track:int -> start_frame:int -> num_tracks:int -> num_frames:int -> unit (** [cd_play_tracks cdrom_drive start_track start_frame num_tracks num_frames] play the given CD with these parameters @param start_track the starting track @param start_frame the starting frame @param num_tracks the number of tracks to play @param num_frames the number of frames to play @raise Trayempty if there's no cd in the drive *) val cd_play_track : cdrom_drive -> track -> unit (** Play the track n on the given cdrom_drive *) val cd_pause : cdrom_drive -> unit (** Pause play *) val cd_resume : cdrom_drive -> unit (** Resume play *) val cd_stop : cdrom_drive -> unit (** Stop play *) val cd_eject : cdrom_drive -> unit (** Eject CD-ROM *) ocamlsdl-0.9.1/src/sdlevent.mli0000644000076400007640000002360111770141413015152 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlevent.mli,v 1.16 2012/06/19 18:20:59 oliv__a Exp $ *) (** SDL event handling *) exception Event_exn of string (** The exception used for reporting events-related errors. *) (** {3 Application focus} *) (** The available application states *) type active_state = | MOUSEFOCUS (** The app has mouse coverage *) | INPUTFOCUS (** The app has input focus *) | APPACTIVE (** The application is active *) (** This function returns the current state of the application. If ACTIVE is set, then the user is able to see your application, otherwise it has been iconified or disabled. *) val get_app_state : unit -> active_state list (** {3 Events datatypes} *) (** Application visibility event record *) type active_event = { gain : bool ; (** Whether given states were gained or lost *) ae_state : active_state list ; (** A list of the focus states *) } type switch_state = | RELEASED | PRESSED (** Keyboard event record *) type keyboard_event = { ke_which : int ; (** The keyboard device index *) ke_state : switch_state ; (** PRESSED or RELEASED *) keysym : Sdlkey.t ; (** SDL virtual keysym *) keymod : Sdlkey.mod_state ; (** current key modifiers *) keycode : char ; (** translated character *) unicode : int ; } (** Mouse motion event record *) type mousemotion_event = { mme_which : int ; (** The mouse device index *) mme_state : Sdlmouse.button list ; (** The current button state *) mme_x : int ; (** The X/Y coordinates of the mouse *) mme_y : int ; mme_xrel : int ; (** The relative motion in the X direction *) mme_yrel : int ; (** The relative motion in the Y direction *) } (** Mouse button event record *) type mousebutton_event = { mbe_which : int ; (** The mouse device index *) mbe_button : Sdlmouse.button ; (** The mouse button index *) mbe_state : switch_state ; (** PRESSED or RELEASED *) mbe_x : int ; (** The X/Y coordinates of the mouse at press time *) mbe_y : int ; } (** Joystick axis motion event record *) type joyaxis_event = { jae_which : int ; (** The joystick device index *) jae_axis : int ; (** The joystick axis index *) jae_value : int ; (** The axis value (range: -32768 to 32767) *) } (** Joystick axis motion event record *) type joyball_event = { jle_which : int ; (** The joystick device index *) jle_ball : int ; (** The joystick trackball index *) jle_xrel : int ; (** The relative motion in the X direction *) jle_yrel : int ; (** The relative motion in the Y direction *) } (** Joystick hat position change event record *) type joyhat_event = { jhe_which : int ; (** The joystick device index *) jhe_hat : int ; (** The joystick hat index *) jhe_value : int ; (** The hat position value: {v 8 1 2 7 0 3 6 5 4 v} Note that zero means the POV is centered. *) } (** Joystick button event record *) type joybutton_event = { jbe_which : int ; (** The joystick device index *) jbe_button : int ; (** The joystick button index *) jbe_state : switch_state ; (** PRESSED or RELEASED *) } (** The main event type *) type event = | ACTIVE of active_event (** Application loses/gains visibility *) | KEYDOWN of keyboard_event (** Keys pressed *) | KEYUP of keyboard_event (** Keys released *) | MOUSEMOTION of mousemotion_event (** Mouse moved *) | MOUSEBUTTONDOWN of mousebutton_event (** Mouse button pressed *) | MOUSEBUTTONUP of mousebutton_event (** Mouse button released *) | JOYAXISMOTION of joyaxis_event (** Joystick axis motion *) | JOYBALLMOTION of joyball_event (** Joystick trackball motion *) | JOYHATMOTION of joyhat_event (** Joystick hat position change *) | JOYBUTTONDOWN of joybutton_event (** Joystick button pressed *) | JOYBUTTONUP of joybutton_event (** Joystick button released *) | QUIT (** User-requested quit *) | SYSWM (** System specific event *) | VIDEORESIZE of int * int (** User resized video mode *) | VIDEOEXPOSE (** Screen needs to be redrawn *) | USER of int (** for your use ! *) val string_of_event : event -> string (** Returns a short string descriptive of the event type, for debugging *) (** {3 Event masks } *) type event_mask = int (** Event masks values are ints and should be manipulated with [lor], [land], etc. *) val active_mask : event_mask val keydown_mask : event_mask val keyup_mask : event_mask val mousemotion_mask : event_mask val mousebuttondown_mask : event_mask val mousebuttonup_mask : event_mask val joyaxismotion_mask : event_mask val joyballmotion_mask : event_mask val joyhatmotion_mask : event_mask val joybuttondown_mask : event_mask val joybuttonup_mask : event_mask val quit_mask : event_mask val syswmevent_mask : event_mask val videoresize_mask : event_mask val videoexpose_mask : event_mask val userevent_mask : event_mask val keyboard_event_mask : event_mask val mouse_event_mask : event_mask val joystick_event_mask : event_mask val all_events_mask : event_mask type event_kind = | ACTIVE_EVENT | KEYDOWN_EVENT | KEYUP_EVENT | MOUSEMOTION_EVENT | MOUSEBUTTONDOWN_EVENT | MOUSEBUTTONUP_EVENT | JOYAXISMOTION_EVENT | JOYBALL_EVENT | JOYHAT_EVENT | JOYBUTTONDOWN_EVENT | JOYBUTTONUP_EVENT | QUIT_EVENT | SYSWM_EVENT | RESIZE_EVENT | EXPOSE_EVENT | USER_EVENT val make_mask : event_kind list -> event_mask val of_mask : event_mask -> event_kind list (** {3 Enabling/Disabling event collecting} *) val enable_events : event_mask -> unit (** Specified events are collected and added to the event queue (when [pump] is called). *) val disable_events : event_mask -> unit (** Specified events are not collected and won't appear in the event queue. *) val get_enabled_events : unit -> event_mask (** The mask of currently reported events. *) val get_state : event_kind -> bool (** Query the reporting state of an event type. *) val set_state : bool -> event_kind -> unit (** Set the reporting state of one individual event type. *) (** {3 Handling events} *) val pump : unit -> unit (** 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. *) val wait_event : unit -> event (** Wait indefinitely for the next available event and return it. *) val wait : unit -> unit (** Wait indefinitely for the next available event but leave it in the queue. *) val poll : unit -> event option (** Poll for currently pending events and return one if available. *) val has_event : unit -> bool (** Poll for currently pending events and return [false] if the queue is empty. *) val peek : ?mask:event_mask -> int -> event list (** Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will not be removed from the queue. *) val get : ?mask:event_mask -> int -> event list (** Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will be removed from the queue. *) val add : event list -> unit (** Add events to the back of the event queue. *) (** {3 Old event-handling interface } *) (** Callback-based event handling. @deprecated this interface was used in version of ocamlsdl < 0.6 *) module Old : sig (** {4 Definition of the event callbacks} *) (** Keyboard event called with the activated key, its state and the coordinates of the mouse pointer *) type keyboard_event_func = Sdlkey.t -> switch_state -> int -> int -> unit (** Mouse button event called with the activated button, its state and the coordinates of the mouse pointer *) type mouse_event_func = Sdlmouse.button -> switch_state -> int -> int -> unit (** Mouse motion event called with the coordinates of the mouse pointer *) type mousemotion_event_func = int -> int -> unit type idle_event_func = unit -> unit type resize_event_func = int -> int -> unit (** {4 Functions for setting the current event callbacks} *) val set_keyboard_event_func : keyboard_event_func -> unit val set_mouse_event_func : mouse_event_func -> unit val set_mousemotion_event_func : mousemotion_event_func -> unit val set_idle_event_func : idle_event_func -> unit val set_resize_event_func : resize_event_func -> unit (** {4 Event loop} *) val start_event_loop : unit -> unit val exit_event_loop : unit -> unit end (**/**) val link_me : unit ocamlsdl-0.9.1/src/sdlgfx.mli0000664000076400007640000000535311363126035014624 0ustar olivolivopen Sdlvideo (* Primitives *) (* pixel *) external pixelColor : surface -> int -> int -> int32 -> bool = "ml_pixelColor" external pixelRGBA : surface -> int -> int -> color -> int -> bool = "ml_pixelRGBA" (* rectangle *) external rectangleColor : surface -> rect -> rect -> int32 -> bool = "ml_rectangleColor" external rectangleRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_rectangleRGBA" external boxColor : surface -> rect -> rect -> int32 -> bool = "ml_boxColor" external boxRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_boxRGBA" (* line *) external lineColor : surface -> rect -> rect -> int32 -> bool = "ml_lineColor" external lineRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_lineRGBA" external aalineColor : surface -> rect -> rect -> int32 -> bool = "ml_aalineColor" external aalineRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_aalineRGBA" (* circle *) external circleColor : surface -> rect -> int -> int32 -> bool = "ml_circleColor" external circleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_circleRGBA" external aacircleColor : surface -> rect -> int -> int32 -> bool = "ml_aacircleColor" external aacircleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_aacircleRGBA" external filledCircleColor : surface -> rect -> int -> int32 -> bool = "ml_filledCircleColor" external filledCircleRGBA : surface -> rect -> int -> color -> int -> bool = "ml_filledCircleRGBA" (* ellipse *) external ellipseColor : surface -> rect -> rect -> int32 -> bool = "ml_ellipseColor" external ellipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_ellipseRGBA" external aaellipseColor : surface -> rect -> rect -> int32 -> bool = "ml_aaellipseColor" external aaellipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_aaellipseRGBA" external filledEllipseColor : surface -> rect -> rect -> int32 -> bool = "ml_filledEllipseColor" external filledEllipseRGBA : surface -> rect -> rect -> color -> int -> bool = "ml_filledEllipseRGBA" (* text *) external characterColor : surface -> rect -> char -> int32 -> bool = "ml_characterColor" external characterRGBA : surface -> rect -> char -> color ->int -> bool = "ml_characterRGBA" external stringColor : surface -> rect -> string -> int32 -> bool = "ml_stringColor" external stringRGBA : surface -> rect -> string -> color ->int -> bool = "ml_stringRGBA" external gfxPrimitivesSetFont : string -> int -> int -> unit = "ml_gfxPrimitivesSetFont" (* Rotozoom *) external rotozoomSurface : surface -> float -> float-> bool->surface="ml_rotozoomSurface" external rotozoomSurfaceXY : surface -> float -> float->float-> bool->surface="ml_rotozoomSurfaceXY" external zoomSurface : surface -> float -> float -> bool -> surface="ml_zoomSurface" ocamlsdl-0.9.1/src/sdlgl.mli0000664000076400007640000000117107640100322014426 0ustar olivoliv (** LablGL interaction *) external swap_buffers : unit -> unit = "ml_SDL_GL_SwapBuffers" type attr = | RED_SIZE of int | GREEN_SIZE of int | BLUE_SIZE of int | ALPHA_SIZE of int | BUFFER_SIZE of int | DOUBLEBUFFER of bool | DEPTH_SIZE of int | STENCIL_SIZE of int | ACCUM_RED_SIZE of int | ACCUM_GREEN_SIZE of int | ACCUM_BLUE_SIZE of int | ACCUM_ALPHA_SIZE of int | STEREO of int external set_attr : attr list -> unit = "ml_SDL_GL_SetAttribute" external get_attr : unit -> attr list = "ml_SDL_GL_GetAttribute" external to_raw : Sdlvideo.surface -> [`ubyte] Raw.t = "ml_SDL_GL_to_raw" ocamlsdl-0.9.1/src/sdljoystick.mli0000644000076400007640000000651411770141413015674 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdljoystick.mli,v 1.4 2012/06/19 18:20:59 oliv__a Exp $ *) (** Module for SDL joystick event handling *) (** In order to use these functions, {! Sdl.init} must have been called with the `JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers. *) exception SDLjoystick_exception of string (** exception for error reporting *) (** The joystick abstract type used to identify an SDL joystick *) type t (** Count the number of joysticks attached to the system *) val num_joysticks : unit -> int (** Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. *) val name : int -> string (** 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. @raise SDLjoystick_exception if an error occurred *) val open_joystick : int -> t (** @return [true] if joystick has been opened *) val opened : int -> bool (** Get the device index of an opened joystick *) val index : t -> int (** Get the number of general axis controls on a joystick *) val num_axes : t -> int (** Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled. *) val num_balls : t -> int (** Get the number of POV hats on a joystick *) val num_hats : t -> int (** Get the number of buttons on a joystick *) val num_buttons : t -> int (** {3 Joystick state } *) (** Update the current state of the open joysticks. This is called automatically by the event loop if any joystick events are enabled. *) val update : t -> unit (** Enable/disable joystick event polling. If joystick events are disabled, you must call {! Sdljoystick.update} yourself and check the state of the joystick when you want joystick information. *) val set_event_state : bool -> unit val get_event_state : unit -> bool type hat_value = int val hat_centered : hat_value val hat_up : hat_value val hat_right : hat_value val hat_down : hat_value val hat_left : hat_value val hat_rightup : hat_value val hat_rightdown : hat_value val hat_leftup : hat_value val hat_leftdown : hat_value val get_axis : t -> int -> int val get_hat : t -> int -> hat_value val get_ball : t -> int -> int * int val get_button : t -> int -> bool (** Close a joystick previously opened with {! Sdljoystick.open_joystick} *) val close : t -> unit ocamlsdl-0.9.1/src/sdlkey.mli0000664000076400007640000001426711770140307014634 0ustar olivoliv(** Keyboard handling and key symbols *) (** {3 Keysyms } *) (** Concrete type describing keyboard keys ("keysym") *) type t = | KEY_UNKNOWN | KEY_BACKSPACE | KEY_TAB | KEY_CLEAR | KEY_RETURN | KEY_PAUSE | KEY_ESCAPE | KEY_SPACE | KEY_EXCLAIM | KEY_QUOTEDBL | KEY_HASH | KEY_DOLLAR | KEY_AMPERSAND | KEY_QUOTE | KEY_LEFTPAREN | KEY_RIGHTPAREN | KEY_ASTERISK | KEY_PLUS | KEY_COMMA | KEY_MINUS | KEY_PERIOD | KEY_SLASH | KEY_0 | KEY_1 | KEY_2 | KEY_3 | KEY_4 | KEY_5 | KEY_6 | KEY_7 | KEY_8 | KEY_9 | KEY_COLON | KEY_SEMICOLON | KEY_LESS | KEY_EQUALS | KEY_GREATER | KEY_QUESTION | KEY_AT (** Skip uppercase letters *) | KEY_LEFTBRACKET | KEY_BACKSLASH | KEY_RIGHTBRACKET | KEY_CARET | KEY_UNDERSCORE | KEY_BACKQUOTE | KEY_a | KEY_b | KEY_c | KEY_d | KEY_e | KEY_f | KEY_g | KEY_h | KEY_i | KEY_j | KEY_k | KEY_l | KEY_m | KEY_n | KEY_o | KEY_p | KEY_q | KEY_r | KEY_s | KEY_t | KEY_u | KEY_v | KEY_w | KEY_x | KEY_y | KEY_z | KEY_DELETE (** End of ASCII mapped keysyms *) | KEY_WORLD_0 (** International keyboard syms *) | KEY_WORLD_1 | KEY_WORLD_2 | KEY_WORLD_3 | KEY_WORLD_4 | KEY_WORLD_5 | KEY_WORLD_6 | KEY_WORLD_7 | KEY_WORLD_8 | KEY_WORLD_9 | KEY_WORLD_10 | KEY_WORLD_11 | KEY_WORLD_12 | KEY_WORLD_13 | KEY_WORLD_14 | KEY_WORLD_15 | KEY_WORLD_16 | KEY_WORLD_17 | KEY_WORLD_18 | KEY_WORLD_19 | KEY_WORLD_20 | KEY_WORLD_21 | KEY_WORLD_22 | KEY_WORLD_23 | KEY_WORLD_24 | KEY_WORLD_25 | KEY_WORLD_26 | KEY_WORLD_27 | KEY_WORLD_28 | KEY_WORLD_29 | KEY_WORLD_30 | KEY_WORLD_31 | KEY_WORLD_32 | KEY_WORLD_33 | KEY_WORLD_34 | KEY_WORLD_35 | KEY_WORLD_36 | KEY_WORLD_37 | KEY_WORLD_38 | KEY_WORLD_39 | KEY_WORLD_40 | KEY_WORLD_41 | KEY_WORLD_42 | KEY_WORLD_43 | KEY_WORLD_44 | KEY_WORLD_45 | KEY_WORLD_46 | KEY_WORLD_47 | KEY_WORLD_48 | KEY_WORLD_49 | KEY_WORLD_50 | KEY_WORLD_51 | KEY_WORLD_52 | KEY_WORLD_53 | KEY_WORLD_54 | KEY_WORLD_55 | KEY_WORLD_56 | KEY_WORLD_57 | KEY_WORLD_58 | KEY_WORLD_59 | KEY_WORLD_60 | KEY_WORLD_61 | KEY_WORLD_62 | KEY_WORLD_63 | KEY_WORLD_64 | KEY_WORLD_65 | KEY_WORLD_66 | KEY_WORLD_67 | KEY_WORLD_68 | KEY_WORLD_69 | KEY_WORLD_70 | KEY_WORLD_71 | KEY_WORLD_72 | KEY_WORLD_73 | KEY_WORLD_74 | KEY_WORLD_75 | KEY_WORLD_76 | KEY_WORLD_77 | KEY_WORLD_78 | KEY_WORLD_79 | KEY_WORLD_80 | KEY_WORLD_81 | KEY_WORLD_82 | KEY_WORLD_83 | KEY_WORLD_84 | KEY_WORLD_85 | KEY_WORLD_86 | KEY_WORLD_87 | KEY_WORLD_88 | KEY_WORLD_89 | KEY_WORLD_90 | KEY_WORLD_91 | KEY_WORLD_92 | KEY_WORLD_93 | KEY_WORLD_94 | KEY_WORLD_95 | KEY_KP0 (** Numeric keypad *) | KEY_KP1 | KEY_KP2 | KEY_KP3 | KEY_KP4 | KEY_KP5 | KEY_KP6 | KEY_KP7 | KEY_KP8 | KEY_KP9 | KEY_KP_PERIOD | KEY_KP_DIVIDE | KEY_KP_MULTIPLY | KEY_KP_MINUS | KEY_KP_PLUS | KEY_KP_ENTER | KEY_KP_EQUALS | KEY_UP (** Arrows + Home/End pad *) | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_INSERT | KEY_HOME | KEY_END | KEY_PAGEUP | KEY_PAGEDOWN | KEY_F1 (** Function keys *) | KEY_F2 | KEY_F3 | KEY_F4 | KEY_F5 | KEY_F6 | KEY_F7 | KEY_F8 | KEY_F9 | KEY_F10 | KEY_F11 | KEY_F12 | KEY_F13 | KEY_F14 | KEY_F15 | KEY_NUMLOCK (** Key state modifier keys *) | KEY_CAPSLOCK | KEY_SCROLLOCK | KEY_RSHIFT | KEY_LSHIFT | KEY_RCTRL | KEY_LCTRL | KEY_RALT | KEY_LALT | KEY_RMETA | KEY_LMETA | KEY_LSUPER (** Left "Windows" key *) | KEY_RSUPER (** Right "Windows" key *) | KEY_MODE (** "Alt Gr" key *) | KEY_COMPOSE (** Multi-key compose key *) | KEY_HELP (** Miscellaneous function keys *) | KEY_PRINT | KEY_SYSREQ | KEY_BREAK | KEY_MENU | KEY_POWER (** Power Macintosh power key *) | KEY_EURO (** Some european keyboards *) | KEY_UNDO (** Atari keyboard has Undo *) val int_of_key : t -> int (** get the SDL keysym of the key *) val key_of_int : int -> t (** get the key corresponding to a SDL keysym @raise Invalid_arg if not a valid SDL keysym *) val char_of_key : t -> char (** Returns a (iso-8859-1) character corresponding to a key @raise Invalid_arg if corresponding SDL keysym is > 255 *) val num_keys : int (** number of keys in the Sdlkey.t variant type : should be [232] *) val max_code : int (** highest SDL keysym : should be [322] *) val name : t -> string (** @return a short string describing the key *) (** {3 Keyboard handling } *) val enable_unicode : bool -> unit (** Enable unicode translation of keysyms for keyboard events *) val query_unicode : unit -> bool val disable_key_repeat : unit -> unit (** Disable keyboard repeat *) val enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit (** Enable keyboard repeat @param delay initial delay in ms between the time when a key is pressed, and keyboard repeat begins @param interval the time in ms between keyboard repeat events *) open Bigarray val get_key_state : unit -> (int, int8_unsigned_elt, c_layout) Array1.t (** Get a snapshot of the current state of the keyboard. @return an array of keystates, indexed by the SDL keysyms (cf {! Sdlkey.int_of_key}) *) val is_key_pressed : t -> bool (** Checks wether a key is currently pressed on the keyboard. *) (** {3 Key modifiers } *) type mod_state = int (** The following values are flags. Use with [land], [lor], etc. *) val kmod_none : mod_state val kmod_lshift : mod_state val kmod_rshift : mod_state val kmod_lctrl : mod_state val kmod_rctrl : mod_state val kmod_lalt : mod_state val kmod_ralt : mod_state val kmod_lmeta : mod_state val kmod_rmeta : mod_state val kmod_num : mod_state val kmod_caps : mod_state val kmod_mode : mod_state val kmod_ctrl : mod_state val kmod_shift : mod_state val kmod_alt : mod_state val kmod_meta : mod_state val get_mod_state : unit -> mod_state (** Get the current key modifier state *) val set_mod_state : mod_state -> unit (** Set the current key modifier state This does not change the keyboard state, only the key modifier flags. *) (**/**) val link_me : unit ocamlsdl-0.9.1/src/sdlloader.mli0000664000076400007640000000060407626521316015310 0ustar olivoliv (** Image loader module *) exception SDLloader_exception of string (** Exception to report errors *) val load_image : string -> Sdlvideo.surface (** load an image as a surface *) val load_image_from_mem : string -> Sdlvideo.surface val read_XPM_from_array : string array -> Sdlvideo.surface (** creates a surface from an array of strings (in the source code) *) ocamlsdl-0.9.1/src/sdlmixer.mli0000644000076400007640000002062611770141413015161 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlmixer.mli,v 1.17 2012/06/19 18:20:59 oliv__a Exp $ *) (** Simple multi-channel audio mixer *) exception SDLmixer_exception of string (** Exception used to report errors *) (** {3 General API} *) val version : unit -> Sdl.version (** Get the version of the dynamically linked SDL_mixer library *) (** Audio format flags *) type format = | AUDIO_FORMAT_U8 (** Unsigned 8-bit samples *) | AUDIO_FORMAT_S8 (** Signed 8-bit samples *) | AUDIO_FORMAT_U16LSB (** Unsigned 16-bit samples *) | AUDIO_FORMAT_S16LSB (** Signed 16-bit samples *) | AUDIO_FORMAT_U16MSB (** As above, but big-endian byte order *) | AUDIO_FORMAT_S16MSB (** As above, but big-endian byte order *) | AUDIO_FORMAT_U16SYS (** Unsigned, native audio byte ordering *) | AUDIO_FORMAT_S16SYS (** Signed, native audio byte ordering *) type channels = MONO | STEREO val open_audio : ?freq:int -> ?format:format -> ?chunksize:int -> ?channels:channels -> unit -> unit (** [open_audio frequency format chunksize channels ()] opens the mixer with a certain audio format. - frequency could be 8000 11025 22050 44100 ; defaults to 22050 - format defaults to AUDIO_FORMAT_S16SYS - chunksize defaults to 4096 - channels defaults to STEREO *) val close_audio : unit -> unit (** Close the mixer, halting all playing audio *) type specs = { frequency : int; format : format; channels : channels } val query_specs : unit -> specs (** Find out what the actual audio device parameters are. @raise SDLmixer_exception if the audio has not been opened *) (** {3 Samples} *) type chunk val loadWAV : string -> chunk (** Load a wave file *) val loadWAV_from_mem : string -> chunk val load_string : string -> chunk (** Load a wave file of the mixer format from a memory buffer *) val load_string_raw : string -> chunk (** Load raw audio data of the mixer format from a memory buffer *) val volume_chunk : chunk -> float val setvolume_chunk : chunk -> float -> unit val free_chunk : chunk -> unit (** Free an audio chunk previously loaded *) (** {3 Channels} *) type channel = int val all_channels : channel (** A special value for representing all channels (-1 actually). *) val num_channels : unit -> int (** @return the number of channels currently allocated *) val allocate_channels : int -> int (** Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped. @return the new number of allocated channels *) val play_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> unit (** [play_channel channel loops ticks chunk ] Play an audio chunk. @param channel channel to play on. If not specified, play on the first free channel. @param loops number of times to play the chunk. If [-1], loop infinitely (~65000 times). @param ticks if specified, play for at most 'ticks' seconds. *) val play_sound : chunk -> unit (** Play an audio chunk. Same as above, without the optional parameters *) val fadein_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> float -> unit (** [fadein_channel channel loops ticks chunck ms] : same as [play_channel] but fades in a over [ms] seconds. *) val volume_channel : channel -> float (** Returns the original volume of a specific channel, chunk or music @return float between 0 and 1. *) val setvolume_channel : channel -> float -> unit (** Sets the volume for specified channel or chunk. Volume is a float between 0 and 1. If lower than 0, nothing is done. If greater than 1, volume is set to 1 *) val pause_channel : channel -> unit val resume_channel : channel -> unit val halt_channel : channel -> unit val expire_channel : channel -> float option -> unit (** [expire_channel channel ticks] Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' seconds have elapsed, or remove the expiration if 'ticks' is [None] *) val fadeout_channel : channel -> float -> unit (** [fadeout_channel channel ticks] Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. *) val playing_channel : channel -> bool val num_playing_channel : unit -> int val paused_channel : channel -> bool val num_paused_channel : unit -> int (** The different fading types supported *) type fade_status = | NO_FADING | FADING_OUT | FADING_IN val fading_channel : channel -> fade_status (** Query the fading status of a channel *) (** {3 Groups} *) type group = int val default_group : group (** The group tag used to represent the group of all the channels. Used to remove a group tag *) val reserve_channels : int -> int (** Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if no channel is specified (see {! Sdlmixer.play_channel}). @return the number of reserved channels *) val group_channel : channel -> group -> unit (** Attach a group tag to a channel. A group tag can be assigned to several mixer channels, to form groups of channels. If group is [default_group], the tag is removed. *) val group_channels : from_c:channel -> to_c:channel -> group -> unit (** Same as above but for a range of channels. *) val group_count : group -> int (** Returns the number of channels in a group. This is also a subtle way to get the total number of channels when [group] is [default_group]. *) val group_available : group -> channel (** Finds the first available [channel] in a [group] of channels @raise Not_found if none are available. *) val group_oldest : group -> channel (** Finds the "oldest" sample playing in a [group] of channels *) val group_newer : group -> channel (** Finds the "most recent" (i.e. last) sample playing in a [group] of channels *) val fadeout_group : group -> float -> unit (** [fadeout_group group ticks] Halt a group of channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. *) val halt_group : group -> unit (** {3 Music} *) type music (** The different music types supported *) type music_kind = | NONE | CMD | WAV | MOD | MID | OGG | MP3 val load_music : string -> music (** Load a music file (.mod .s3m .it .xm .ogg) *) val free_music : music -> unit (** Free music previously loaded *) val play_music : ?loops:int -> music -> unit (** Play a music chunk. @param loops number of times to play through the music *) val fadein_music : ?loops:int -> music -> float -> unit (** [fadein_music chunck loops music ms] : fade in music over [ms] seconds, same semantics as the [play_music] function *) val volume_music : unit -> float val setvolume_music : float -> unit val pause_music : unit -> unit val resume_music : unit -> unit val rewind_music : unit -> unit val set_music_cmd : string -> unit (** Stop music and set external music playback command *) val unset_music_cmd : unit -> unit (** Turn off using an external command for music, returning to the internal music playing functionality *) val halt_music : unit -> unit val fadeout_music : float -> unit (** [fadeout_music ticks] Halt the music, fading it out progressively till it's silent. The ms parameter indicates the number of seconds the fading will take. *) val music_type : music option -> music_kind (** Find out the music format of a mixer music, or the currently playing music, if parameter is [None]. *) val playing_music : unit -> bool val paused_music : unit -> bool val fading_music : unit -> fade_status (** Query the fading status of a music *) ocamlsdl-0.9.1/src/sdl.mli0000644000076400007640000000504511770141413014112 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdl.mli,v 1.12 2012/06/19 18:20:59 oliv__a Exp $ *) (** This module contains functions for initializing/quitting the library *) exception SDL_init_exception of string (** Exception for reporting errors during initialization *) (** {3 Main functions} *) (** Initialization flag type *) type subsystem = [ | `TIMER (** init flag for the timer subsystem *) | `AUDIO (** init flag for the audio subsystem *) | `VIDEO (** init flag for the video subsystem *) | `CDROM (** init flag for the cdrom subsystem *) | `JOYSTICK (** init flag for the joystick subsystem *) ] val init : ?auto_clean:bool -> [< subsystem | `NOPARACHUTE | `EVENTTHREAD | `EVERYTHING ] list -> unit (** Initialize the SDL library. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize. - `NOPARACHUTE : Don't catch fatal signals - `EVENTTHREAD : Automatically pump events in a separate threads - `EVERYTHING : initialize all subsystems *) val init_subsystem : subsystem list -> unit val was_init : unit -> subsystem list val quit : unit -> unit (** [quit] shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. *) val quit_subsystem : subsystem list -> unit (** {3 Versioning information} *) type version = { major : int ; minor : int ; patch : int ; } val version : unit -> version (** version of the SDL library *) val string_of_version : version -> string (** {3 Environment variables} *) val getenv : string -> string val putenv : string -> string -> unit (**/**) type rwops_in val rwops_from_mem : string -> rwops_in val rwops_in_close : rwops_in -> unit ocamlsdl-0.9.1/src/sdlmouse.mli0000664000076400007640000000465411770140561015175 0ustar olivoliv(** Mouse event handling and cursors *) (** {3 Mouse state} *) type button = | BUTTON_LEFT | BUTTON_MIDDLE | BUTTON_RIGHT | BUTTON_WHEELUP | BUTTON_WHEELDOWN | BUTTON_X of int (** BUTTON_X is only seen in a Sdlevent.mousebutton_event, it is not returned by Sdlmouse.get_state *) val get_state : ?relative:bool -> unit -> int * int * button list (** Retrieve the current state of the mouse : current mouse position and list of pressed buttons @param relative if true returns mouse delta instead of position *) val warp : int -> int -> unit (** Set the position of the mouse cursor (generates a mouse motion event) *) (** {3 Cursors } *) open Bigarray type cursor (** abstract type for cursors *) type cursor_data = { data : (int, int8_unsigned_elt, c_layout) Array2.t ; (** B/W cursor data *) mask : (int, int8_unsigned_elt, c_layout) Array2.t ; (** B/W cursor mask *) w : int ; (** width in pixels *) h : int ; (** height in pixels *) hot_x : int ; (** the "tip" of the cursor *) hot_y : int ; (** the "tip" of the cursor *) } val make_cursor : data:(int, int8_unsigned_elt, c_layout) Array2.t -> mask:(int, int8_unsigned_elt, c_layout) Array2.t -> hot_x:int -> hot_y:int -> cursor (** Create a cursor using the specified data and mask (in MSB format). The cursor is created in black and white according to the following: {v data mask resulting pixel on screen 0 1 White 1 1 Black 0 0 Transparent 1 0 Inverted color if possible, black if not. v} Cursors created with this function must be freed with {!Sdlmouse.free_cursor}. *) val free_cursor : cursor -> unit (** Deallocates a cursor. *) val set_cursor : cursor -> unit (** Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display. *) val get_cursor : unit -> cursor (** Returns the currently active cursor. *) val cursor_visible : unit -> bool (** Tests if cursor is shown on screen *) val show_cursor : bool -> unit (** Toggle cursor display *) val cursor_data : cursor -> cursor_data (** converts an abstract cursor value to concrete cursor data *) val pprint_cursor : cursor -> unit (** for debugging : prints on stdout *) val convert_to_cursor : data:int array -> mask:int array -> w:int -> h:int -> hot_x:int -> hot_y:int -> cursor ocamlsdl-0.9.1/src/sdltimer.mli0000644000076400007640000000214211770141413015146 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdltimer.mli,v 1.6 2012/06/19 18:20:59 oliv__a Exp $ *) (** Time-related functions *) (** Wait a specified number of milliseconds before returning *) val delay : int -> unit (** Get the number of milliseconds since the SDL library initialization. *) val get_ticks : unit -> int ocamlsdl-0.9.1/src/sdlttf.mli0000644000076400007640000000752011770141413014630 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: sdlttf.mli,v 1.17 2012/06/19 18:20:59 oliv__a Exp $ *) (** This module provides TTF (TrueType Font) support *) (** Exception for reporting errors *) exception SDLttf_exception of string (** Initialise SDL_tff and freetype *) val init : unit -> unit (** Quits the system *) val quit : unit -> unit (** {3 General operations on font datatype} *) type font (** abstract font datatype *) val open_font : string -> ?index:int -> int -> font (** open a font file and create a font of the specified point size @return font datatype *) (** Set and retrieve the font style This font style is implemented by modifying the font glyphs, and doesn't reflect any inherent properties of the truetype font file. *) type font_style = | NORMAL | BOLD | ITALIC | UNDERLINE val get_font_style : font -> font_style list (** Retrieve the font style : either [NORMAL] or a combination of [BOLD], [ITALIC] and [UNDERLINE] *) val set_font_style : font -> font_style list -> unit (** {3 Font information } *) val font_height : font -> int (** @return the total height(int) of the font (usually equal to point size) *) val font_ascent : font -> int (** @return the offset(int) from the baseline to the top of the font this is a positive value, relative to the baseline *) val font_descent : font -> int (** @return the offset from the baseline to the bottom of the font this is a negative value, relative to the baseline *) val font_lineskip : font -> int (** Get the recommended spacing between lines of text for this font *) val font_faces : font -> int (** Get the number of faces of the font *) (** Get some font face attributes, if any *) val is_fixed_width : font -> bool val family_name : font -> string val style_name : font -> string (** {3 Text rendering functions} *) open Sdlvideo (** Get the dimensions of a rendered string of text *) val size_text : font -> string -> int * int (* UTF8 *) val size_utf8 : font -> string -> int * int (** @return the metrics (minx,maxx,miny,maxy) of a glyph *) val glyph_metrics : font -> char -> int * int * int * int (** Variant type for the generic rendering functions *) type render_kind = | SOLID of color | SHADED of color * color | BLENDED of color (** {4 Text rendering functions} *) val render_text_solid : font -> string -> fg:color -> surface val render_text_shaded : font -> string -> fg:color -> bg:color -> surface val render_text_blended : font -> string -> fg:color -> surface (* UTF8 *) val render_utf8_solid : font -> string -> fg:color -> surface val render_utf8_shaded : font -> string -> fg:color -> bg:color -> surface val render_utf8_blended : font -> string -> fg:color -> surface val render_text : font -> render_kind -> string -> surface (** {4 Glyph rendering functions} *) val render_glyph_solid : font -> char -> fg:color -> surface val render_glyph_shaded : font -> char -> fg:color -> bg:color -> surface val render_glyph_blended : font -> char -> fg:color -> surface val render_glyph : font -> render_kind -> char -> surface ocamlsdl-0.9.1/src/sdlvideo.mli0000644000076400007640000003613311770141413015143 0ustar olivoliv(* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999, 2000, 2001, 2002 OCamlSDL development team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (** Module for video manipulations *) (* $Id: sdlvideo.mli,v 1.34 2012/06/19 18:20:59 oliv__a Exp $ *) open Bigarray exception Video_exn of string (** {3 Rectangles} *) type rect = { mutable r_x : int ; mutable r_y : int ; mutable r_w : int ; mutable r_h : int ; } (** rectangular area (x, y, w, h) *) val rect : x:int -> y:int -> w:int -> h:int -> rect val copy_rect : rect -> rect (** @return a copy of the rectangle *) (** {3 Video mode informations} *) type pixel_format_info = { palette : bool ; bits_pp : int ; (** bits per pixel *) bytes_pp : int ; (** bytes per pixel *) rmask : int32 ; (** red mask value *) gmask : int32 ; (** green mask value *) bmask : int32 ; (** blue mask value *) amask : int32 ; (** alpha mask value *) rshift : int ; gshift : int ; bshift : int ; ashift : int ; rloss : int ; gloss : int ; bloss : int ; aloss : int ; colorkey : int32 ; (** RGB color key information *) alpha : int ; (** Alpha value information (per-surface alpha) *) } (** Structure describing how color are encoded as pixels *) type video_info = { hw_available : bool; (** Hardware surfaces? *) wm_available : bool; (** Window manager present? *) blit_hw : bool; (** Accelerated blits HW -> HW *) blit_hw_color_key : bool; (** Accelerated blits with color key *) blit_hw_alpha : bool; (** Accelerated blits with alpha *) blit_sw : bool; (** Accelerated blits SW -> HW *) blit_sw_color_key : bool; (** Accelerated blits with color key *) blit_sw_alpha : bool; (** Accelerated blits with alpha *) blit_fill : bool; (** Accelerated color fill *) video_mem : int; (** Total amount of video memory (Ko) *) } (** Information on either the 'best' available mode (if called before [set_video_mode]) or the current video mode. *) val get_video_info : unit -> video_info (** @return information about the video hardware *) val get_video_info_format : unit -> pixel_format_info (** @return information about the pixel format *) val driver_name : unit -> string (** @return the name of the video driver *) type video_flag = [ | `SWSURFACE (** Surface is in system memory *) | `HWSURFACE (** Surface is in video memory *) | `ASYNCBLIT (** Enables the use of asynchronous updates of the display surface. This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.*) | `ANYFORMAT (** Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. Passing [`ANYFORMAT] prevents this and causes SDL to use the video surface, regardless of its pixel depth. *) | `HWPALETTE (** Give SDL exclusive palette access *) | `DOUBLEBUF (** Enable hardware double buffering; only valid with [`HWSURFACE]. Calling {!Sdlvideo.flip} will flip the buffers and update the screen. All drawing will take place on the surface that is not displayed at the moment. If double buffering could not be enabled then {!Sdlvideo.flip} will just perform a {!Sdlvideo.update_rect} on the entire screen. *) | `FULLSCREEN (** SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background. *) | `OPENGL (** Create an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL_GL_SetAttribute. *) | `OPENGLBLIT (** Create an OpenGL rendering context, like above, but allow normal blitting operations. The screen (2D) surface may have an alpha channel, and {!Sdlvideo.update_rect} must be used for updating changes to the screen surface. *) | `RESIZABLE (** Create a resizable window. When the window is resized by the user a {!Sdlevent2.VIDEORESIIZE} event is generated and {!Sdlvideo.set_video_mode} can be called again with the new size. *) | `NOFRAME (** If possible, [`NOFRAME] causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set. *) ] type modes = | NOMODE (** no dimensions available for the requested format *) | ANY (** any dimension okay *) | DIM of (int * int) list val list_modes : ?bpp:int -> video_flag list -> modes (** @return a list of available screen dimensions for the given format and video flags, sorted largest to smallest or NOMODE or ANY *) val video_mode_ok : w:int -> h:int -> bpp:int -> video_flag list -> int (** Check to see if a particular video mode is supported. @return 0 if the requested mode is not supported 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, set_video_mode will succeed, but will emulate the requested bits-per-pixel with a shadow surface. *) (** {3 Surfaces} *) type surface (** Graphical surface datatype *) type surface_flags = [ | video_flag | `HWACCEL (** Blit uses hardware acceleration *) | `SRCCOLORKEY (** Blit uses a source color key *) | `RLEACCEL (** Surface is RLE encoded *) | `SRCALPHA (** Blit uses source alpha blending *) | `PREALLOC (** Surface uses preallocated memory *) ] type surface_info = { flags : surface_flags list ; w : int ; (** width *) h : int ; (** height *) pitch : int ; (** pitch *) clip_rect : rect ; (** clipping information *) refcount : int ; (** reference count *) } val surface_info : surface -> surface_info (** @return information for the given [surface] *) val surface_format : surface -> pixel_format_info (** @return pixel format information for the given [surface] *) val surface_dims : surface -> int * int * int (** @return width, height and pitch of the given [surface] *) val surface_flags : surface -> surface_flags list (** @return flag list for the given [surface] *) val surface_bpp : surface -> int (** @return bits-per-pixel for the given [surface] *) (** {3 Video modes-related functions} *) val get_video_surface : unit -> surface (** @return the current display [surface] *) val set_video_mode : w:int -> h:int -> ?bpp:int -> video_flag list -> surface (** Set up a video mode with the specified [width], [height] and [bits-per-pixel]. @param bpp if omited, it is treated as the current display bits per pixel @return the current display [surface] *) val update_rect : ?rect:rect -> surface -> unit (** @param rect makes sure the given area is updated on the given screen. The rectangle must be confined within the screen boundaries (no clipping is done). Updates the entire screen if omitted *) val update_rects : rect list -> surface -> unit (** Makes sure the given list of rectangles is updated on the given screen. The rectangles must all be confined within the screen boundaries (no clipping is done). This function should not be called while screen is locked.*) val flip : surface -> unit (** Swaps screen buffers. On hardware that supports double-buffering ([`DOUBLEBUF]), 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 [update_rect] *) (** {3 Color manipulation} *) val set_gamma : r:float -> g:float -> b:float -> unit (** 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.*) type color = int * int * int (** Format independent color description [(r,g,b)] are 8 bits unsigned integers *) val black : color val white : color val red : color val green : color val blue : color val yellow : color val cyan : color val magenta : color (** {4 Palettes} *) val use_palette : surface -> bool (** @return [true] if surface use indexed colors *) val palette_ncolors : surface -> int (** Number of colors in the surface's palette *) val get_palette_color : surface -> int -> color (** Retrieve a color by its index in a surface's palette *) type palette_flag = | LOGPAL (** set logical palette, which controls how blits are mapped to/from the surface *) | PHYSPAL (** set physical palette, which controls how pixels look on the screen *) | LOGPHYSPAL val set_palette : surface -> ?flag:palette_flag -> ?firstcolor:int -> color array -> unit (** Sets a portion of the palette for a given 8-bit [surface]. @param flag defaults to LOGPHYSPAL @param firstcolor where to blit the color array given as argument (defaults to 0) *) (** {4 Conversions} *) val map_RGB : surface -> ?alpha:int -> color -> int32 (** Maps an RGB triple or an RGBA quadruple to a pixel value for a given pixel format *) val get_RGB : surface -> int32 -> color (** Maps a pixel value into the RGB components for a given pixel format @return RGB color *) val get_RGBA : surface -> int32 -> color * int (** Maps a pixel value into the RGBA components for a given pixel format * @return RGB color and alpha value *) (** {3 Creating RGB surface} *) val create_RGB_surface : [ `SWSURFACE | `HWSURFACE | `ASYNCBLIT | `SRCCOLORKEY | `SRCALPHA ] list -> w:int -> h:int -> bpp:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface (** Creates a RGB surface. 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 given masks. @return the new surface *) val create_RGB_surface_format : surface -> [ `SWSURFACE | `HWSURFACE | `ASYNCBLIT | `SRCCOLORKEY | `SRCALPHA ] list -> w:int -> h:int -> surface (** Creates a RGB surface with the same pixel format as the first parameter. *) val create_RGB_surface_from_32 : (int32, int32_elt, c_layout) Array1.t -> w:int -> h:int -> pitch:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface val create_RGB_surface_from_24 : (int, int8_unsigned_elt, c_layout) Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface val create_RGB_surface_from_16 : (int, int16_unsigned_elt, c_layout) Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface val create_RGB_surface_from_8 : (int, int8_unsigned_elt, c_layout) Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface (** {3 Locking/Unlocking surface} *) val must_lock : surface -> bool (** @return [true] if the surface should be locked before accessing its pixels *) val lock : surface -> unit (** Sets up a surface for directly accessing the pixels. *) val unlock : surface -> unit (** Releases the lock on the given [surface] *) (** {3 Accessing surface pixels} *) val pixel_data : surface -> (int, int8_unsigned_elt, c_layout) Array1.t val pixel_data_8 : surface -> (int, int8_unsigned_elt, c_layout) Array1.t val pixel_data_16 : surface -> (int, int16_unsigned_elt, c_layout) Array1.t val pixel_data_24 : surface -> (int, int8_unsigned_elt, c_layout) Array1.t val pixel_data_32 : surface -> (int32, int32_elt, c_layout) Array1.t val get_pixel : surface -> x:int -> y:int -> int32 val get_pixel_color : surface -> x:int -> y:int -> color (** Access an individual pixel on a surface and returns is as a [color]. The surface may have to be locked before access. *) val put_pixel : surface -> x:int -> y:int -> int32 -> unit val put_pixel_color : surface -> x:int -> y:int -> color -> unit (** Sets an individual pixel on a surface. The surface may have to be locked before access. *) (** {3 Reading/writing in BMP files} *) val load_BMP : string -> surface (** Loads a surface from a named Windows BMP file.*) val load_BMP_from_mem : string -> surface (** Loads a BMP image from a memory buffer. *) val save_BMP : surface -> string -> unit (** Saves the [surface] as a Windows BMP file named file. *) (** {3 Colorkey and alpha stuff} *) val unset_color_key : surface -> unit val set_color_key : surface -> ?rle:bool -> int32 -> unit (** Sets the color key (transparent pixel) in a blittable [surface]. *) val get_color_key : surface -> int32 (** @return the color key of the given [surface] *) val unset_alpha : surface -> unit val set_alpha : surface -> ?rle:bool -> int -> unit (** sets the alpha value for the entire [surface], as opposed to using the alpha component of each pixel. *) val get_alpha : surface -> int (** @return the alpha value of the given [surface] *) (** {3 Clipping} *) val unset_clip_rect : surface -> unit (** disable clipping for the given [surface] *) val set_clip_rect : surface -> rect -> unit (** Sets the clipping rectangle for the destination [surface] in a blit. *) val get_clip_rect : surface -> rect (** @return the clipping rectangle for the destination [surface] in a blit. *) (** {3 Blitting} *) val blit_surface : src:surface -> ?src_rect:rect -> dst:surface -> ?dst_rect:rect -> unit -> unit (** Performs a fast blit from the source [surface] to the destination [surface]. @param src_rect the width and height determine the size of the copied rectangle. If omitted, the entire surface is copied. @param dst_rect only the position is used (the width and height are ignored). If omitted, the detination position (upper left corner) is (0, 0). The final blit rectangles are saved in [src_rect] and [dst_rect] after all clipping is performed. The blit function should not be called on a locked surface. *) val fill_rect : ?rect:rect -> surface -> int32 -> unit (** performs a fast fill of the given rectangle with 'color' *) val display_format : ?alpha:bool -> surface -> surface (** 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. @param alpha if [true], include an alpha channel in the new surface *) ocamlsdl-0.9.1/src/sdlwm.mli0000664000076400007640000000246511770141025014462 0ustar olivoliv (** Window Manager interaction *) val set_caption : title:string -> icon:string -> unit (** Sets the title and icon text of the display window *) val get_caption : unit -> string * string (** Gets the title and icon text of the display window *) val set_icon : Sdlvideo.surface -> unit (** Sets the icon for the display window. This function must be called before the first call to {!Sdlvideo.set_video_mode}. *) val iconify : unit -> bool (** This function iconifies the window, and returns [true] if it succeeded. If the function succeeds, it generates an {!Sdlevent.active_event} loss event. This function is a noop and returns [false] in non-windowed environments. *) val toggle_fullscreen : unit -> bool (** Toggle fullscreen mode without changing the contents of the screen. If this function was able to toggle fullscreen mode (change from running in a window to fullscreen, or vice-versa), it will return [true]. If it is not implemented, or fails, it returns [false]. *) val grab_input : bool -> unit (** Set the input grab state of the application. 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. *) val query_grab : unit -> bool ocamlsdl-0.9.1/src/sdlcdrom_stub.c0000664000076400007640000001125210101057401015622 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdlcdrom_stub.c,v 1.17 2004/07/26 01:31:45 oliv__a Exp $ */ #include #include "common.h" #ifdef __GNUC__ /* typechecked macro */ #define Val_CDROM(p) ( { SDL_CD *_mlsdl__cd = p; \ abstract_ptr(_mlsdl__cd); } ) #else #define Val_CDROM(p) abstract_ptr(p); #endif #define CDROM_val(v) ((SDL_CD *)(Field(v, 0))) /* * Raise an OCaml exception with a message */ static void sdlcdrom_raise_exception (char *msg) Noreturn; static void sdlcdrom_raise_exception (char *msg) { static value *cdrom_exn = NULL; if(! cdrom_exn) cdrom_exn = caml_named_value("SDLcdrom_exception"); raise_with_string(*cdrom_exn, msg); } static void sdlcdrom_raise_nocd () Noreturn; static void sdlcdrom_raise_nocd () { static value *cdrom_exn = NULL; if(! cdrom_exn) cdrom_exn = caml_named_value("SDLcdrom_nocd"); raise_constant(*cdrom_exn); } /* * OCaml/C conversion functions */ CAMLprim value sdlcdrom_get_num_drives (value unit) { int num_of_drives = SDL_CDNumDrives(); if (num_of_drives < 0) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_int(num_of_drives); } CAMLprim value sdlcdrom_drive_name (value num_drive) { const char *name = SDL_CDName(Int_val(num_drive)); if (name == NULL) sdlcdrom_raise_exception(SDL_GetError()); return copy_string((char *)name); } CAMLprim value sdlcdrom_open (value num_drive) { SDL_CD *cdrom = SDL_CDOpen(Int_val(num_drive)); if (cdrom == NULL) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_CDROM(cdrom); } CAMLprim value sdlcdrom_close (value cdrom) { SDL_CDClose(CDROM_val(cdrom)); nullify_abstract(cdrom); return Val_unit; } CAMLprim value sdlcdrom_play_tracks (value cdrom, value start_track, value start_frame, value ntracks, value nframes) { SDL_CD *cd = CDROM_val(cdrom); if (CD_INDRIVE(SDL_CDStatus(cd))) { SDL_CDPlayTracks(cd, Int_val(start_track), Int_val(start_frame), Int_val(ntracks), Int_val(nframes)); } else sdlcdrom_raise_nocd(); return Val_unit; } CAMLprim value sdlcdrom_pause (value cdrom) { if (SDL_CDPause(CDROM_val(cdrom)) < 0) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_unit; } CAMLprim value sdlcdrom_resume (value cdrom) { if (SDL_CDResume(CDROM_val(cdrom)) < 0) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_unit; } CAMLprim value sdlcdrom_stop (value cdrom) { if (SDL_CDStop(CDROM_val(cdrom)) < 0) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_unit; } CAMLprim value sdlcdrom_eject (value cdrom) { if (SDL_CDEject(CDROM_val(cdrom)) < 0) { sdlcdrom_raise_exception(SDL_GetError()); } return Val_unit; } CAMLprim value sdlcdrom_status (value cdrom) { int v=0; switch (SDL_CDStatus(CDROM_val(cdrom))) { case CD_TRAYEMPTY : v=0; break; case CD_STOPPED : v=1; break; case CD_PLAYING : v=2; break; case CD_PAUSED : v=3; break; case CD_ERROR : sdlcdrom_raise_exception(SDL_GetError()); } return Val_int(v); } CAMLprim value sdlcdrom_info(value cdrom) { SDL_CD *cd = CDROM_val(cdrom); switch( SDL_CDStatus(cd) ) { case CD_TRAYEMPTY : sdlcdrom_raise_nocd (); case CD_ERROR : sdlcdrom_raise_exception(SDL_GetError()); default: break; } { CAMLparam0(); CAMLlocal3(v, a, t); int i; a = alloc(cd->numtracks, 0); for(i=0; inumtracks; i++) { SDL_CDtrack tr = cd->track[i]; t = alloc_small(4, 0); Field(t, 0) = Val_int(tr.id) ; if(tr.type == SDL_AUDIO_TRACK) Field(t, 1) = Val_int(0) ; else Field(t, 1) = Val_int(1) ; Field(t, 2) = Val_int(tr.length); Field(t, 3) = Val_int(tr.offset); Store_field(a, i, t); } v = alloc_small(4, 0); Field(v, 0) = Val_int(cd->numtracks); Field(v, 1) = Val_int(cd->cur_track); Field(v, 2) = Val_int(cd->cur_frame); Field(v, 3) = a; CAMLreturn(v); } } ocamlsdl-0.9.1/src/sdlevent_stub.c0000644000076400007640000003047511774641761015676 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdlevent_stub.c,v 1.27 2012/07/03 19:11:45 oliv__a Exp $ */ #include #include "common.h" #include "sdlmouse_stub.h" ML_0(SDL_PumpEvents, Unit) static void raise_event_exn(char *msg) Noreturn; static void raise_event_exn(char *msg) { static value *exn = NULL; if(! exn){ exn = caml_named_value("sdlevent_exn"); if(! exn) { fprintf(stderr, "exception not registered."); abort(); } } raise_with_string(*exn, msg); } static value value_of_active_state(Uint8 state) { value v = nil(); if(state & SDL_APPMOUSEFOCUS) v = mlsdl_cons(Val_int(0), v); if(state & SDL_APPINPUTFOCUS) v = mlsdl_cons(Val_int(1), v); if(state & SDL_APPACTIVE) v = mlsdl_cons(Val_int(2), v); return v; } CAMLprim value mlsdlevent_get_app_state(value unit) { return value_of_active_state( SDL_GetAppState() ); } static Uint8 state_of_value(value l) { Uint8 state = 0; while(is_not_nil(l)){ if (Is_long(hd(l))) state |= 1 << Int_val(hd(l)); l = tl(l); } return state; } static value find_mlsdl_keysym(SDLKey key) { static value *table = NULL; if(! table){ table = caml_named_value("rev_keycode_table"); if(! table) raise_event_exn("keysyms lookup table not registered !"); } return Field(*table, key); } static SDLKey find_sdl_keysym(value mlkey) { static value *table = NULL; if(! table){ table = caml_named_value("keycode_table"); if(! table) raise_event_exn("keysyms lookup table not registered !"); } return Int_val(Field(*table, Int_val(mlkey))); } static value value_of_keyevent(SDL_KeyboardEvent keyevt) { CAMLparam0(); CAMLlocal2(v, r); Uint8 char_code = 0; tag_t tag; r = alloc_small(6, 0); Field(r, 0) = Val_int(keyevt.which) ; Field(r, 1) = keyevt.state == SDL_RELEASED ? Val_int(0) : Val_int(1); Field(r, 2) = find_mlsdl_keysym(keyevt.keysym.sym) ; Field(r, 3) = Val_int(keyevt.keysym.mod) ; if (keyevt.keysym.unicode <= 0x7F) char_code = keyevt.keysym.unicode; Field(r, 4) = Val_int(char_code); Field(r, 5) = Val_long(keyevt.keysym.unicode); tag = keyevt.state == SDL_PRESSED ? 1 : 2 ; v = alloc_small(1, tag); Field(v, 0) = r; CAMLreturn(v); } static value value_of_mouse_button(Uint8 b) { value r; if (SDL_BUTTON_LEFT <= b && b <= SDL_BUTTON_WHEELDOWN) r = Val_int(b - 1); else { r = caml_alloc_small(1, 0); Field(r, 0) = Val_int(b); } return r; } static value value_of_SDLEvent(SDL_Event evt) { CAMLparam0(); CAMLlocal3(v, r, t); tag_t tag; switch(evt.type){ case SDL_ACTIVEEVENT : t = value_of_active_state(evt.active.state); r = alloc_small(2, 0); Field(r, 0) = Val_bool(evt.active.gain); Field(r, 1) = t; v = alloc_small(1, 0); Field(v, 0) = r; break ; case SDL_KEYDOWN : case SDL_KEYUP : v = value_of_keyevent(evt.key); break ; case SDL_MOUSEMOTION : t = value_of_mousebutton_state(evt.motion.state); r = alloc_small(6, 0); Field(r, 0) = Val_int(evt.motion.which); Field(r, 1) = t; Field(r, 2) = Val_int(evt.motion.x); Field(r, 3) = Val_int(evt.motion.y); Field(r, 4) = Val_int(evt.motion.xrel); Field(r, 5) = Val_int(evt.motion.yrel); v = alloc_small(1, 3); Field(v, 0) = r; break ; case SDL_MOUSEBUTTONDOWN : case SDL_MOUSEBUTTONUP : t = value_of_mouse_button(evt.button.button); r = alloc_small(5, 0); Field(r, 0) = Val_int(evt.button.which); Field(r, 1) = t; Field(r, 2) = evt.button.state == SDL_RELEASED ? Val_int(0) : Val_int(1); Field(r, 3) = Val_int(evt.button.x); Field(r, 4) = Val_int(evt.button.y); tag = evt.button.state == SDL_PRESSED ? 4 : 5; v = alloc_small(1, tag); Field(v, 0) = r ; break ; case SDL_JOYAXISMOTION : r = alloc_small(3, 0); Field(r, 0) = Val_int(evt.jaxis.which); Field(r, 1) = Val_int(evt.jaxis.axis); Field(r, 2) = Val_int(evt.jaxis.value); v = alloc_small(1, 6); Field(v, 0) = r; break ; case SDL_JOYBALLMOTION : r = alloc_small(4, 0); Field(r, 0) = Val_int(evt.jball.which); Field(r, 1) = Val_int(evt.jball.ball); Field(r, 2) = Val_int(evt.jball.xrel); Field(r, 3) = Val_int(evt.jball.yrel); v = alloc_small(1, 7); Field(v, 0) = r; break ; case SDL_JOYHATMOTION : r = alloc_small(3, 0); Field(r, 0) = Val_int(evt.jhat.which); Field(r, 1) = Val_int(evt.jhat.hat); Field(r, 2) = Val_int(evt.jhat.value); v = alloc_small(1, 8); Field(v, 0) = r; break ; case SDL_JOYBUTTONDOWN : case SDL_JOYBUTTONUP : r = alloc_small(3, 0); Field(r, 0) = Val_int(evt.jbutton.which); Field(r, 1) = Val_int(evt.jbutton.button); Field(r, 2) = evt.jbutton.state == SDL_RELEASED ? Val_int(0) : Val_int(1); tag = evt.jbutton.state == SDL_PRESSED ? 9 : 10 ; v = alloc_small(1, tag); Field(v, 0) = r; break ; case SDL_QUIT : v = Val_int(0); break; case SDL_SYSWMEVENT : v = Val_int(1); break; case SDL_VIDEORESIZE : v = alloc_small(2, 11); Field(v, 0) = Val_int(evt.resize.w); Field(v, 1) = Val_int(evt.resize.h); break; case SDL_VIDEOEXPOSE : v = Val_int(2); break; case SDL_USEREVENT : v = alloc_small(1, 12); Field(v, 0) = Val_int(evt.user.code); break; default : /* unknown event ? -> raise an exception */ raise_event_exn("unknown event"); } CAMLreturn(v); } static SDL_Event SDLEvent_of_value(value e) { SDL_Event evt; if(Is_long(e)) switch(Int_val(e)){ case 0 : evt.type = SDL_QUIT; break; case 1: goto invalid; case 2: evt.type = SDL_VIDEOEXPOSE; break; default: abort(); } else { value r = Field(e, 0); switch(Tag_val(e)){ case 0 : evt.type = SDL_ACTIVEEVENT; evt.active.gain = Bool_val(Field(r, 0)); evt.active.state = state_of_value(Field(r, 1)); break ; case 1: case 2: evt.type = Tag_val(e) == 1 ? SDL_KEYDOWN : SDL_KEYUP ; evt.key.which = Int_val(Field(r, 0)); evt.key.state = Int_val(Field(r, 1)); evt.key.keysym.scancode = 0; evt.key.keysym.sym = find_sdl_keysym(Field(r, 2)) ; evt.key.keysym.mod = Int_val(Field(r, 3)); evt.key.keysym.unicode = 0; break; case 3: evt.type = SDL_MOUSEMOTION; evt.motion.which = Int_val(Field(r, 0)); evt.motion.state = state_of_value(Field(r, 1)); evt.motion.x = Int_val(Field(r, 2)); evt.motion.y = Int_val(Field(r, 3)); evt.motion.xrel = Int_val(Field(r, 4)); evt.motion.yrel = Int_val(Field(r, 5)); break; case 4: case 5: evt.type = Tag_val(e) == 4 ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP ; evt.button.which = Int_val(Field(r, 0)); evt.button.button = Is_long(Field(r, 1)) ? Int_val(Field(r, 1)) : Int_val(Field(Field(r, 1), 0)); evt.button.state = Int_val(Field(r, 2)); evt.button.x = Int_val(Field(r, 3)); evt.button.y = Int_val(Field(r, 4)); break; case 6: evt.type = SDL_JOYAXISMOTION; evt.jaxis.which = Int_val(Field(r, 0)); evt.jaxis.axis = Int_val(Field(r, 1)); evt.jaxis.value = Int_val(Field(r, 2)); break ; case 7: evt.type = SDL_JOYBALLMOTION; evt.jball.which = Int_val(Field(r, 0)); evt.jball.ball = Int_val(Field(r, 1)); evt.jball.xrel = Int_val(Field(r, 2)); evt.jball.yrel = Int_val(Field(r, 3)); break; case 8: evt.type = SDL_JOYHATMOTION; evt.jhat.which = Int_val(Field(r, 0)); evt.jhat.hat = Int_val(Field(r, 1)); evt.jhat.value = Int_val(Field(r, 2)); break; case 9: case 10: evt.type = Tag_val(e) == 0 ? SDL_JOYBUTTONDOWN : SDL_JOYBUTTONUP ; evt.jbutton.which = Int_val(Field(r, 0)); evt.jbutton.button = Int_val(Field(r, 1)); evt.jbutton.state = Int_val(Field(r, 2)); break; case 11: evt.type = SDL_VIDEORESIZE ; evt.resize.w = Int_val(Field(e, 0)); evt.resize.h = Int_val(Field(e, 1)); break; case 12: evt.type = SDL_USEREVENT ; evt.user.code = Int_val(Field(e, 0)); evt.user.data1 = NULL; evt.user.data2 = NULL; break; default: abort(); } } return evt; invalid: invalid_argument("SDLEvent_of_value"); return evt; /* silence compiler */ } CAMLprim value mlsdlevent_peek(value omask, value num) { int n = Int_val(num); int m; LOCALARRAY(SDL_Event, evt, n); Uint32 mask = Opt_arg(omask, Int_val, SDL_ALLEVENTS); m = SDL_PeepEvents(evt, n, SDL_PEEKEVENT, mask); if(m < 0) raise_event_exn(SDL_GetError()); { int i; CAMLparam0(); CAMLlocal1(v); v = nil(); for(i=m-1; i>=0; i--){ value e = value_of_SDLEvent(evt[i]); v = mlsdl_cons(e, v); } CAMLreturn(v); } } CAMLprim value mlsdlevent_get(value omask, value num) { int n = Int_val(num); int m; LOCALARRAY(SDL_Event, evt, n); Uint32 mask = Opt_arg(omask, Int_val, SDL_ALLEVENTS); m = SDL_PeepEvents(evt, n, SDL_GETEVENT, mask); if(m < 0) raise_event_exn(SDL_GetError()); { int i; CAMLparam0(); CAMLlocal1(v); v = nil(); for(i=m-1; i>=0; i--){ value e = value_of_SDLEvent(evt[i]); v = mlsdl_cons(e, v); } CAMLreturn(v); } } CAMLprim value mlsdlevent_add(value elist) { int len = mlsdl_list_length(elist); LOCALARRAY(SDL_Event, evt, len); value l = elist; int i=0; while(is_not_nil(l)){ evt[i] = SDLEvent_of_value(hd(l)); l = tl(l); i++; } if(SDL_PeepEvents(evt, len, SDL_ADDEVENT, SDL_ALLEVENTS) < 0) raise_event_exn(SDL_GetError()); return Val_unit; } CAMLprim value mlsdlevent_has_event(value unit) { return Val_bool(SDL_PollEvent(NULL)); } CAMLprim value mlsdlevent_poll(value unit) { SDL_Event evt; value v = Val_none; if(SDL_PollEvent(&evt) == 1) v = Val_some( value_of_SDLEvent(evt) ); return v; } CAMLprim value mlsdlevent_wait(value unit) { int status; enter_blocking_section(); status = SDL_WaitEvent(NULL); leave_blocking_section(); if(! status) raise_event_exn(SDL_GetError()); return Val_unit; } CAMLprim value mlsdlevent_wait_event(value unit) { SDL_Event evt; int status; enter_blocking_section(); status = SDL_WaitEvent(&evt); leave_blocking_section(); if(! status) raise_event_exn(SDL_GetError()); return value_of_SDLEvent(evt); } static const Uint8 evt_type_of_val [] = { SDL_ACTIVEEVENT, SDL_KEYDOWN, SDL_KEYUP, SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_QUIT, SDL_SYSWMEVENT, SDL_VIDEORESIZE, SDL_VIDEOEXPOSE, SDL_USEREVENT, } ; CAMLprim value mlsdlevent_get_state(value evt_v) { return Val_bool( SDL_EventState( evt_type_of_val[ Int_val(evt_v) ], SDL_QUERY) ); } CAMLprim value mlsdlevent_set_state(value state, value evt_v) { int c_state = ( state == Val_true ? SDL_ENABLE : SDL_DISABLE ) ; SDL_EventState( evt_type_of_val[ Int_val(evt_v) ], c_state); return Val_unit; } CAMLprim value mlsdlevent_set_state_by_mask(value mask, value state) { int c_state = ( state == Val_true ? SDL_ENABLE : SDL_DISABLE ) ; Uint32 c_mask = Int_val(mask); int i; for(i=0; i #include #include #include "common.h" #include "sdlvideo_stub.h" /* PRIMITIVES */ /* missing: - vline & hline - pie & filledPie - trigon & aatrigon & filledTrigon - polygon & aapolygon & filledPolygon - bezier curve */ /* pixel */ CAMLprim value ml_pixelColor(value dst,value x,value y, value col) { SDL_Surface *sur= SDL_SURFACE(dst); int r; r=pixelColor(sur,Int_val(x),Int_val(y),Int32_val(col)); return Val_bool(r); } CAMLprim value ml_pixelRGBA(value dst,value x,value y, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Color c; int r; SDLColor_of_value(&c,col); r=pixelRGBA(sur,Int_val(x),Int_val(y),c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } /* rectangle */ CAMLprim value ml_rectangleColor(value dst,value p1,value p2, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1, rect2; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); r=rectangleColor(sur,rect1.x,rect1.y,rect2.x,rect2.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_rectangleRGBA(value dst,value p1,value p2, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1, rect2; SDL_Color c; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); SDLColor_of_value(&c,col); r=rectangleRGBA(sur,rect1.x,rect1.y,rect2.x,rect2.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_boxColor(value dst,value p1,value p2, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); r=boxColor(sur,rect1.x,rect1.y,rect2.x,rect2.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_boxRGBA(value dst,value p1,value p2, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; SDL_Color c; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); SDLColor_of_value(&c,col); r=boxRGBA(sur,rect1.x,rect1.y,rect2.x,rect2.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } /* line */ CAMLprim value ml_lineColor(value dst,value p1,value p2, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); r=lineColor(sur,rect1.x,rect1.y,rect2.x,rect2.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_lineRGBA(value dst,value p1,value p2, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; SDL_Color c; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); SDLColor_of_value(&c,col); r=lineRGBA(sur,rect1.x,rect1.y,rect2.x,rect2.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_aalineColor(value dst,value p1,value p2, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); r=aalineColor(sur,rect1.x,rect1.y,rect2.x,rect2.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_aalineRGBA(value dst,value p1,value p2, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect1,rect2; SDL_Color c; int r; SDLRect_of_value(&rect1,p1); SDLRect_of_value(&rect2,p2); SDLColor_of_value(&c,col); r=aalineRGBA(sur,rect1.x,rect1.y,rect2.x,rect2.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } /* circle */ CAMLprim value ml_circleColor(value dst,value p,value ra, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; int r; SDLRect_of_value(&prect,p); r=circleColor(sur,prect.x,prect.y,Int_val(ra),Int32_val(col)); return Val_bool(r); } CAMLprim value ml_circleRGBA(value dst,value p,value ra, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLColor_of_value(&c,col); r=circleRGBA(sur,prect.x,prect.y,Int_val(ra),c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_aacircleColor(value dst,value p,value ra, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; int r; SDLRect_of_value(&prect,p); r=aacircleColor(sur,prect.x,prect.y,Int_val(ra),Int32_val(col)); return Val_bool(r); } CAMLprim value ml_aacircleRGBA(value dst,value p,value ra, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLColor_of_value(&c,col); r=aacircleRGBA(sur,prect.x,prect.y,Int_val(ra),c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_filledCircleColor(value dst,value p,value ra, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; int r; SDLRect_of_value(&prect,p); r=filledCircleColor(sur,prect.x,prect.y,Int_val(ra),Int32_val(col)); return Val_bool(r); } CAMLprim value ml_filledCircleRGBA(value dst,value p,value ra, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLColor_of_value(&c,col); r=filledCircleRGBA(sur,prect.x,prect.y,Int_val(ra),c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } /* ellipse */ CAMLprim value ml_ellipseColor(value dst,value p,value rp, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); r=ellipseColor(sur,prect.x,prect.y,rprect.x,rprect.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_ellipseRGBA(value dst,value p,value rp, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); SDLColor_of_value(&c,col); r=ellipseRGBA(sur,prect.x,prect.y,rprect.x,rprect.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_aaellipseColor(value dst,value p,value rp, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); r=aaellipseColor(sur,prect.x,prect.y,rprect.x,rprect.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_aaellipseRGBA(value dst,value p,value rp, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); SDLColor_of_value(&c,col); r=aaellipseRGBA(sur,prect.x,prect.y,rprect.x,rprect.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_filledEllipseColor(value dst,value p,value rp, value col) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); r=filledEllipseColor(sur,prect.x,prect.y,rprect.x,rprect.y,Int32_val(col)); return Val_bool(r); } CAMLprim value ml_filledEllipseRGBA(value dst,value p,value rp, value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect prect,rprect; SDL_Color c; int r; SDLRect_of_value(&prect,p); SDLRect_of_value(&rprect,rp); SDLColor_of_value(&c,col); r=filledEllipseRGBA(sur,prect.x,prect.y,rprect.x,rprect.y,c.r,c.g,c.b, Int_val(alpha)); return Val_bool(r); } /* text */ CAMLprim value ml_characterColor(value dst,value p,value c,value color) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect; int r; SDLRect_of_value(&rect,p); r=characterColor(sur,rect.x,rect.y,(char) c,Int32_val(color)); return Val_bool(r); } CAMLprim value ml_characterRGBA(value dst,value p,value ch,value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect; SDL_Color c; int r; SDLRect_of_value(&rect,p); SDLColor_of_value(&c,col); r=characterRGBA(sur,rect.x,rect.y,(char) ch,c.r,c.g,c.b,Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_stringColor(value dst,value p,value c,value color) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect; int r; SDLRect_of_value(&rect,p); r=stringColor(sur,rect.x,rect.y,String_val(c),Int32_val(color)); return Val_bool(r); } CAMLprim value ml_stringRGBA(value dst,value p,value ch,value col,value alpha) { SDL_Surface *sur= SDL_SURFACE(dst); SDL_Rect rect; SDL_Color c; int r; SDLRect_of_value(&rect,p); SDLColor_of_value(&c,col); r=stringRGBA(sur,rect.x,rect.y,String_val(ch),c.r,c.g,c.b,Int_val(alpha)); return Val_bool(r); } CAMLprim value ml_gfxPrimitivesSetFont(value fd,value cw,value ch) { gfxPrimitivesSetFont(String_val(fd),Int_val(cw),Int_val(ch)); return Val_unit; } /* ROTOZOOM */ CAMLprim value ml_rotozoomSurface(value src,value angle,value zoom,value smooth) { SDL_Surface *ssur= SDL_SURFACE(src); SDL_Surface *dsur; dsur=rotozoomSurface(ssur,Double_val(angle),Double_val(zoom),Bool_val(smooth)); return ML_SURFACE(dsur); } CAMLprim value ml_rotozoomSurfaceXY(value src,value angle,value zoomx,value zoomy,value smooth) { SDL_Surface *ssur= SDL_SURFACE(src); SDL_Surface *dsur; dsur=rotozoomSurfaceXY(ssur,Double_val(angle),Double_val(zoomx),Double_val(zoomy),Bool_val(smooth)); return ML_SURFACE(dsur); } CAMLprim value ml_zoomSurface(value src,value zoomx,value zoomy,value smooth) { SDL_Surface *ssur= SDL_SURFACE(src); SDL_Surface *dsur; dsur=zoomSurface(ssur,Double_val(zoomx),Double_val(zoomy),Bool_val(smooth)); return ML_SURFACE(dsur); } ocamlsdl-0.9.1/src/sdlgl_stub.c0000664000076400007640000000420311550322642015131 0ustar olivoliv #include #include "common.h" #include "sdlvideo_stub.h" /* * GL interaction functions */ CAMLprim value ml_SDL_GL_SwapBuffers(value unit) { enter_blocking_section(); SDL_GL_SwapBuffers(); leave_blocking_section(); return Val_unit; } static const SDL_GLattr GL_attr_map[] = { 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, #if SDL_MINOR_VERSION == 2 && SDL_PATCHLEVEL >= 5 SDL_GL_STEREO, #endif }; CAMLprim value ml_SDL_GL_SetAttribute(value attrl) { while( is_not_nil(attrl) ){ value attr = hd(attrl); if(Tag_val(attr) < SDL_TABLESIZE(GL_attr_map)) SDL_GL_SetAttribute( GL_attr_map[ Tag_val(attr) ], Int_val(Field(attr, 0)) ); attrl = tl(attrl); } return Val_unit; } CAMLprim value ml_SDL_GL_GetAttribute(value unit) { CAMLparam0(); CAMLlocal2(v, a); int i, val; v = Val_emptylist; for(i=SDL_TABLESIZE(GL_attr_map)-1; i>=0; i--){ if( SDL_GL_GetAttribute( GL_attr_map[i], &val) < 0) CAMLreturn( ( sdlvideo_raise_exception(SDL_GetError()) , Val_unit ) ) ; a = alloc_small(1, i); Field(a, 0) = Val_int(val); v = mlsdl_cons(a, v); } CAMLreturn(v); } /* LablGL interaction : the following defines come from LablGL 0.98 */ #define MLTAG_ubyte Val_int(520420861) #define SIZE_RAW 5 #define Kind_raw(raw) (Field(raw,0)) #define Base_raw(raw) (Field(raw,1)) #define Offset_raw(raw) (Field(raw,2)) #define Size_raw(raw) (Field(raw,3)) #define Static_raw(raw) (Field(raw,4)) CAMLprim value ml_SDL_GL_to_raw(value s) { SDL_Surface *surf = SDL_SURFACE(s); void *pixels = surf->pixels; size_t size = surf->h * surf->pitch; value raw; raw = alloc_small (SIZE_RAW+1, 0); Kind_raw(raw) = MLTAG_ubyte; Size_raw(raw) = Val_int(size); Base_raw(raw) = Val_bp(pixels); Offset_raw(raw) = Val_int(0); Static_raw(raw) = Val_false; /* we extend the record with a field containing the SDL surface to keep it live */ Field(raw, SIZE_RAW) = s; return raw; } ocamlsdl-0.9.1/src/sdlinit_flag.c0000664000076400007640000000063007475446306015445 0ustar olivoliv/* init_flag : conversion table */ lookup_info ml_table_init_flag[] = { { 0, 8 }, { MLTAG_CDROM, SDL_INIT_CDROM }, { MLTAG_JOYSTICK, SDL_INIT_JOYSTICK }, { MLTAG_EVENTTHREAD, SDL_INIT_EVENTTHREAD }, { MLTAG_TIMER, SDL_INIT_TIMER }, { MLTAG_EVERYTHING, SDL_INIT_EVERYTHING }, { MLTAG_NOPARACHUTE, SDL_INIT_NOPARACHUTE }, { MLTAG_AUDIO, SDL_INIT_AUDIO }, { MLTAG_VIDEO, SDL_INIT_VIDEO }, }; ocamlsdl-0.9.1/src/sdljoystick_stub.c0000664000076400007640000000537607755706134016420 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 2002 plusieurs personnes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdljoystick_stub.c,v 1.5 2003/11/16 14:40:28 oliv__a Exp $ */ #include #include "common.h" #ifdef __GNUC__ /* typechecked macro */ #define Val_SDLJoystick(p) ( { SDL_Joystick *_mlsdl__j = p; \ abstract_ptr(_mlsdl__j); } ) #else #define Val_SDLJoystick(p) abstract_ptr(p); #endif #define SDLJoystick_val(v) ((SDL_Joystick *)(Field(v, 0))) static void mlsdljoystick_raise_exception (char *msg) Noreturn; static void mlsdljoystick_raise_exception (char *msg) { static value *joystick_exn = NULL; if(! joystick_exn) joystick_exn = caml_named_value("SDLjoystick_exception"); raise_with_string(*joystick_exn, msg); } ML_0(SDL_NumJoysticks, Val_int) ML_1(SDL_JoystickName, Int_val, copy_string) CAMLprim value ml_SDL_JoystickOpen(value index) { SDL_Joystick *j = SDL_JoystickOpen(Int_val(index)); if(! j) mlsdljoystick_raise_exception(SDL_GetError()); return Val_SDLJoystick(j); } ML_1(SDL_JoystickOpened, Int_val, Val_bool) ML_1(SDL_JoystickIndex, SDLJoystick_val, Val_int) ML_1(SDL_JoystickNumAxes, SDLJoystick_val, Val_int) ML_1(SDL_JoystickNumBalls, SDLJoystick_val, Val_int) ML_1(SDL_JoystickNumHats, SDLJoystick_val, Val_int) ML_1(SDL_JoystickNumButtons, SDLJoystick_val, Val_int) ML_0(SDL_JoystickUpdate, Unit) ML_1_name(ml_SDL_JoystickSetEventState, SDL_JoystickEventState, Bool_val, Unit) CAMLprim value ml_SDL_JoystickGetEventState(value unit) { return Val_bool(SDL_JoystickEventState(SDL_QUERY)); } ML_2(SDL_JoystickGetAxis, SDLJoystick_val, Int_val, Val_int) ML_2(SDL_JoystickGetHat, SDLJoystick_val, Int_val, Val_int); ML_2(SDL_JoystickGetButton, SDLJoystick_val, Int_val, Val_bool); CAMLprim value ml_SDL_JoystickGetBall(value j, value ball) { int dx, dy; value v; SDL_JoystickGetBall(SDLJoystick_val(j), Int_val(ball), &dx, &dy); v = alloc_small(2, 0); Field(v, 0) = Val_int(dx); Field(v, 1) = Val_int(dy); return v; } ML_1(SDL_JoystickClose, SDLJoystick_val, Unit) ocamlsdl-0.9.1/src/sdlkey_stub.c0000664000076400007640000000226007755704436015341 0ustar olivoliv/* $Id: sdlkey_stub.c,v 1.6 2003/11/16 14:26:38 oliv__a Exp $ */ #include #include "common.h" CAMLprim value ml_SDL_GetKeyName(value key) { return copy_string(SDL_GetKeyName(Int_val(key))); } CAMLprim value ml_SDL_DisableKeyRepeat(value unit) { SDL_EnableKeyRepeat(0, 0); return Val_unit; } CAMLprim value ml_SDL_EnableKeyRepeat(value odelay, value ointerval, value unit) { int delay = Opt_arg(odelay, Int_val, SDL_DEFAULT_REPEAT_DELAY); int interval = Opt_arg(ointerval, Int_val, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableKeyRepeat(delay, interval); return Val_unit; } CAMLprim value ml_SDL_GetKeyState(value unit) { int len; Uint8 *data = SDL_GetKeyState(&len); long llen = len; value v = alloc_bigarray(BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL, 1, data, &llen); return v; } ML_0(SDL_GetModState, Val_int) ML_1(SDL_SetModState, Int_val, Unit) CAMLprim value ml_sdl_key_pressed(value ksym) { int len; Uint8 *keystate = SDL_GetKeyState(&len); return Val_bool( keystate[ Int_val(ksym) ] ); } ML_1(SDL_EnableUNICODE, Bool_val, Unit) CAMLprim value ml_SDL_QueryUNICODE(value unit) { return Val_bool(SDL_EnableUNICODE(-1)); } ocamlsdl-0.9.1/src/sdlloader_stub.c0000664000076400007640000000451111363136122015775 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdlloader_stub.c,v 1.17 2010/04/19 20:25:54 oliv__a Exp $ */ #include #include #include #include "common.h" #include "sdlvideo_stub.h" #include "sdlrwops_stub.h" static void sdlloader_raise_exception (char *msg) Noreturn; static void sdlloader_raise_exception (char *msg) { static value *loader_exn = NULL; if(! loader_exn){ loader_exn = caml_named_value("SDLloader_exception"); if(! loader_exn) { fprintf(stderr, "exception not registered."); abort(); } } raise_with_string(*loader_exn, msg); } CAMLprim value ml_IMG_Load(value file) { SDL_Surface *s; char *fname = strdup(String_val(file)); enter_blocking_section(); s = IMG_Load(fname); leave_blocking_section(); free(fname); if(! s) sdlloader_raise_exception(IMG_GetError()); return ML_SURFACE(s); } CAMLprim value ml_IMG_Load_RW(value o_autoclose, value rwops) { int autoclose = Opt_arg(o_autoclose, Bool_val, SDL_TRUE); SDL_Surface *s = IMG_Load_RW(SDLRWops_val(rwops), autoclose); if(! s) sdlloader_raise_exception(IMG_GetError()); return ML_SURFACE(s); } #if (OCAMLSDL_IMAGE_VERSION >= 121) CAMLprim value ml_IMG_ReadXPMFromArray(value string_arr) { int len = Wosize_val(string_arr); LOCALARRAY(char *, xpm, len+1); SDL_Surface *s; memcpy(xpm, Bp_val(string_arr), Bsize_wsize(len)); xpm[len] = NULL; s = IMG_ReadXPMFromArray(xpm); if(! s) sdlloader_raise_exception(IMG_GetError()); return ML_SURFACE(s); } #else Unsupported (IMG_ReadXPMFromArray) #endif ocamlsdl-0.9.1/src/sdlmixer_stub.c0000664000076400007640000003121611550323034015653 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdlmixer_stub.c,v 1.37 2011/04/10 12:44:12 oliv__a Exp $ */ #include #include #include #include #include "common.h" #include "sdlrwops_stub.h" /* * memory management (custom blocks) */ #ifdef __GNUC__ /* typechecked macro */ #define ML_CHUNK(chunk) ( { Mix_Chunk *_mlsdl__c=chunk; \ abstract_ptr(_mlsdl__c); } ) #else #define ML_CHUNK(chunk) abstract_ptr(chunk); #endif #define SDL_CHUNK(chunk) ((Mix_Chunk *)Field((chunk), 0)) #ifdef __GNUC__ /* typechecked macro */ #define ML_MUS(music) ( { Mix_Music *_mlsdl__m=music; \ abstract_ptr(_mlsdl__m); } ) #else #define ML_MUS(music) abstract_ptr(music); #endif #define SDL_MUS(music) ((Mix_Music *)Field((music), 0)) /* * Raise an OCaml exception with a message */ static void sdlmixer_raise_exception (char *msg) Noreturn; static void sdlmixer_raise_exception (char *msg) { static value *mixer_exn = NULL; if(! mixer_exn){ mixer_exn = caml_named_value("SDLmixer_exception"); if(! mixer_exn) { fprintf(stderr, "exception not registered."); abort(); } } raise_with_string(*mixer_exn, msg); } /* * OCaml/C conversion functions */ CAMLprim value sdlmixer_open_audio(value frequency, value format, value chunksize, value channels, value unit) { static const int format_of_val[] = { AUDIO_U8, AUDIO_S8, AUDIO_U16LSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_S16MSB, AUDIO_U16SYS, AUDIO_S16SYS, } ; int ret, mstr, c_format; int c_frequency = Opt_arg(frequency, Int_val, MIX_DEFAULT_FREQUENCY); int c_chunksize = Opt_arg(chunksize, Int_val, 1024); if(channels == Val_none) mstr = MIX_DEFAULT_CHANNELS; else mstr = Int_val(Unopt(channels)) + 1; if(format == Val_none) c_format = MIX_DEFAULT_FORMAT; else c_format = format_of_val[ Int_val(Unopt(format)) ]; ret = Mix_OpenAudio(c_frequency, c_format, mstr, c_chunksize); if (ret == -1) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_allocate_channels(value channels) { return Val_int(Mix_AllocateChannels(Int_val(channels))); } CAMLprim value sdlmixer_version(value unit) { const SDL_version *v; value r; r = alloc_small(3, 0); #ifdef MIX_VERSION v = Mix_Linked_Version(); Field(r, 0) = Val_int(v->major); Field(r, 1) = Val_int(v->minor); Field(r, 2) = Val_int(v->patch); #else Field(r, 0) = Val_int(1); Field(r, 1) = Val_int(2); Field(r, 2) = Val_int(0); #endif return r; } CAMLprim value sdlmixer_query_specs(value unit) { int freq, chan, ret, ml_format; value query; Uint16 form; ret = Mix_QuerySpec(&freq, &form, &chan); if(ret == 0) sdlmixer_raise_exception(Mix_GetError()); switch (form) { case AUDIO_U8: ml_format = 0; break; case AUDIO_S8: ml_format = 1; break; case AUDIO_U16LSB: ml_format = 2; break; case AUDIO_S16LSB: ml_format = 3; break; case AUDIO_U16MSB: ml_format = 4; break; case AUDIO_S16MSB: ml_format = 5; break; default: abort(); } query = alloc_small(3, 0); Field(query, 0) = Val_int(freq); Field(query, 1) = Val_int(ml_format); Field(query, 2) = Val_int(chan-1); return query; } CAMLprim value sdlmixer_loadWAV(value fname) { Mix_Chunk *chunk; chunk = Mix_LoadWAV(String_val(fname)); if (chunk == NULL) sdlmixer_raise_exception(Mix_GetError()); return ML_CHUNK(chunk); } CAMLprim value sdlmixer_loadWAV_RW(value o_autoclose, value rwops) { int autoclose = Opt_arg(o_autoclose, Bool_val, SDL_TRUE); Mix_Chunk *c = Mix_LoadWAV_RW(SDLRWops_val(rwops), autoclose); if(! c) sdlmixer_raise_exception(Mix_GetError()); return ML_CHUNK(c); } CAMLprim value sdlmixer_loadMUS(value fname) { Mix_Music *chunk; chunk = Mix_LoadMUS(String_val(fname)); if (chunk == NULL) sdlmixer_raise_exception(Mix_GetError()); return ML_MUS(chunk); } CAMLprim value sdlmixer_load_string(value data) { Mix_Chunk *chunk; chunk = Mix_QuickLoad_WAV(UString_val(data)); if (chunk == NULL) sdlmixer_raise_exception(Mix_GetError()); return ML_CHUNK(chunk); } CAMLprim value sdlmixer_load_string_raw(value data) { Mix_Chunk *chunk; #if (MIX_MAJOR_VERSION >= 1) && (MIX_MINOR_VERSION >= 2) && (MIX_PATCHLEVEL >= 4) chunk = Mix_QuickLoad_RAW(UString_val(data), caml_string_length(data)); if (chunk == NULL) sdlmixer_raise_exception(Mix_GetError()); #else caml_failwith("Mix_QuickLoad_RAW: not supported") #endif return ML_CHUNK(chunk); } CAMLprim value sdlmixer_get_music_type(value music) { Mix_Music *mus = Opt_arg(music, SDL_MUS, NULL); value v; #if (MIX_MAJOR_VERSION >= 1) && (MIX_MINOR_VERSION >= 2) && (MIX_PATCHLEVEL >= 4) switch(Mix_GetMusicType(mus)) { case MUS_NONE : v = Val_int(0); break; case MUS_CMD : v = Val_int(1); break; case MUS_WAV : v = Val_int(2); break; case MUS_MOD : v = Val_int(3); break; case MUS_MID : v = Val_int(4); break; case MUS_OGG : v = Val_int(5); break; case MUS_MP3 : v = Val_int(6); break; default : v = Val_int(0); break; } #else v = Val_int(0); #endif return v; } CAMLprim value sdlmixer_set_music_cmd(value command) { int ret = Mix_SetMusicCMD(String_val(command)); if(ret == -1) raise_out_of_memory(); return Val_unit; } CAMLprim value sdlmixer_unset_music_cmd(value unit) { Mix_SetMusicCMD(NULL); return Val_unit; } CAMLprim value sdlmixer_free_chunk(value chunk) { Mix_FreeChunk(SDL_CHUNK(chunk)); nullify_abstract(chunk); return Val_unit; } CAMLprim value sdlmixer_free_music(value chunk) { Mix_FreeMusic(SDL_MUS(chunk)); nullify_abstract(chunk); return Val_unit; } CAMLprim value sdlmixer_reserve_channels(value num) { return Val_int(Mix_ReserveChannels(Int_val(num))); } CAMLprim value sdlmixer_group_channel(value chn, value grp) { int res; res = Mix_GroupChannel(Int_val(chn), Int_val(grp)); if (res == 0) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_group_channels(value from_chn, value to_chn, value grp) { int from = Int_val(from_chn); int to = Int_val(to_chn); if(Mix_GroupChannels(from, to, Int_val(grp)) != (to-from+1)) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_group_available(value grp) { int ret = Mix_GroupAvailable(Int_val(grp)); if(ret == -1) raise_not_found(); return Val_int(ret); } CAMLprim value sdlmixer_group_count(value grp) { return Val_int(Mix_GroupCount(Int_val(grp))); } CAMLprim value sdlmixer_group_oldest(value grp) { int ret = Mix_GroupOldest(Int_val(grp)); if(ret == -1) raise_not_found(); return Val_int(ret); } CAMLprim value sdlmixer_group_newer(value grp) { int ret = Mix_GroupNewer(Int_val(grp)); if(ret == -1) raise_not_found(); return Val_int(ret); } CAMLprim value sdlmixer_play_channel_timed(value chn, value loops, value tme, value sound) { int t; int ret; int c_chn = Opt_arg(chn, Int_val, -1); int c_loops = Opt_arg(loops, Int_val, 1); if (c_loops == 0) return Val_unit; if (c_loops > 0) c_loops -= 1; if (tme == Val_none) t = -1; else t = 1000.0 * Double_val(Unopt(tme)); ret = Mix_PlayChannelTimed(c_chn, SDL_CHUNK(sound), c_loops, t); if(ret == -1) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_play_music(value loops, value music) { int c_loops = Opt_arg(loops, Int_val, -1); int ret = Mix_PlayMusic(SDL_MUS(music), c_loops); if(ret == -1) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_fadein_music(value loops, value music, value ms) { int c_ms = 1000 * Double_val(ms) ; int c_loops = Opt_arg(loops, Int_val, -1); int ret = Mix_FadeInMusic(SDL_MUS(music), c_loops, c_ms); if(ret == -1) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_fadein_channel(value chn, value loops, value ticks, value chunk, value ms) { int c_ticks, ret; int c_ms = 1000 * Double_val(ms) ; int c_chn = Opt_arg(chn, Int_val, -1); int c_loops = Opt_arg(loops, Int_val, 0); if (c_loops > 0) c_loops -= 1; if (ticks == Val_none) c_ticks = -1; else c_ticks = 1000.0 * Double_val(Unopt(ticks)); ret = Mix_FadeInChannelTimed(c_chn, SDL_CHUNK(chunk), c_loops, c_ms, c_ticks); if(ret == -1) sdlmixer_raise_exception(Mix_GetError()); return Val_unit; } CAMLprim value sdlmixer_volume_channel(value chn) { return copy_double(Mix_Volume(Int_val(chn), -1) / (double) MIX_MAX_VOLUME); } CAMLprim value sdlmixer_volume_chunk(value chunk) { return copy_double(Mix_VolumeChunk(SDL_CHUNK(chunk), -1) / (double) MIX_MAX_VOLUME); } CAMLprim value sdlmixer_volume_music(value unit) { return copy_double(Mix_VolumeMusic(-1) / (double) MIX_MAX_VOLUME); } CAMLprim value sdlmixer_setvolume_channel(value chn, value vol) { Mix_Volume(Int_val(chn), Double_val(vol) * MIX_MAX_VOLUME); return Val_unit; } CAMLprim value sdlmixer_setvolume_chunk(value chunk, value vol) { Mix_VolumeChunk(SDL_CHUNK(chunk), Double_val(vol) * MIX_MAX_VOLUME); return Val_unit; } CAMLprim value sdlmixer_setvolume_music(value vol) { Mix_VolumeMusic(Double_val(vol) * MIX_MAX_VOLUME ); return Val_unit; } CAMLprim value sdlmixer_halt_channel(value chn) { Mix_HaltChannel(Int_val(chn)); return Val_unit; } CAMLprim value sdlmixer_halt_group(value grp) { Mix_HaltGroup(Int_val(grp)); return Val_unit; } CAMLprim value sdlmixer_halt_music(void) { Mix_HaltMusic(); return Val_unit; } CAMLprim value sdlmixer_expire_channel(value chn, value ticks) { int t; if (ticks == Val_none) t = -1; else t = 1000.0 * Double_val(Unopt(ticks)); Mix_ExpireChannel(Int_val(chn), t); return Val_unit; } CAMLprim value sdlmixer_fadeout_channel(value chn, value ms) { Mix_FadeOutChannel(Int_val(chn), 1000.0 * Double_val(ms)); return Val_unit; } CAMLprim value sdlmixer_fadeout_group(value grp, value ms) { Mix_FadeOutGroup(Int_val(grp), 1000.0 * Double_val(ms)); return Val_unit; } CAMLprim value sdlmixer_fadeout_music(value ms) { Mix_FadeOutMusic(1000.0 * Double_val(ms)); return Val_unit; } static value convert_fading_status(Mix_Fading f) { int conv = 0; switch (f) { case MIX_NO_FADING: conv = 0; break; case MIX_FADING_OUT: conv = 1; break; case MIX_FADING_IN: conv = 2; break; } return Val_int(conv); } CAMLprim value sdlmixer_fading_music(void) { Mix_Fading f; f = Mix_FadingMusic(); return convert_fading_status(f); } CAMLprim value sdlmixer_fading_channel(value chn) { Mix_Fading f; if(Int_val(chn) < 0) invalid_argument("Sdlmixer.fading_channel"); f = Mix_FadingChannel(Int_val(chn)); return convert_fading_status(f); } CAMLprim value sdlmixer_pause_channel(value chn) { Mix_Pause(Int_val(chn)); return Val_unit; } CAMLprim value sdlmixer_resume_channel(value chn) { Mix_Resume(Int_val(chn)); return Val_unit; } CAMLprim value sdlmixer_numpaused_channel(value unit) { return Val_int(Mix_Paused(-1)); } CAMLprim value sdlmixer_paused_channel(value chn) { if(Int_val(chn) < 0) invalid_argument("Sdlmixer.paused_channel"); return Val_bool(Mix_Paused(Int_val(chn))); } CAMLprim value sdlmixer_pause_music(void) { Mix_PauseMusic(); return Val_unit; } CAMLprim value sdlmixer_resume_music(void) { Mix_ResumeMusic(); return Val_unit; } CAMLprim value sdlmixer_rewind_music(void) { Mix_RewindMusic(); return Val_unit; } CAMLprim value sdlmixer_paused_music(void) { return Val_bool(Mix_PausedMusic()); } CAMLprim value sdlmixer_numplaying(value unit) { return Val_int(Mix_Playing(-1)); } CAMLprim value sdlmixer_playing(value chn) { if(Int_val(chn) < 0) invalid_argument("Sdlmixer.playing_channel"); return Val_bool(Mix_Playing(Int_val(chn))); } CAMLprim value sdlmixer_playing_music(void) { return Val_bool(Mix_PlayingMusic()); } CAMLprim value sdlmixer_close_audio(value unit) { Mix_CloseAudio(); return Val_unit; } ocamlsdl-0.9.1/src/sdlmouse_stub.c0000664000076400007640000000611511770136612015667 0ustar olivoliv #include #include "common.h" #include "sdlmouse_stub.h" /* * Mouse state */ value value_of_mousebutton_state(Uint8 state) { value v = Val_emptylist; int i; const int buttons[] = { SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, }; for(i=SDL_TABLESIZE(buttons)-1; i>=0; i--) if(state & SDL_BUTTON(buttons[i])) v = mlsdl_cons(Val_int(i), v); return v; } CAMLprim value mlsdlevent_get_mouse_state(value orelative, value unit) { CAMLparam0(); CAMLlocal2(s, v); int x,y; int relative = Opt_arg(orelative, Bool_val, 0); Uint8 state; if(relative) state = SDL_GetRelativeMouseState(&x, &y); else state = SDL_GetMouseState(&x, &y); s = value_of_mousebutton_state(state); v = alloc_small(3, 0); Field(v, 0) = Val_int(x); Field(v, 1) = Val_int(y); Field(v, 2) = s ; CAMLreturn(v); } ML_2(SDL_WarpMouse, Int_val, Int_val, Unit) /* * Cursors */ CAMLprim value ml_SDL_CreateCursor(value data, value mask, value hot_x, value hot_y) { struct caml_bigarray *b_data = Bigarray_val(data); struct caml_bigarray *b_mask = Bigarray_val(mask); SDL_Cursor *c; int h = b_data->dim[0]; int w = b_data->dim[1]; if(b_mask->dim[0] != h || b_mask->dim[1] != w) invalid_argument("Sdl_mouse.create_cursor: wrong data/mask format"); c = SDL_CreateCursor((Uint8 *)b_data->data, (Uint8 *)b_mask->data, w*8, h, Int_val(hot_x), Int_val(hot_y)); { CAMLparam2(data, mask); CAMLlocal2(v, r); v = abstract_ptr(c); r = alloc_small(3, 0); Field(r, 0) = v; Field(r, 1) = data; Field(r, 2) = mask; CAMLreturn(r); } } #define MLSDL_CURSOR(v) ((SDL_Cursor *)Field(Field((v), 0), 0)) CAMLprim value ml_SDL_FreeCursor(value c) { SDL_FreeCursor( MLSDL_CURSOR(c) ); nullify_abstract (Field(c, 0)); Store_field(c, 1, Val_unit); Store_field(c, 2, Val_unit); return Val_unit; } ML_1(SDL_SetCursor, MLSDL_CURSOR, Unit) ML_1(SDL_ShowCursor, Bool_val, Unit) CAMLprim value ml_SDL_ShowCursor_query(value unit) { return Val_bool(SDL_ShowCursor(-1)); } CAMLprim value ml_SDL_GetCursor(value unit) { CAMLparam0(); CAMLlocal2(v, r); SDL_Cursor *c = SDL_GetCursor(); v = abstract_ptr(c); r = alloc_small(3, 0); Field(r, 0) = v; Field(r, 1) = Val_unit; Field(r, 2) = Val_unit; CAMLreturn(r); } CAMLprim value ml_SDL_Cursor_data(value cursor) { CAMLparam0(); CAMLlocal3(v, b_data, b_mask); SDL_Cursor *c = MLSDL_CURSOR(cursor); if(Field(cursor, 1) != Val_unit) { b_data = Field(cursor, 1); b_mask = Field(cursor, 2); } else { b_data = alloc_bigarray_dims(BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL, 2, c->data, c->area.h, c->area.w / 8); b_mask = alloc_bigarray_dims(BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL, 2, c->mask, c->area.h, c->area.w / 8); } v = alloc_small(6, 0); Field(v, 0) = b_data; Field(v, 1) = b_mask; Field(v, 2) = Val_int(c->area.w); Field(v, 3) = Val_int(c->area.h); Field(v, 4) = Val_int(c->hot_x); Field(v, 5) = Val_int(c->hot_y); CAMLreturn(v); } ocamlsdl-0.9.1/src/sdlrwops_stub.c0000664000076400007640000000506410101050101015662 0ustar olivoliv#include #include #include "common.h" #include "sdlrwops_stub.h" #define RWOPS_DATA(r) ((r)->hidden.unknown.data1) #define CHECK_RWOPS(r) do{ \ if(! RWOPS_DATA(r)) { \ SDL_SetError("closed Sdl.rwops") ; \ return -1; } \ } while(0) struct mem_pos_data { void *base; size_t off; size_t max; }; #define RWmem_pos_data(r) (r->hidden.unknown.data1) static int mlsdl_mem_seek(SDL_RWops *context, int offset, int whence) { size_t newoff; struct mem_pos_data *pdata = RWmem_pos_data(context); CHECK_RWOPS(context); switch (whence) { case SEEK_SET: newoff = offset; break; case SEEK_CUR: newoff = pdata->off+offset; break; case SEEK_END: newoff = pdata->max+offset; break; default: SDL_SetError("Unknown value for 'whence'"); return -1; } if ( newoff < 0 || newoff > pdata->max ) return -1; pdata->off = newoff; return newoff; } static int mlsdl_mem_read(SDL_RWops *context, void *ptr, int size, int maxnum) { int num; struct mem_pos_data *pdata = RWmem_pos_data(context); CHECK_RWOPS(context); num = maxnum; if (pdata->off + (num*size) > pdata->max) num = (pdata->max - pdata->off)/size; memcpy(ptr, ((char *)pdata->base) + pdata->off, num*size); pdata->off += num*size; return num; } static int mlsdl_mem_write(SDL_RWops *context, const void *ptr, int size, int num) { return -1; } static int mlsdl_mem_close(SDL_RWops *context) { struct mem_pos_data *pdata = RWmem_pos_data(context); void *base; if(! pdata) return 0; base = &pdata->base; remove_global_root(base); stat_free(pdata); RWmem_pos_data(context) = NULL; return 0; } CAMLprim value mlsdl_rwops_finalise(value rw) { SDL_RWops *rwops = SDLRWops_val(rw); if(RWOPS_DATA(rwops)) rwops->close(rwops); stat_free(rwops); return Val_unit; } CAMLprim value mlsdl_rw_from_mem(value buff) { SDL_RWops *rwops; struct mem_pos_data *pdata; void *base; rwops = stat_alloc(sizeof *rwops); pdata = stat_alloc(sizeof *pdata); rwops->seek = mlsdl_mem_seek; rwops->read = mlsdl_mem_read; rwops->write = mlsdl_mem_write; rwops->close = mlsdl_mem_close; rwops->type = MLSDL_RWOPS_MEM; RWmem_pos_data(rwops) = pdata; pdata->base = String_val(buff); base = &pdata->base; register_global_root(base); pdata->off = 0; pdata->max = string_length(buff); return abstract_ptr(rwops); } CAMLprim value mlsdl_rwops_close(value rw) { SDL_RWops *rwops = SDLRWops_val(rw); if(RWOPS_DATA(rwops)) rwops->close(rwops); return Val_unit; } ocamlsdl-0.9.1/src/sdl_stub.c0000664000076400007640000000717711363134623014625 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdl_stub.c,v 1.20 2010/04/19 20:14:11 oliv__a Exp $ */ #include #include #include #include #include #include #include #include "common.h" /* * Local functions */ /* Shut down the SDL with all stubs */ static void sdl_internal_quit (void) { /* Shut down SDL */ SDL_Quit(); } /* conversion between OCAMLSDL flags and C SDL flags */ #include "sdlinit_flag.h" #include "sdlinit_flag.c" static int init_flag_val(value flag_list) { int flag = 0; value l = flag_list; while (is_not_nil(l)){ flag |= Init_flag_val(hd(l)); l = tl(l); } return flag; } /* * OCaml/C conversion functions */ CAMLprim value sdl_init(value auto_clean, value vf) { int flags = init_flag_val(vf); int clean = Opt_arg(auto_clean, Bool_val, 0); if (SDL_Init(flags) < 0) raise_with_string(*caml_named_value("SDL_init_exception"), SDL_GetError()); if(clean) atexit(sdl_internal_quit); return Val_unit; } CAMLprim value sdl_quit (value unit) { sdl_internal_quit(); return Val_unit; } CAMLprim value sdl_init_subsystem (value vf) { int flags = init_flag_val(vf); if (SDL_Init(flags) < 0) raise_with_string(*caml_named_value("SDL_init_exception"), SDL_GetError()); return Val_unit; } CAMLprim value sdl_quit_subsystem (value vf) { int flags = init_flag_val(vf); SDL_QuitSubSystem(flags); return Val_unit; } CAMLprim value sdl_was_init (value unit) { Uint32 flags = SDL_WasInit(0); value l = nil(); lookup_info *table = ml_table_init_flag; int i; for (i = table[0].data; i > 0; i--) if (flags & table[i].data && table[i].data != SDL_INIT_EVERYTHING) l = mlsdl_cons(table[i].key, l); return l; } CAMLprim value sdl_version (value unit) { const SDL_version *v; value r; v = SDL_Linked_Version(); r = alloc_small(3, 0); Field(r, 0) = Val_int(v->major); Field(r, 1) = Val_int(v->minor); Field(r, 2) = Val_int(v->patch); return r; } /* a shameless cut-and-paste from putenv.c in the caml Unix module sources ... */ CAMLprim value sdl_putenv(value name, value val) { mlsize_t namelen = string_length(name); mlsize_t vallen = string_length(val); char * s = stat_alloc(namelen + 1 + vallen + 1); memmove (s, String_val(name), namelen); if(vallen > 0) { s[namelen] = '='; memmove (s + namelen + 1, String_val(val), vallen); s[namelen + 1 + vallen] = 0; } else s[namelen] = 0; if (putenv(s) == -1) raise_out_of_memory(); return Val_unit; } /* main entry point, used on MacOs X */ #if defined(__WIN32__) || \ (defined(__MWERKS__) && !defined(__BEOS__)) || \ defined(__MACOS__) || defined(__MACOSX__) || \ defined(__SYMBIAN32__) || defined(QWS) int main (int argc, char **argv) { caml_main (argv); return 0; } #endif ocamlsdl-0.9.1/src/sdltimer_stub.c0000664000076400007640000000227207755704436015674 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdltimer_stub.c,v 1.11 2003/11/16 14:26:38 oliv__a Exp $ */ #include #include "common.h" /* * OCaml/C conversion functions */ CAMLprim value sdltimer_delay (value ms) { enter_blocking_section(); SDL_Delay(Int_val(ms)); leave_blocking_section(); return Val_unit; } CAMLprim value sdltimer_get_ticks(value u) { return Val_int(SDL_GetTicks()); } ocamlsdl-0.9.1/src/sdlttf_stub.c0000664000076400007640000002164211363134623015334 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: sdlttf_stub.c,v 1.30 2010/04/19 20:14:11 oliv__a Exp $ */ #include #include "common.h" #include "sdlvideo_stub.h" /* * Convertion Macros */ #define SDL_FONT(f) (*(TTF_Font **)Data_custom_val(f)) static void ml_TTF_CloseFont(value v) { TTF_CloseFont(SDL_FONT(v)); } static int ml_TTF_compare(value v1, value v2) { TTF_Font *f1 = SDL_FONT(v1); TTF_Font *f2 = SDL_FONT(v2); if(f1 == f2) return 0; if(f1 < f2) return -1; else return 1; } static struct custom_operations sdl_ttf_ops = { "sdlsurface", &ml_TTF_CloseFont, &ml_TTF_compare, custom_hash_default, custom_serialize_default, custom_deserialize_default }; static value ML_FONT(TTF_Font *f) { value v; TTF_Font **b; v = alloc_custom(&sdl_ttf_ops, sizeof(*b), 0, 1); b = Data_custom_val(v); *b = f; return v; } /* * Raise an OCaml exception with a message */ static void sdlttf_raise_exception (char *msg) Noreturn; static void sdlttf_raise_exception (char *msg) { static value *ttf_exn = NULL; if(! ttf_exn) ttf_exn = caml_named_value("SDLttf_exception"); raise_with_string(*ttf_exn, msg); } /* * SDL_ttf initialization */ CAMLprim value sdlttf_init(value unit) { int error; error = TTF_Init(); if (error) { sdlttf_raise_exception(TTF_GetError()); } return Val_unit; } /* * SDL_ttf shutdown */ CAMLprim value sdlttf_kill(value unit) { TTF_Quit(); return Val_unit; } /* * OCaml/C conversion functions */ CAMLprim value sdlttf_open_font(value file, value index, value ptsize) { int c_index = Opt_arg(index, Int_val, 0); TTF_Font *font=NULL; #if (OCAMLSDL_TTF_VERSION >= 204) font = TTF_OpenFontIndex(String_val(file), Int_val(ptsize), c_index); #else /* try to keep compatibility with SDL_ttf v1 */ font = TTF_OpenFont(String_val(file), Int_val(ptsize)); #endif if (font == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_FONT(font); } CAMLprim value sdlttf_get_font_style(value font) { int style = TTF_GetFontStyle(SDL_FONT(font)); if (style == TTF_STYLE_NORMAL) return mlsdl_cons(Val_int(0), Val_emptylist); else { int i; const int font_style_table [] = { TTF_STYLE_BOLD, TTF_STYLE_ITALIC, TTF_STYLE_UNDERLINE } ; value v_style = Val_emptylist; for(i=0; i < 3 ; i++) if(font_style_table[i] & style) v_style = mlsdl_cons(Val_int(i+1), v_style); return v_style; } } CAMLprim value sdlttf_set_font_style(value font, value style) { const int font_style_table [] = { TTF_STYLE_NORMAL, TTF_STYLE_BOLD, TTF_STYLE_ITALIC, TTF_STYLE_UNDERLINE } ; int c_style = 0; while (is_not_nil(style)) { c_style |= font_style_table[ Int_val( hd(style) ) ]; style = tl(style); } TTF_SetFontStyle(SDL_FONT(font), c_style); return Val_unit; } CAMLprim value sdlttf_font_height(value font) { return Val_int(TTF_FontHeight(SDL_FONT(font))); } CAMLprim value sdlttf_font_ascent(value font) { return Val_int(TTF_FontAscent(SDL_FONT(font))); } CAMLprim value sdlttf_font_descent(value font) { return Val_int(TTF_FontDescent(SDL_FONT(font))); } ML_1(TTF_FontLineSkip, SDL_FONT, Val_int) #if (OCAMLSDL_TTF_VERSION >= 204) ML_1(TTF_FontFaces, SDL_FONT, Val_int) ML_1(TTF_FontFaceIsFixedWidth, SDL_FONT, Val_bool) ML_1(TTF_FontFaceFamilyName, SDL_FONT, copy_string) ML_1(TTF_FontFaceStyleName, SDL_FONT, copy_string) #else Unsupported (TTF_FontFaces) Unsupported (TTF_FontFaceIsFixedWidth) Unsupported (TTF_FontFaceFamilyName) Unsupported (TTF_FontFaceStyleName) #endif /* OCAMLSDL_TTF_VERSION */ CAMLprim value sdlttf_size_text(value font, value text) { int w, h; value v; if(TTF_SizeText(SDL_FONT(font), String_val(text), &w, &h)) sdlttf_raise_exception(TTF_GetError()); v = alloc_small(2, 0); Field(v, 0) = Val_int(w); Field(v, 1) = Val_int(h); return v; } CAMLprim value sdlttf_render_text_solid(value font, value text, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderText_Solid(SDL_FONT(font),String_val(text), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_glyph_solid(value font, value ch, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderGlyph_Solid(SDL_FONT(font),Int_val(ch), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_text_shaded(value font, value text, value fg, value bg) { SDL_Color sfg; SDL_Color sbg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); SDLColor_of_value(&sbg, bg); surf = TTF_RenderText_Shaded(SDL_FONT(font),String_val(text), sfg, sbg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_glyph_shaded(value font, value ch, value fg, value bg) { SDL_Color sfg; SDL_Color sbg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); SDLColor_of_value(&sbg, bg); surf = TTF_RenderGlyph_Shaded(SDL_FONT(font),Int_val(ch), sfg, sbg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_text_blended(value font, value text, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderText_Blended(SDL_FONT(font),String_val(text), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_glyph_blended(value font, value ch, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderGlyph_Blended(SDL_FONT(font),Int_val(ch), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_glyph_metrics(value fnt, value chr) { int minx; int miny; int maxx; int maxy; int advance; int c = Int_val(chr); value result; TTF_Font *font = SDL_FONT(fnt); TTF_GlyphMetrics(font, c, &minx, &maxx, &miny, &maxy, &advance); result = alloc(4, 0); Store_field(result, 0, Val_int(minx)); Store_field(result, 1, Val_int(maxx)); Store_field(result, 2, Val_int(miny)); Store_field(result, 3, Val_int(maxy)); return result; } /* UTF8 */ CAMLprim value sdlttf_size_utf8(value font, value text) { int w, h; value v; if(TTF_SizeUTF8(SDL_FONT(font), String_val(text), &w, &h)) sdlttf_raise_exception(TTF_GetError()); v = alloc_small(2, 0); Field(v, 0) = Val_int(w); Field(v, 1) = Val_int(h); return v; } CAMLprim value sdlttf_render_utf8_solid(value font, value text, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderUTF8_Solid(SDL_FONT(font),String_val(text), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_utf8_shaded(value font, value text, value fg, value bg) { SDL_Color sfg; SDL_Color sbg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); SDLColor_of_value(&sbg, bg); surf = TTF_RenderUTF8_Shaded(SDL_FONT(font),String_val(text), sfg, sbg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } CAMLprim value sdlttf_render_utf8_blended(value font, value text, value fg) { SDL_Color sfg; SDL_Surface *surf; SDLColor_of_value(&sfg, fg); surf = TTF_RenderUTF8_Blended(SDL_FONT(font),String_val(text), sfg); SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); if (surf == NULL) { sdlttf_raise_exception(TTF_GetError()); } return ML_SURFACE(surf); } ocamlsdl-0.9.1/src/sdlvideo_flag.c0000664000076400007640000000125707531772343015612 0ustar olivoliv/* video_flag : conversion table */ lookup_info ml_table_video_flag[] = { { 0, 16 }, { MLTAG_NOFRAME, SDL_NOFRAME }, { MLTAG_SRCALPHA, SDL_SRCALPHA }, { MLTAG_DOUBLEBUF, SDL_DOUBLEBUF }, { MLTAG_OPENGL, SDL_OPENGL }, { MLTAG_RLEACCEL, SDL_RLEACCEL }, { MLTAG_PREALLOC, SDL_PREALLOC }, { MLTAG_FULLSCREEN, SDL_FULLSCREEN }, { MLTAG_SRCCOLORKEY, SDL_SRCCOLORKEY }, { MLTAG_ASYNCBLIT, SDL_ASYNCBLIT }, { MLTAG_HWACCEL, SDL_HWACCEL }, { MLTAG_HWSURFACE, SDL_HWSURFACE }, { MLTAG_ANYFORMAT, SDL_ANYFORMAT }, { MLTAG_RESIZABLE, SDL_RESIZABLE }, { MLTAG_OPENGLBLIT, SDL_OPENGLBLIT }, { MLTAG_HWPALETTE, SDL_HWPALETTE }, { MLTAG_SWSURFACE, SDL_SWSURFACE }, }; ocamlsdl-0.9.1/src/sdlvideo_stub.c0000664000076400007640000005067111561505641015653 0ustar olivoliv #include #include #include "common.h" #include "sdlvideo_stub.h" #include "sdlrwops_stub.h" #ifndef HAVE_INLINE extern SDL_Surface *SDL_SURFACE(value v) { struct ml_sdl_surf_data *cb_data; cb_data = (Tag_val(v) == 0) ? Data_custom_val(Field(v, 0)) : Data_custom_val(v); return cb_data->s; } extern void SDLColor_of_value(SDL_Color *c, value v) { c->r = Int_val(Field(v, 0)); c->g = Int_val(Field(v, 1)); c->b = Int_val(Field(v, 2)); } #endif /* ************************************************** */ /* memory management : custom blocks & co. */ /* ************************************************** */ static void ml_SDL_FreeSurface(value s) { struct ml_sdl_surf_data *cb_data; int call_finalizer = SDL_FALSE; cb_data = (Tag_val(s) == 0) ? Data_custom_val(Field(s, 0)) : Data_custom_val(s); if(cb_data->finalizer && cb_data->s->refcount == 1) call_finalizer = SDL_TRUE; if(cb_data->freeable) SDL_FreeSurface(cb_data->s); if(call_finalizer) cb_data->finalizer(cb_data->finalizer_data); } static int ml_SDL_surf_compare(value v1, value v2) { SDL_Surface *s1 = SDL_SURFACE(v1); SDL_Surface *s2 = SDL_SURFACE(v2); if(s1 == s2) return 0; if(s1 < s2) return -1; else return 1; } static struct custom_operations sdl_surface_ops = { "sdlsurface", &ml_SDL_FreeSurface, &ml_SDL_surf_compare, custom_hash_default, custom_serialize_default, custom_deserialize_default }; extern value Val_SDLSurface(SDL_Surface *surf, int freeable, value barr, sdl_finalizer finalizer, void *finalizer_data) { CAMLparam1(barr); CAMLlocal2(s, v); int used = surf->w * surf->h; struct ml_sdl_surf_data *cb_data; s = alloc_custom(&sdl_surface_ops, sizeof (*cb_data), used, 1000000); cb_data = Data_custom_val(s); cb_data->s = surf; cb_data->freeable = freeable; cb_data->finalizer = finalizer; cb_data->finalizer_data = finalizer_data; if(barr == Val_unit) CAMLreturn(s); else { v = alloc_small(2, 0); Field(v, 0) = s; Field(v, 1) = barr; CAMLreturn(v); } } /* * Error handling */ void sdlvideo_raise_exception (char *msg) { static value *video_exn = NULL; if(! video_exn) { video_exn = caml_named_value("SDLvideo2_exception"); if(! video_exn){ fprintf(stderr, "exception not registered."); abort(); } } raise_with_string(*video_exn, msg); } /* * some static conversion functions */ static value value_of_Rect(SDL_Rect r) { value v = alloc_small(4, 0); Field(v, 0) = Val_int(r.x); Field(v, 1) = Val_int(r.y); Field(v, 2) = Val_int(r.w); Field(v, 3) = Val_int(r.h); return v; } #ifndef HAVE_INLINE void SDLRect_of_value(SDL_Rect *r, value v) { r->x = Int_val(Field(v, 0)); r->y = Int_val(Field(v, 1)); r->w = Int_val(Field(v, 2)); r->h = Int_val(Field(v, 3)); } #endif static inline void update_value_from_SDLRect(value vr, SDL_Rect *r) { CAMLparam1(vr); Store_field(vr, 0, Val_int(r->x)); Store_field(vr, 1, Val_int(r->y)); Store_field(vr, 2, Val_int(r->w)); Store_field(vr, 3, Val_int(r->h)); CAMLreturn0; } static value value_of_PixelFormat(SDL_PixelFormat *fmt) { CAMLparam0(); CAMLlocal1(v); if( !fmt) abort(); v = alloc(17, 0); Store_field(v, 0, fmt->palette ? Val_true : Val_false); Store_field(v, 1, Val_int(fmt->BitsPerPixel)); Store_field(v, 2, Val_int(fmt->BytesPerPixel)); Store_field(v, 3, copy_int32(fmt->Rmask)); Store_field(v, 4, copy_int32(fmt->Gmask)); Store_field(v, 5, copy_int32(fmt->Bmask)); Store_field(v, 6, copy_int32(fmt->Amask)); Store_field(v, 7, Val_int(fmt->Rshift)); Store_field(v, 8, Val_int(fmt->Gshift)); Store_field(v, 9, Val_int(fmt->Bshift)); Store_field(v,10, Val_int(fmt->Ashift)); Store_field(v,11, Val_int(fmt->Rloss)); Store_field(v,12, Val_int(fmt->Gloss)); Store_field(v,13, Val_int(fmt->Bloss)); Store_field(v,14, Val_int(fmt->Aloss)); Store_field(v,15, copy_int32(fmt->colorkey)); Store_field(v,16, Val_int(fmt->alpha)); CAMLreturn(v); } /* video flags */ #include "sdlvideo_flag.h" #include "sdlvideo_flag.c" static Uint32 video_flag_val(value flag_list) { Uint32 flag = 0; value l = flag_list; while (is_not_nil(l)) { flag |= Video_flag_val(hd(l)); l = tl(l); } return flag; } static value val_video_flag(Uint32 flags) { value l = nil(); lookup_info *table = ml_table_video_flag; int i; for (i = table[0].data; i > 0; i--) { lookup_info f = table[i]; if (f.data != 0 && ((flags & f.data) == f.data)) l = mlsdl_cons(f.key, l); } /* special case for SDL_SWSURFACE because its value is 0 */ if ((flags & SDL_HWSURFACE) == 0) l = mlsdl_cons(MLTAG_SWSURFACE, l); return l; } /* * Palette stuff */ CAMLprim value ml_sdl_surface_use_palette(value s) { SDL_Surface *surf = SDL_SURFACE(s); return Val_bool(surf->format->palette != NULL); } CAMLprim value ml_sdl_palette_ncolors(value surf) { SDL_Surface *s = SDL_SURFACE(surf); SDL_Palette *p = s->format->palette; if(! p) invalid_argument("surface not palettized"); return Val_int(p->ncolors); } CAMLprim value ml_sdl_palette_get_color(value surf, value n) { SDL_Surface *s = SDL_SURFACE(surf); SDL_Palette *p = s->format->palette; SDL_Color c; int c_n = Int_val(n); value v; if(! p) invalid_argument("surface not palettized"); if(c_n < 0 || c_n >= p->ncolors) invalid_argument("out of bounds palette access"); c = p->colors[c_n]; v = alloc_small(3, 0); Field(v, 0) = Val_int(c.r); Field(v, 1) = Val_int(c.g); Field(v, 2) = Val_int(c.b); return v; } CAMLprim value ml_SDL_SetPalette(value surf, value flags, value ofirstcolor, value c_arr) { SDL_Surface *s = SDL_SURFACE(surf); SDL_Palette *p = s->format->palette; int firstcolor = Opt_arg(ofirstcolor, Int_val, 0); int c_flags; int n = Wosize_val(c_arr); int i, status; LOCALARRAY(SDL_Color, color, n); if(! p) invalid_argument("surface not palettized"); if(firstcolor + n > p->ncolors || firstcolor < 0) invalid_argument("out of bounds palette access"); for(i=0; i< n; i++) SDLColor_of_value(&color[i], Field(c_arr, i)); if(flags == Val_none) c_flags = SDL_LOGPAL | SDL_PHYSPAL ; else c_flags = Int_val(Unopt(flags)) +1 ; status = SDL_SetPalette(s, c_flags, color, firstcolor, n); return Val_bool(status); } /* * Video modes-related functions */ CAMLprim value ml_SDL_GetVideoInfo(value unit) { value result; const SDL_VideoInfo *info = SDL_GetVideoInfo(); result = alloc_small(10, 0); Field(result, 0) = Val_bool(info->hw_available); Field(result, 1) = Val_bool(info->wm_available); Field(result, 2) = Val_bool(info->blit_hw); Field(result, 3) = Val_bool(info->blit_hw_CC); Field(result, 4) = Val_bool(info->blit_hw_A); Field(result, 5) = Val_bool(info->blit_sw); Field(result, 6) = Val_bool(info->blit_sw_CC); Field(result, 7) = Val_bool(info->blit_sw_A); Field(result, 8) = Val_bool(info->blit_fill); Field(result, 9) = Val_int(info->video_mem); return result; } CAMLprim value ml_SDL_GetVideoInfo_format(value unit) { const SDL_VideoInfo *info = SDL_GetVideoInfo(); return value_of_PixelFormat(info->vfmt); } CAMLprim value ml_SDL_VideoDriverName(value unit) { char buff[64]; if(! SDL_VideoDriverName(buff, 64)) sdlvideo_raise_exception(SDL_GetError()); return copy_string(buff); } CAMLprim value ml_SDL_ListModes(value obpp, value flag_list) { Uint8 bpp = Opt_arg(obpp, Int_val, 0); SDL_Rect **modes; SDL_PixelFormat fmt; if(bpp){ fmt.BitsPerPixel = bpp; modes = SDL_ListModes(&fmt, video_flag_val(flag_list)); } else modes = SDL_ListModes(NULL, video_flag_val(flag_list)); if(modes == (SDL_Rect **)0) return Val_int(0); if(modes == (SDL_Rect **)-1) return Val_int(1); { CAMLparam0(); CAMLlocal3(v, l, r); register int i; l = nil(); for(i=0; modes[i]; i++){ r = alloc_small(2, 0); Field(r, 0) = Val_int(modes[i]->w); Field(r, 1) = Val_int(modes[i]->h); l = mlsdl_cons(r, l); } v = alloc_small(1, 0); Field(v, 0) = l; CAMLreturn(v); } } CAMLprim value ml_SDL_VideoModeOK(value w, value h, value bpp, value flags) { return Val_int(SDL_VideoModeOK(Int_val(w), Int_val(h), Int_val(bpp), video_flag_val(flags))); } CAMLprim value ml_sdl_surface_info(value s) { CAMLparam0(); CAMLlocal3(f, r, v); SDL_Surface *surf = SDL_SURFACE(s); if(! surf) sdlvideo_raise_exception("dead surface"); f = val_video_flag(surf->flags); r = value_of_Rect(surf->clip_rect); v = alloc_small(6, 0); Field(v, 0) = f; Field(v, 1) = Val_int(surf->w); Field(v, 2) = Val_int(surf->h); Field(v, 3) = Val_int(surf->pitch); Field(v, 4) = r; Field(v, 5) = Val_int(surf->refcount); CAMLreturn(v); } CAMLprim value ml_sdl_surface_info_format(value s) { SDL_Surface *surf = SDL_SURFACE(s); return value_of_PixelFormat(surf->format); } CAMLprim value ml_SDL_GetVideoSurface(value unit) { SDL_Surface *s = SDL_GetVideoSurface(); if( !s) sdlvideo_raise_exception(SDL_GetError()); return Val_SDLSurface(s, 0, Val_unit, NULL, NULL); } CAMLprim value ml_SDL_SetVideoMode(value w, value h, value obpp, value flags) { int bpp = Opt_arg(obpp, Int_val, 0); SDL_Surface *s = SDL_SetVideoMode(Int_val(w), Int_val(h), bpp, video_flag_val(flags)); if( !s) sdlvideo_raise_exception(SDL_GetError()); return Val_SDLSurface(s, 0, Val_unit, NULL, NULL); } CAMLprim value ml_SDL_UpdateRect(value orect, value screen) { SDL_Rect r = {0, 0, 0, 0}; if(orect != Val_none) SDLRect_of_value(&r, Unopt(orect)); SDL_UpdateRect(SDL_SURFACE(screen), r.x, r.y, r.w, r.h); return Val_unit; } CAMLprim value ml_SDL_UpdateRects(value rectl, value screen) { int len = mlsdl_list_length(rectl); register int i; LOCALARRAY(SDL_Rect, r, len); for(i=0; iformat, c.r, c.g, c.b); else p = SDL_MapRGBA(s->format, c.r, c.g, c.b, Int_val(Unopt(alpha)) ); return copy_int32(p); } CAMLprim value ml_SDL_GetRGB(value surf, value pixel) { Uint32 p = Int32_val(pixel); SDL_Surface *s = SDL_SURFACE(surf); Uint8 r,g,b; value v; SDL_GetRGB(p, s->format, &r, &g, &b); v = alloc_small(3, 0); Field(v, 0) = Val_int(r); Field(v, 1) = Val_int(g); Field(v, 2) = Val_int(b); return v; } CAMLprim value ml_SDL_GetRGBA(value surf, value pixel) { Uint32 p = Int32_val(pixel); SDL_Surface *s = SDL_SURFACE(surf); Uint8 r,g,b,a; SDL_GetRGBA(p, s->format, &r, &g, &b, &a); { CAMLparam0(); CAMLlocal2(c, v); c = alloc_small(3, 0); Field(c, 0) = Val_int(r); Field(c, 1) = Val_int(g); Field(c, 2) = Val_int(b); v = alloc_small(2, 0); Field(v, 0) = c; Field(v, 1) = Val_int(a); CAMLreturn(v); } } /* * Surface-related functions */ CAMLprim value ml_SDL_CreateRGBSurface(value videoflags, value w, value h, value depth, value rmask, value gmask, value bmask, value amask) { SDL_Surface *s = SDL_CreateRGBSurface(video_flag_val(videoflags), Int_val(w), Int_val(h), Int_val(depth), Int32_val(rmask), Int32_val(gmask), Int32_val(bmask), Int32_val(amask)); if(! s) sdlvideo_raise_exception(SDL_GetError()); return ML_SURFACE(s); } CAMLprim value ml_SDL_CreateRGBSurface_bc(value *argv, int argc) { return ml_SDL_CreateRGBSurface(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]); } CAMLprim value ml_SDL_CreateRGBSurface_format(value surf, value videoflags, value w, value h) { SDL_PixelFormat *fmt = SDL_SURFACE(surf)->format; SDL_Surface *s = SDL_CreateRGBSurface(video_flag_val(videoflags), Int_val(w), Int_val(h), fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask); if(! s) sdlvideo_raise_exception(SDL_GetError()); return ML_SURFACE(s); } CAMLprim value ml_SDL_CreateRGBSurfaceFrom(value pixels, value w, value h, value depth, value pitch, value rmask, value gmask, value bmask, value amask) { struct caml_bigarray *barr = Bigarray_val(pixels); SDL_Surface *s = SDL_CreateRGBSurfaceFrom(barr->data, Int_val(w), Int_val(h), Int_val(depth), Int_val(pitch), Int32_val(rmask), Int32_val(gmask), Int32_val(bmask), Int32_val(amask)) ; return Val_SDLSurface(s, 1, pixels, NULL, NULL); } CAMLprim value ml_SDL_CreateRGBSurfaceFrom_bc(value *argv, int argc) { return ml_SDL_CreateRGBSurfaceFrom(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]); } CAMLprim value ml_SDL_MustLock(value s) { return Val_bool(SDL_MUSTLOCK(SDL_SURFACE(s))); } CAMLprim value ml_SDL_LockSurface(value s) { if(SDL_LockSurface(SDL_SURFACE(s)) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } ML_1(SDL_UnlockSurface, SDL_SURFACE, Unit) /* * BMP images loader */ CAMLprim value ml_SDL_LoadBMP(value fname) { SDL_Surface *s = SDL_LoadBMP(String_val(fname)); if(! s) sdlvideo_raise_exception(SDL_GetError()); return ML_SURFACE(s); } CAMLprim value ml_SDL_SaveBMP(value surf, value fname) { if(SDL_SaveBMP(SDL_SURFACE(surf), String_val(fname)) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } CAMLprim value ml_SDL_LoadBMP_RW(value o_autoclose, value src) { int autoclose = Opt_arg(o_autoclose, Bool_val, SDL_TRUE); SDL_Surface *s = SDL_LoadBMP_RW(SDLRWops_val(src), autoclose); if(! s) sdlvideo_raise_exception(SDL_GetError()); return ML_SURFACE(s); } /* * colorkey / alpha / cliprect */ CAMLprim value ml_SDL_unset_color_key(value surf) { if(SDL_SetColorKey(SDL_SURFACE(surf), 0, 0) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } CAMLprim value ml_SDL_SetColorKey(value surf, value orle, value key) { Uint32 flags = SDL_SRCCOLORKEY; int rle = Opt_arg(orle, Bool_val, 0); if(rle) flags |= SDL_RLEACCEL; if(SDL_SetColorKey(SDL_SURFACE(surf), flags, Int32_val(key)) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } CAMLprim value ml_SDL_get_color_key(value s) { SDL_Surface *surf = SDL_SURFACE(s); return copy_int32(surf->format->colorkey); } CAMLprim value ml_SDL_unset_alpha(value surf) { if(SDL_SetAlpha(SDL_SURFACE(surf), 0, 0) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } CAMLprim value ml_SDL_SetAlpha(value surf, value orle, value alpha) { Uint32 flags = SDL_SRCALPHA; int rle = Opt_arg(orle, Bool_val, 0); if(rle) flags |= SDL_RLEACCEL; if(SDL_SetAlpha(SDL_SURFACE(surf), flags, Int_val(alpha)) < 0) sdlvideo_raise_exception(SDL_GetError()); return Val_unit; } CAMLprim value ml_SDL_get_alpha(value s) { SDL_Surface *surf = SDL_SURFACE(s); return Val_int(surf->format->alpha); } CAMLprim value ml_SDL_UnsetClipRect(value surf) { SDL_SetClipRect(SDL_SURFACE(surf), NULL); return Val_unit; } CAMLprim value ml_SDL_SetClipRect(value surf, value r) { SDL_Rect rect; SDLRect_of_value(&rect, r); return Val_bool(SDL_SetClipRect(SDL_SURFACE(surf), &rect)); } CAMLprim value ml_SDL_GetClipRect(value s) { SDL_Rect r; SDL_GetClipRect(SDL_SURFACE(s), &r); return value_of_Rect(r); } /* * surface blitting and conversion */ CAMLprim value ml_SDL_BlitSurface(value src_s, value osrc_r, value dst_s, value odst_r, value unit) { SDL_Rect tmp_src_r, tmp_dst_r, *src_r, *dst_r; if(osrc_r == Val_none) src_r = NULL; else { SDLRect_of_value(&tmp_src_r, Unopt(osrc_r)); src_r = &tmp_src_r; } if(odst_r == Val_none) dst_r = NULL; else { SDLRect_of_value(&tmp_dst_r, Unopt(odst_r)); dst_r = &tmp_dst_r; } if( SDL_BlitSurface(SDL_SURFACE(src_s), src_r, SDL_SURFACE(dst_s), dst_r) < 0) sdlvideo_raise_exception(SDL_GetError()); if(osrc_r != Val_none) update_value_from_SDLRect(Unopt(osrc_r), src_r); if(odst_r != Val_none) update_value_from_SDLRect(Unopt(odst_r), dst_r); return Val_unit; } CAMLprim value ml_SDL_FillRect(value odst_r, value dst_s, value pixel) { SDL_Rect tmp_r, *r; if(odst_r == Val_none) r = NULL; else { SDLRect_of_value(&tmp_r, Unopt(odst_r)); r = &tmp_r; } if( SDL_FillRect(SDL_SURFACE(dst_s), r, Int32_val(pixel)) < 0 ) sdlvideo_raise_exception(SDL_GetError()); if(odst_r != Val_none) update_value_from_SDLRect(Unopt(odst_r), r); return Val_unit; } CAMLprim value ml_SDL_DisplayFormat(value oalpha, value surf) { SDL_Surface *s; int alpha = Opt_arg(oalpha, Bool_val, 0); if(! alpha) s = SDL_DisplayFormat(SDL_SURFACE(surf)); else s = SDL_DisplayFormatAlpha(SDL_SURFACE(surf)); if(! s) sdlvideo_raise_exception(SDL_GetError()); return ML_SURFACE(s); } CAMLprim value ml_bigarray_pixels(value s, value mlBpp) { SDL_Surface *surf = SDL_SURFACE(s); Uint8 Bpp = Int_val(mlBpp); int b_flag = 0; long dim = surf->h; if(Bpp != 0 && Bpp != surf->format->BytesPerPixel) invalid_argument("wrong pixel format"); switch (Bpp) { case 0: case 1: /* 8 bpp */ dim *= surf->pitch; b_flag |= BIGARRAY_UINT8; break; case 2: /* 16 bpp */ dim *= surf->pitch / 2; b_flag |= BIGARRAY_UINT16; break; case 3: /* 24 bpp */ dim *= surf->pitch; b_flag |= BIGARRAY_UINT8; break; case 4: /* 32 bpp */ dim *= surf->pitch / 4; b_flag |= BIGARRAY_INT32; break; default: sdlvideo_raise_exception("unsupported"); } b_flag |= BIGARRAY_C_LAYOUT | BIGARRAY_EXTERNAL ; return alloc_bigarray(b_flag, 1, surf->pixels, &dim); } /* * get/put_pixel functions * stolen from http://sdldoc.csn.ul.ie/guidevideo.php */ Uint32 getpixel(SDL_Surface *surface, int x, int y) { int bpp = surface->format->BytesPerPixel; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: return *p; case 2: return *(Uint16 *)p; case 3: { unsigned int shift; Uint32 color=0; shift = surface->format->Rshift; color = *(p+shift/8)<format->Gshift; color|= *(p+shift/8)<format->Bshift; color|= *(p+shift/8)<format->Ashift; color|= *(p+shift/8)<format->BytesPerPixel; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: *p = pixel; break; case 2: *(Uint16 *)p = pixel; break; case 3: *(p+surface->format->Rshift/8) = pixel>>surface->format->Rshift; *(p+surface->format->Gshift/8) = pixel>>surface->format->Gshift; *(p+surface->format->Bshift/8) = pixel>>surface->format->Bshift; *(p+surface->format->Ashift/8) = pixel>>surface->format->Ashift; break; case 4: *(Uint32 *)p = pixel; break; } } CAMLprim value ml_SDL_get_pixel(value surf, value x, value y) { SDL_Surface *s = SDL_SURFACE(surf); Uint32 pixel = getpixel(s, Int_val(x), Int_val(y)); return copy_int32(pixel); } CAMLprim value ml_SDL_get_pixel_color(value surf, value x, value y) { SDL_Surface *s = SDL_SURFACE(surf); Uint32 pixel = getpixel(s, Int_val(x), Int_val(y)); Uint8 r,g,b; value v; SDL_GetRGB(pixel, s->format, &r, &g, &b); v = alloc_small(3, 0); Field(v, 0) = Val_int(r); Field(v, 1) = Val_int(g); Field(v, 2) = Val_int(b); return v; } CAMLprim value ml_SDL_put_pixel(value surf, value x, value y, value pix) { SDL_Surface *s = SDL_SURFACE(surf); Uint32 pixel = Int32_val(pix); putpixel(s, Int_val(x), Int_val(y), pixel); return Val_unit; } CAMLprim value ml_SDL_put_pixel_color(value surf, value x, value y, value color) { SDL_Surface *s = SDL_SURFACE(surf); Uint32 pixel; SDL_Color c; SDLColor_of_value(&c, color); pixel = SDL_MapRGB(s->format, c.r, c.g, c.b); putpixel(s, Int_val(x), Int_val(y), pixel); return Val_unit; } ocamlsdl-0.9.1/src/sdlwm_stub.c0000664000076400007640000000177107755704436015202 0ustar olivoliv#include #include "common.h" #include "sdlvideo_stub.h" ML_2(SDL_WM_SetCaption, String_val, String_val, Unit) CAMLprim value ml_SDL_WM_GetCaption(value unit) { CAMLparam0(); CAMLlocal3(v, s1, s2); char *title, *icon; SDL_WM_GetCaption(&title, &icon); if(! title) title = ""; if(! icon) icon = "" ; s1 = copy_string(title); s2 = copy_string(icon); v = alloc_small(2, 0); Field(v, 0) = s1; Field(v, 1) = s2; CAMLreturn(v); } CAMLprim value ml_SDL_WM_SetIcon(value surf) { SDL_WM_SetIcon(SDL_SURFACE(surf), NULL); return Val_unit; } ML_0(SDL_WM_IconifyWindow, Val_bool) CAMLprim value ml_SDL_WM_ToggleFullScreen(value unit) { return Val_bool(SDL_WM_ToggleFullScreen(SDL_GetVideoSurface())); } CAMLprim value ml_SDL_WM_GrabInput(value grabmode) { SDL_GrabMode mode = Bool_val(grabmode) ? SDL_GRAB_ON : SDL_GRAB_OFF ; SDL_WM_GrabInput(mode); return Val_unit; } CAMLprim value ml_SDL_WM_GetGrabInput(value unit) { return Val_bool(SDL_WM_GrabInput(SDL_GRAB_QUERY)); } ocamlsdl-0.9.1/src/sdlinit_flag.h0000664000076400007640000000105507521731237015444 0ustar olivoliv/* init_flag : tags and macros */ #define MLTAG_TIMER Val_int(237238181) #define MLTAG_AUDIO Val_int(628011190) #define MLTAG_VIDEO Val_int(887770203) #define MLTAG_CDROM Val_int(-1056317969) #define MLTAG_JOYSTICK Val_int(-176721732) #define MLTAG_NOPARACHUTE Val_int(516093760) #define MLTAG_EVENTTHREAD Val_int(61759044) #define MLTAG_EVERYTHING Val_int(283065971) extern lookup_info ml_table_init_flag[]; #define Val_init_flag(data) mlsdl_lookup_from_c (ml_table_init_flag, data) #define Init_flag_val(key) mlsdl_lookup_to_c (ml_table_init_flag, key) ocamlsdl-0.9.1/src/sdlmouse_stub.h0000664000076400007640000000006007530770756015701 0ustar olivoliv value value_of_mousebutton_state(Uint8 state); ocamlsdl-0.9.1/src/sdlrwops_stub.h0000664000076400007640000000014607626521317015721 0ustar olivoliv #define SDLRWops_val(v) ((SDL_RWops *)(Field((v), 0))) enum mlsdl_rwops_tag { MLSDL_RWOPS_MEM, }; ocamlsdl-0.9.1/src/sdlvideo_flag.h0000664000076400007640000000162707531772343015620 0ustar olivoliv/* video_flag : tags and macros */ #define MLTAG_SWSURFACE Val_int(830934505) #define MLTAG_HWSURFACE Val_int(556239582) #define MLTAG_ASYNCBLIT Val_int(-14289583) #define MLTAG_ANYFORMAT Val_int(565310211) #define MLTAG_HWPALETTE Val_int(809613100) #define MLTAG_DOUBLEBUF Val_int(-786331486) #define MLTAG_FULLSCREEN Val_int(-339890629) #define MLTAG_OPENGL Val_int(-736685969) #define MLTAG_OPENGLBLIT Val_int(708015140) #define MLTAG_RESIZABLE Val_int(615032651) #define MLTAG_NOFRAME Val_int(-970104788) #define MLTAG_HWACCEL Val_int(345890393) #define MLTAG_SRCCOLORKEY Val_int(-122876192) #define MLTAG_RLEACCEL Val_int(-626014051) #define MLTAG_SRCALPHA Val_int(-961997318) #define MLTAG_PREALLOC Val_int(-406489742) extern lookup_info ml_table_video_flag[]; #define Val_video_flag(data) mlsdl_lookup_from_c (ml_table_video_flag, data) #define Video_flag_val(key) mlsdl_lookup_to_c (ml_table_video_flag, key) ocamlsdl-0.9.1/src/sdlvideo_stub.h0000664000076400007640000000227310225746431015653 0ustar olivoliv#include "config.h" typedef void (*sdl_finalizer)(void *); extern value Val_SDLSurface(SDL_Surface *s, int freeable, value barr, sdl_finalizer finalizer, void* finalizer_data); #define ML_SURFACE(s) Val_SDLSurface((s), 1, Val_unit, NULL, NULL) struct ml_sdl_surf_data { SDL_Surface *s ; int freeable; sdl_finalizer finalizer; void *finalizer_data; }; #ifndef HAVE_INLINE extern SDL_Surface *SDL_SURFACE(value v); #else static inline SDL_Surface *SDL_SURFACE(value v) { struct ml_sdl_surf_data *cb_data; cb_data = (Tag_val(v) == 0) ? Data_custom_val(Field(v, 0)) : Data_custom_val(v); return cb_data->s; } #endif #ifndef HAVE_INLINE extern void SDLColor_of_value(SDL_Color *c, value v); #else static inline void SDLColor_of_value(SDL_Color *c, value v) { c->r = Int_val(Field(v, 0)); c->g = Int_val(Field(v, 1)); c->b = Int_val(Field(v, 2)); } #endif #ifndef HAVE_INLINE extern void SDLRect_of_value(SDL_Rect *r, value v); #else static inline void SDLRect_of_value(SDL_Rect *r, value v) { r->x = Int_val(Field(v, 0)); r->y = Int_val(Field(v, 1)); r->w = Int_val(Field(v, 2)); r->h = Int_val(Field(v, 3)); } #endif void sdlvideo_raise_exception (char *) Noreturn; ocamlsdl-0.9.1/src/common.c0000664000076400007640000000456711363134623014276 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: common.c,v 1.11 2010/04/19 20:14:11 oliv__a Exp $ */ #include #include #include #include #include "common.h" /* Caml list manipulations Grabbed in ocamlsdl-0.3/sdl_stub.c 1.8 (2000/09/25) made by Jean-Christophe FILLIATRE */ value mlsdl_cons(value x,value l) { CAMLparam2(x,l); CAMLlocal1(m); m=alloc_small(2,Tag_cons); Field(m, 0)=x; Field(m, 1)=l; CAMLreturn (m); } int mlsdl_list_length(value l) { int len = 0; while(is_not_nil(l)){ len++; l = tl(l); } return len; } /* Polymorphic variants <-> C ints conversion taken from LablGTK */ value mlsdl_lookup_from_c (lookup_info *table, int data) { int i; for (i = table[0].data; i > 0; i--) if (table[i].data == data) return table[i].key; invalid_argument ("ml_lookup_from_c"); } int mlsdl_lookup_to_c (lookup_info *table, value key) { int first = 1, last = table[0].data, current; while (first < last) { current = (first+last)/2; if (table[current].key >= key) last = current; else first = current + 1; } if (table[first].key == key) return table[first].data; invalid_argument ("ml_lookup_to_c"); } /* Wrapping of malloc'ed C pointers in Abstract blocks. */ value abstract_ptr(void *p) { value v = alloc_small(1, Abstract_tag); Field(v, 0) = Val_bp(p); return v; } void nullify_abstract(value v) { void **p = (void **) v; *p = NULL; } value Val_some(value v) { CAMLparam1(v); CAMLlocal1(r); r = alloc_small(1, 0); Field(r, 0) = v; CAMLreturn(r); } ocamlsdl-0.9.1/src/common.h0000664000076400007640000000631711363134623014276 0ustar olivoliv/* * OCamlSDL - An ML interface to the SDL library * Copyright (C) 1999 Frederic Brunel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: common.h,v 1.17 2010/04/19 20:14:11 oliv__a Exp $ */ #ifndef _COMMON_H_ #define _COMMON_H_ #include "config.h" #include #include #include #include #include #include #include #define UString_val(v) ((unsigned char *) Bp_val(v)) /* Caml list manipulations Grabbed in ocamlsdl-0.3/sdl_stub.c 1.8 (2000/09/25) made by Jean-Christophe FILLIATRE */ #define nil() Val_emptylist extern value mlsdl_cons(value x,value l); #define is_nil Is_long #define is_not_nil Is_block #define hd(v) Field((v), 0) #define tl(v) Field((v), 1) extern int mlsdl_list_length(value l); /* Polymorphic variants <-> C ints conversion taken from LablGTK */ typedef struct { value key; int data; } lookup_info; value mlsdl_lookup_from_c (lookup_info *table, int data); int mlsdl_lookup_to_c (lookup_info *table, value key); /* Wrapping of malloc'ed C pointers in Abstract blocks. */ extern value abstract_ptr(void *); extern void nullify_abstract(value); /* Optional arguments */ #define Val_none Val_unit extern value Val_some(value v); #define Unopt(v) Field((v), 0) #define Opt_arg(v, conv, def) (Is_block(v) ? conv(Field((v),0)) : (def)) /* * convenient wrappers (stolen from LablGTK) */ #define Unit(x) ((x), Val_unit) #define ML_0(cname, conv) \ CAMLprim value ml_##cname (value unit) { return conv (cname ()); } #define ML_1(cname, conv1, conv) \ CAMLprim value ml_##cname (value arg1) { return conv (cname (conv1 (arg1))); } #define ML_1_name(mlname, cname, conv1, conv) \ CAMLprim value mlname (value arg1) { return conv (cname (conv1 (arg1))); } #define ML_2(cname, conv1, conv2, conv) \ CAMLprim value ml_##cname (value arg1, value arg2) { return conv (cname (conv1 (arg1), conv2 (arg2))); } #define Unsupported(cname) \ CAMLprim value ml_##cname() { failwith("not implemented"); return Val_unit; } /* * MT stuff */ void enter_blocking_section(void); void leave_blocking_section(void); /* * VLA / alloca stuff */ #ifdef __GNUC__ # define LOCALARRAY(type, x, len) type x [(len)] #else # ifdef HAVE_ALLOCA # ifdef HAVE_ALLOCA_H # include # else # ifdef WIN32 # include # endif # endif # define LOCALARRAY(type, x, len) type *x = (type *) alloca(sizeof (type) * (len)) # else # error "no alloca available" # endif #endif #endif /* _COMMON_H_ */ ocamlsdl-0.9.1/src/mlsdl_main.c0000664000076400007640000000703107575743027015130 0ustar olivoliv/* Init stuff for windows */ #include #include #include #include #ifdef WIN32 #include #endif #include /* For _alloca() */ #include #include /* for caml_main */ /* Parse a command line buffer into arguments */ static int ParseCommandLine(char *cmdline, char **argv) { char *bufp; int argc; argc = 0; for ( bufp = cmdline; *bufp; ) { /* Skip leading whitespace */ while ( isspace(*bufp) ) { ++bufp; } /* Skip over argument */ if ( *bufp == '"' ) { ++bufp; if ( *bufp ) { if ( argv ) { argv[argc] = bufp; } ++argc; } /* Skip over word */ while ( *bufp && (*bufp != '"') ) { ++bufp; } } else { if ( *bufp ) { if ( argv ) { argv[argc] = bufp; } ++argc; } /* Skip over word */ while ( *bufp && ! isspace(*bufp) ) { ++bufp; } } if ( *bufp ) { if ( argv ) { *bufp = '\0'; } ++bufp; } } if ( argv ) { argv[argc] = NULL; } return(argc); } /* Show an error message */ static void ShowError(const char *title, const char *message) { /* If USE_MESSAGEBOX is defined, you need to link with user32.lib */ #ifdef USE_MESSAGEBOX MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK); #else fprintf(stderr, "%s: %s\n", title, message); #endif } /* Pop up an out of memory message, returns to Windows */ static BOOL OutOfMemory(void) { ShowError("Fatal Error", "Out of memory - aborting"); return FALSE; } /* This is where execution begins [console apps] */ int console_main(int argc, char *argv[]) { int n; char *bufp, *appname; /* Get the class name from argv[0] */ appname = argv[0]; if ( (bufp=strrchr(argv[0], '\\')) != NULL ) { appname = bufp+1; } else if ( (bufp=strrchr(argv[0], '/')) != NULL ) { appname = bufp+1; } if ( (bufp=strrchr(appname, '.')) == NULL ) n = strlen(appname); else n = (bufp-appname); bufp = (char *)alloca(n+1); if ( bufp == NULL ) { return OutOfMemory(); } strncpy(bufp, appname, n); bufp[n] = '\0'; appname = bufp; /* Load SDL dynamic link library */ if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) { ShowError("WinMain() error", SDL_GetError()); return(FALSE); } /* atexit(cleanup_output); */ atexit(SDL_Quit); SDL_SetModuleHandle(GetModuleHandle(NULL)); /* Run the application main() code */ caml_main(argv); exit(0); /* Hush little compiler, don't you cry... */ return 0; } int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) { HINSTANCE handle; char **argv; int argc; char *cmdline; char *bufp; /* Start up DDHELP.EXE before opening any files, so DDHELP doesn't keep them open. This is a hack.. hopefully it will be fixed someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded. */ /* handle = LoadLibrary(TEXT("DDRAW.DLL")); if ( handle != NULL ) { FreeLibrary(handle); } */ /* Grab the command line (use alloca() on Windows) */ bufp = GetCommandLine(); cmdline = (char *)alloca(strlen(bufp)+1); if ( cmdline == NULL ) { return OutOfMemory(); } strcpy(cmdline, bufp); /* Parse it into argv and argc */ argc = ParseCommandLine(cmdline, NULL); argv = (char **)alloca((argc+1)*(sizeof *argv)); if ( argv == NULL ) { return OutOfMemory(); } ParseCommandLine(cmdline, argv); /* Run the main program (after a little SDL initialization) */ return(console_main(argc, argv)); } ocamlsdl-0.9.1/src/config.h.in0000664000076400007640000000034110674273567014666 0ustar olivoliv/* config.h file for ocamlsdl */ #undef HAVE_INLINE #undef inline #undef HAVE_SDL_MIXER_H #undef HAVE_SDL_TTF_H #define OCAMLSDL_TTF_VERSION 200 #define OCAMLSDL_IMAGE_VERSION 120 #undef HAVE_ALLOCA_H #undef HAVE_ALLOCA ocamlsdl-0.9.1/src/config.h.msvc0000664000076400007640000000037110674273567015233 0ustar olivoliv/* config.h file for ocamlsdl, MSVC */ #define HAVE_INLINE #define inline __inline #define HAVE_SDL_MIXER_H 1 #define HAVE_SDL_TTF_H 1 #define OCAMLSDL_TTF_VERSION 206 #define OCAMLSDL_IMAGE_VERSION 121 #undef HAVE_ALLOCA_H #define HAVE_ALLOCA 1 ocamlsdl-0.9.1/src/Makefile0000664000076400007640000001036711363134330014270 0ustar olivolivinclude ../makefile.platform include ../makefile.config.$(OCAML_C_BACKEND) include ../makefile.rules OMLFLAGS = -unsafe MLFLAGS = -g sdl_MODULES = sdl sdlcdrom sdltimer sdljoystick \ sdlkey sdlmouse sdlevent sdlvideo sdlwm \ $(if $(LABLGLDIR),sdlgl) sdl_C_SRC = common.c sdlrwops_stub.c loader_MODULES = sdlloader mixer_MODULES = sdlmixer ttf_MODULES = sdlttf gfx_MODULES = sdlgfx TARGETS = sdl.cma $(patsubst %,sdl%.cma,$(PARTS)) TARGETS += libsdlstub.$(A) $(patsubst %,libsdl%stub.$(A),$(PARTS)) ifdef OCAMLOPT TARGETS += sdl.cmxa $(patsubst %,sdl%.cmxa,$(PARTS)) endif all : $(TARGETS) sdl.cma : $(call ML_OBJS,sdl) $(call MKCMA,sdl,sdlstub,$^,$(SDL_LIBS)) sdl.cmxa : $(call ML_OPT_OBJS,sdl) $(call MKCMXA,sdl,sdlstub,$^,$(SDL_LIBS)) libsdlstub.$(A) dllsdlstub.so : $(call STUB_OBJS,sdl) $(call MKCLIB,sdl,sdlstub,$^,$(SDL_LIBS)) sdlloader.cma : $(call ML_OBJS,loader) $(call MKCMA,sdlloader,sdlloaderstub,$^,$(call SYSLIB,SDL_image)) sdlloader.cmxa : $(call ML_OPT_OBJS,loader) $(call MKCMXA,sdlloader,sdlloaderstub,$^,$(call SYSLIB,SDL_image)) libsdlloaderstub.$(A) dllsdlloaderstub.so : $(call STUB_OBJS,loader) $(call MKCLIB,sdlloader,sdlloaderstub,$^,$(call SYSLIB,SDL_image)) sdlmixer.cma : $(call ML_OBJS,mixer) $(call MKCMA,sdlmixer,sdlmixerstub,$^,$(call SYSLIB,SDL_mixer)) sdlmixer.cmxa : $(call ML_OPT_OBJS,mixer) $(call MKCMXA,sdlmixer,sdlmixerstub,$^,$(call SYSLIB,SDL_mixer)) libsdlmixerstub.$(A) dllsdlmixerstub.so : $(call STUB_OBJS,mixer) $(call MKCLIB,sdlmixer,sdlmixerstub,$^,$(call SYSLIB,SDL_mixer)) sdlttf.cma : $(call ML_OBJS,ttf) $(call MKCMA,sdlttf,sdlttfstub,$^,$(call SYSLIB,SDL_ttf)) sdlttf.cmxa : $(call ML_OPT_OBJS,ttf) $(call MKCMXA,sdlttf,sdlttfstub,$^,$(call SYSLIB,SDL_ttf)) libsdlttfstub.$(A) dllsdlttfstub.so : $(call STUB_OBJS,ttf) $(call MKCLIB,sdlttf,sdlttfstub,$^,$(call SYSLIB,SDL_ttf)) sdlgfx.cma : $(call ML_OBJS,gfx) $(call MKCMA,sdlgfx,sdlgfxstub,$^,$(call SYSLIB,SDL_gfx)) sdlgfx.cmxa : $(call ML_OPT_OBJS,gfx) $(call MKCMXA,sdlgfx,sdlgfxstub,$^,$(call SYSLIB,SDL_gfx)) libsdlgfxstub.$(A) dllsdlgfxstub.so : $(call STUB_OBJS,gfx) $(call MKCLIB,sdlgfx,sdlgfxstub,$^,$(call SYSLIB,SDL_gfx)) LABLGLINC = $(if $(LABLGLDIR),-I $(LABLGLDIR)) sdlgl.cm% : MLINC=$(LABLGLINC) ifdef INSTALL INSTALL_DIR = $(DESTDIR)$(OCAMLSDLDIR) INSTALL_TARGETS = $(if $(OCAMLFIND), \ install-findlib, \ install-byte $(if $(OCAMLOPT),install-opt) $(if $(OCAMLMKLIB),install-dll)) install : all $(INSTALL_TARGETS) install-byte: $(INSTALL) -d $(INSTALL_DIR) $(INSTALL_DATA) *.cma lib*.$(A) *.cmi *.mli $(INSTALL_DIR) ifeq ($(PLATFORM),Apple) $(RANLIB) $(INSTALL_DIR)/lib*.$(A) endif install-opt: $(INSTALL_DATA) *.cmxa sdl*.$(A) *.cmx $(INSTALL_DIR) ifeq ($(PLATFORM),Apple) $(RANLIB) $(INSTALL_DIR)/sdl*.$(A) endif install-dll: $(INSTALL) -d $(DESTDIR)$(OCAMLLIBDIR)/stublibs $(INSTALL) dll*.so $(DESTDIR)$(OCAMLLIBDIR)/stublibs ifdef OCAMLFIND install-findlib : $(OCAMLFIND) install sdl ../META \ *.cma lib*.$(A) *.cmi *.mli \ $(if $(OCAMLOPT),*.cmxa sdl*.$(A) *.cmx) \ $(if $(OCAMLMKLIB),dll*.so) ifeq ($(PLATFORM),Apple) $(RANLIB) $$($(OCAMLFIND) printconf destdir)/sdl/*.$(A) endif else install-findlib : ; $(error "findlib is not installed") endif .PHONY : install install-byte install-opt install-dll install-findlib endif ifdef OCAMLDOC MLI = $(foreach part,sdl $(PARTS),$(patsubst %.ml,%.mli,$(call ML_SRCS,$(part)))) CMI = $(patsubst %.mli,%.cmi,$(MLI)) doc : ../doc/html/index.html ../doc/ocamlsdl.texi ../doc/html/index.html : $(CMI) mkdir -p ../doc/html $(OCAMLDOC) -d ../doc/html -html -v -t 'OCamlSDL $(VERSION)' $(LABLGLINC) $(MLI) ../doc/ocamlsdl.texi : $(CMI) mkdir -p ../doc $(OCAMLDOC) -d ../doc -texi -v -o $@ -t 'OCamlSDL $(VERSION)' $(LABLGLINC) $(MLI) else doc : ; $(error "you need ocamldoc to generate the documentation") endif clean: rm -f *.cm* *.$(OBJEXT) *.$(A) *.so *.do depend: .depend .depend.c .depend: $(wildcard *.ml *.mli) @echo "making deps..." @$(OCAMLDEP) $^ > $@ -include .depend ifeq ($(OCAML_C_BACKEND),gcc) .depend_c : $(wildcard *.c) @echo "making C deps..." @$(CC) $(patsubst -I%,-isystem %,$(CPPFLAGS)) -isystem $(OCAMLLIBDIR) -MM $^ > $@ -include .depend_c else include .depend_c endif .PHONY: all doc clean depend ocamlsdl-0.9.1/src/.depend0000664000076400007640000000233211774640142014072 0ustar olivolivsdljoystick.cmo: sdljoystick.cmi sdljoystick.cmx: sdljoystick.cmi sdlcdrom.cmo: sdlcdrom.cmi sdlcdrom.cmx: sdlcdrom.cmi sdlmixer.cmo: sdl.cmi sdlmixer.cmi sdlmixer.cmx: sdl.cmx sdlmixer.cmi sdlvideo.cmo: sdl.cmi sdlvideo.cmi sdlvideo.cmx: sdl.cmx sdlvideo.cmi sdlloader.cmo: sdlvideo.cmi sdl.cmi sdlloader.cmi sdlloader.cmx: sdlvideo.cmx sdl.cmx sdlloader.cmi sdl.cmo: sdl.cmi sdl.cmx: sdl.cmi sdltimer.cmo: sdltimer.cmi sdltimer.cmx: sdltimer.cmi sdlttf.cmo: sdlvideo.cmi sdlttf.cmi sdlttf.cmx: sdlvideo.cmx sdlttf.cmi sdlmouse.cmo: sdlmouse.cmi sdlmouse.cmx: sdlmouse.cmi sdlgl.cmo: sdlvideo.cmi sdlgl.cmi sdlgl.cmx: sdlvideo.cmx sdlgl.cmi sdlkey.cmo: sdlkey.cmi sdlkey.cmx: sdlkey.cmi sdlgfx.cmo: sdlvideo.cmi sdlgfx.cmi sdlgfx.cmx: sdlvideo.cmx sdlgfx.cmi sdlevent.cmo: sdlmouse.cmi sdlkey.cmi sdljoystick.cmi sdlevent.cmi sdlevent.cmx: sdlmouse.cmx sdlkey.cmx sdljoystick.cmx sdlevent.cmi sdlwm.cmo: sdlvideo.cmi sdlwm.cmi sdlwm.cmx: sdlvideo.cmx sdlwm.cmi sdlkey.cmi: sdlmouse.cmi: sdl.cmi: sdlttf.cmi: sdlvideo.cmi sdlevent.cmi: sdlmouse.cmi sdlkey.cmi sdljoystick.cmi: sdlcdrom.cmi: sdlvideo.cmi: sdlloader.cmi: sdlvideo.cmi sdlgl.cmi: sdlvideo.cmi sdltimer.cmi: sdlwm.cmi: sdlvideo.cmi sdlgfx.cmi: sdlvideo.cmi sdlmixer.cmi: sdl.cmi ocamlsdl-0.9.1/src/.depend_c0000664000076400007640000000214711774643011014376 0ustar olivolivsdlwm_stub.o: sdlwm_stub.c common.h config.h sdlvideo_stub.h sdlkey_stub.o: sdlkey_stub.c common.h config.h common.o: common.c common.h config.h sdljoystick_stub.o: sdljoystick_stub.c common.h config.h sdlttf_stub.o: sdlttf_stub.c common.h config.h sdlvideo_stub.h sdlinit_flag.o: sdlinit_flag.c sdlevent_stub.o: sdlevent_stub.c common.h config.h sdlmouse_stub.h sdlvideo_stub.o: sdlvideo_stub.c common.h config.h sdlvideo_stub.h \ sdlrwops_stub.h sdlvideo_flag.h sdlvideo_flag.c sdlloader_stub.o: sdlloader_stub.c common.h config.h sdlvideo_stub.h \ sdlrwops_stub.h sdlgl_stub.o: sdlgl_stub.c common.h config.h sdlvideo_stub.h sdltimer_stub.o: sdltimer_stub.c common.h config.h sdlmouse_stub.o: sdlmouse_stub.c common.h config.h sdlmouse_stub.h sdlcdrom_stub.o: sdlcdrom_stub.c common.h config.h sdlgfx_stub.o: sdlgfx_stub.c common.h config.h sdlvideo_stub.h mlsdl_main.o: mlsdl_main.c sdl_stub.o: sdl_stub.c common.h config.h sdlinit_flag.h sdlinit_flag.c sdlvideo_flag.o: sdlvideo_flag.c sdlrwops_stub.o: sdlrwops_stub.c common.h config.h sdlrwops_stub.h sdlmixer_stub.o: sdlmixer_stub.c common.h config.h sdlrwops_stub.h ocamlsdl-0.9.1/doc/ocamlsdl.texi0000664000076400007640000023325711774643042015317 0ustar olivoliv\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename ocamlsdl.info @settitle OCamlSDL 0.9.1 @c %**end of header @defcodeindex va @defcodeindex ty @defcodeindex ex @defcodeindex mo @dircategory Objective Caml @direntry * OCamlSDL 0.9.1: (ocamlsdl). @end direntry @ifinfo This file was generated by Ocamldoc using the Texinfo generator. @end ifinfo @c no titlepage. @node Top, , , (dir) @top OCamlSDL 0.9.1 @ifinfo Documentation for OCamlSDL 0.9.1 @end ifinfo @menu * Sdl:: Module * Sdlcdrom:: Module * Sdltimer:: Module * Sdljoystick:: Module * Sdlkey:: Module * Sdlmouse:: Module * Sdlevent:: Module * Sdlvideo:: Module * Sdlwm:: Module * Sdlttf:: Module * Sdlloader:: Module * Sdlmixer:: Module * Sdlgfx:: Module Indices : * Types index:: * Exceptions index:: * Values index:: * Modules index:: @end menu @node Sdl, @chapter Module @code{Sdl} @moindex Sdl @section Description This module contains functions for initializing/quitting the library @section Interface @format @t{ @minus{} exception SDL_init_exception of string} @end format @exindex SDL_init_exception Exception for reporting errors during initialization @subsection Main functions @format @t{ @minus{} type subsystem = [ `AUDIO | `CDROM | `JOYSTICK | `TIMER | `VIDEO ] } @end format @tyindex subsystem Initialization flag type @format @t{ @minus{} val init : ?auto_clean:bool -> [< `AUDIO | `CDROM | `EVENTTHREAD | `EVERYTHING | `JOYSTICK | `NOPARACHUTE | `TIMER | `VIDEO ] list -> unit} @end format @vaindex init Initialize the SDL library. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize. @itemize @item `NOPARACHUTE : Don't catch fatal signals @item `EVENTTHREAD : Automatically pump events in a separate threads @item `EVERYTHING : initialize all subsystems @end itemize @format @t{ @minus{} val init_subsystem : subsystem list -> unit} @end format @vaindex init_subsystem @format @t{ @minus{} val was_init : unit -> subsystem list} @end format @vaindex was_init @format @t{ @minus{} val quit : unit -> unit} @end format @vaindex quit @code{quit} shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. @format @t{ @minus{} val quit_subsystem : subsystem list -> unit} @end format @vaindex quit_subsystem @subsection Versioning information @format @t{ @minus{} type version = @{ major : int ; minor : int ; patch : int ; @}} @end format @tyindex version @format @t{ @minus{} val version : unit -> version} @end format @vaindex version version of the SDL library @format @t{ @minus{} val string_of_version : version -> string} @end format @vaindex string_of_version @subsection Environment variables @format @t{ @minus{} val getenv : string -> string} @end format @vaindex getenv @format @t{ @minus{} val putenv : string -> string -> unit} @end format @vaindex putenv @node Sdlcdrom, @chapter Module @code{Sdlcdrom} @moindex Sdlcdrom @section Description This module provides CD-ROM handling @section Interface @format @t{ @minus{} exception SDLcdrom_exception of string} @end format @exindex SDLcdrom_exception Exception used to report errors @format @t{ @minus{} exception Trayempty} @end format @exindex Trayempty Exception to report that thre's no cd in the drive @subsection Types @format @t{ @minus{} type cdrom_drive } @end format @tyindex cdrom_drive abstract type for handling cdrom @format @t{ @minus{} type cdrom_drive_status = | CD_TRAYEMPTY (* cdrom drive is empty *) | CD_STOPPED (* cdrom drive is stopped *) | CD_PLAYING (* cdrom drive is playing *) | CD_PAUSED (* cdrom drive is paused *) } @end format @tyindex cdrom_drive_status enumeration of different status cdrom drive @format @t{ @minus{} type track_type = | TRACK_AUDIO (* audio track type *) | TRACK_DATA (* data track type *) } @end format @tyindex track_type the types of CD-ROM track possible @format @t{ @minus{} type track = @{ id : int ; kind : Sdlcdrom.track_type ; length : int ; offset : int ; @}} @end format @tyindex track @format @t{ @minus{} type cdrom_info = @{ num_tracks : int ; curr_track : int ; curr_frame : int ; tracks : Sdlcdrom.track array ; @}} @end format @tyindex cdrom_info @subsection General API An SDLcdrom_exception is raised on errors @format @t{ @minus{} val get_num_drives : unit -> int} @end format @vaindex get_num_drives @code{get_num_drives} returns the number of CD-ROM drives on the system @format @t{ @minus{} val drive_name : int -> string} @end format @vaindex drive_name @code{drive_name drive} returns a human-readable, system-dependent identifier for the CD-ROM. @code{drive} is the index of the drive. Drive indices start to 0 and end at @code{get_num_drives()-1}. @subsection CD-ROM drive handling @format @t{ @minus{} val cd_open : int -> cdrom_drive} @end format @vaindex cd_open @code{cd_open drive} open a CD-ROM drive for access @format @t{ @minus{} val cd_close : cdrom_drive -> unit} @end format @vaindex cd_close Closes the handle for the cdrom_drive @format @t{ @minus{} val cd_status : cdrom_drive -> cdrom_drive_status} @end format @vaindex cd_status @* @strong{Returns} the current status of the given drive. @format @t{ @minus{} val cd_info : cdrom_drive -> cdrom_info} @end format @vaindex cd_info @* @strong{Raises} @code{Trayempty} if there's no cd in the drive @* @strong{Returns} the table of contents of the CD and current play position @subsection Playing audio tracks @format @t{ @minus{} val msf_of_frames : int -> int * int * int} @end format @vaindex msf_of_frames @format @t{ @minus{} val frames_of_msf : int * int * int -> int} @end format @vaindex frames_of_msf @format @t{ @minus{} val cd_play_tracks : cdrom_drive -> start_track:int -> start_frame:int -> num_tracks:int -> num_frames:int -> unit} @end format @vaindex cd_play_tracks @code{cd_play_tracks cdrom_drive start_track start_frame num_tracks num_frames} play the given CD with these parameters @* @strong{Parameters} start_track: the starting track @* @strong{Parameters} start_frame: the starting frame @* @strong{Parameters} num_tracks: the number of tracks to play @* @strong{Parameters} num_frames: the number of frames to play @* @strong{Raises} @code{Trayempty} if there's no cd in the drive @format @t{ @minus{} val cd_play_track : cdrom_drive -> track -> unit} @end format @vaindex cd_play_track Play the track n on the given cdrom_drive @format @t{ @minus{} val cd_pause : cdrom_drive -> unit} @end format @vaindex cd_pause Pause play @format @t{ @minus{} val cd_resume : cdrom_drive -> unit} @end format @vaindex cd_resume Resume play @format @t{ @minus{} val cd_stop : cdrom_drive -> unit} @end format @vaindex cd_stop Stop play @format @t{ @minus{} val cd_eject : cdrom_drive -> unit} @end format @vaindex cd_eject Eject CD-ROM @node Sdltimer, @chapter Module @code{Sdltimer} @moindex Sdltimer @section Description Time-related functions @section Interface @format @t{ @minus{} val delay : int -> unit} @end format @vaindex delay Wait a specified number of milliseconds before returning @format @t{ @minus{} val get_ticks : unit -> int} @end format @vaindex get_ticks Get the number of milliseconds since the SDL library initialization. @node Sdljoystick, @chapter Module @code{Sdljoystick} @moindex Sdljoystick @section Description Module for SDL joystick event handling @section Interface In order to use these functions, Sdl.init must have been called with the `JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers. @format @t{ @minus{} exception SDLjoystick_exception of string} @end format @exindex SDLjoystick_exception exception for error reporting @format @t{ @minus{} type t } @end format @tyindex t The joystick abstract type used to identify an SDL joystick @format @t{ @minus{} val num_joysticks : unit -> int} @end format @vaindex num_joysticks Count the number of joysticks attached to the system @format @t{ @minus{} val name : int -> string} @end format @vaindex name Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. @format @t{ @minus{} val open_joystick : int -> t} @end format @vaindex open_joystick 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. @* @strong{Raises} @code{SDLjoystick_exception} if an error occurred @format @t{ @minus{} val opened : int -> bool} @end format @vaindex opened @* @strong{Returns} @code{true} if joystick has been opened @format @t{ @minus{} val index : t -> int} @end format @vaindex index Get the device index of an opened joystick @format @t{ @minus{} val num_axes : t -> int} @end format @vaindex num_axes Get the number of general axis controls on a joystick @format @t{ @minus{} val num_balls : t -> int} @end format @vaindex num_balls Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled. @format @t{ @minus{} val num_hats : t -> int} @end format @vaindex num_hats Get the number of POV hats on a joystick @format @t{ @minus{} val num_buttons : t -> int} @end format @vaindex num_buttons Get the number of buttons on a joystick @subsection Joystick state @format @t{ @minus{} val update : t -> unit} @end format @vaindex update Update the current state of the open joysticks. This is called automatically by the event loop if any joystick events are enabled. Enable/disable joystick event polling. If joystick events are disabled, you must call Sdljoystick.update yourself and check the state of the joystick when you want joystick information. @format @t{ @minus{} val set_event_state : bool -> unit} @end format @vaindex set_event_state @format @t{ @minus{} val get_event_state : unit -> bool} @end format @vaindex get_event_state @format @t{ @minus{} type hat_value = int } @end format @tyindex hat_value @format @t{ @minus{} val hat_centered : hat_value} @end format @vaindex hat_centered @format @t{ @minus{} val hat_up : hat_value} @end format @vaindex hat_up @format @t{ @minus{} val hat_right : hat_value} @end format @vaindex hat_right @format @t{ @minus{} val hat_down : hat_value} @end format @vaindex hat_down @format @t{ @minus{} val hat_left : hat_value} @end format @vaindex hat_left @format @t{ @minus{} val hat_rightup : hat_value} @end format @vaindex hat_rightup @format @t{ @minus{} val hat_rightdown : hat_value} @end format @vaindex hat_rightdown @format @t{ @minus{} val hat_leftup : hat_value} @end format @vaindex hat_leftup @format @t{ @minus{} val hat_leftdown : hat_value} @end format @vaindex hat_leftdown @format @t{ @minus{} val get_axis : t -> int -> int} @end format @vaindex get_axis @format @t{ @minus{} val get_hat : t -> int -> hat_value} @end format @vaindex get_hat @format @t{ @minus{} val get_ball : t -> int -> int * int} @end format @vaindex get_ball @format @t{ @minus{} val get_button : t -> int -> bool} @end format @vaindex get_button @format @t{ @minus{} val close : t -> unit} @end format @vaindex close Close a joystick previously opened with Sdljoystick.open_joystick @node Sdlkey, @chapter Module @code{Sdlkey} @moindex Sdlkey @section Description Keyboard handling and key symbols @section Interface @subsection Keysyms @format @t{ @minus{} type t = | KEY_UNKNOWN | KEY_BACKSPACE | KEY_TAB | KEY_CLEAR | KEY_RETURN | KEY_PAUSE | KEY_ESCAPE | KEY_SPACE | KEY_EXCLAIM | KEY_QUOTEDBL | KEY_HASH | KEY_DOLLAR | KEY_AMPERSAND | KEY_QUOTE | KEY_LEFTPAREN | KEY_RIGHTPAREN | KEY_ASTERISK | KEY_PLUS | KEY_COMMA | KEY_MINUS | KEY_PERIOD | KEY_SLASH | KEY_0 | KEY_1 | KEY_2 | KEY_3 | KEY_4 | KEY_5 | KEY_6 | KEY_7 | KEY_8 | KEY_9 | KEY_COLON | KEY_SEMICOLON | KEY_LESS | KEY_EQUALS | KEY_GREATER | KEY_QUESTION | KEY_AT (* Skip uppercase letters *) | KEY_LEFTBRACKET | KEY_BACKSLASH | KEY_RIGHTBRACKET | KEY_CARET | KEY_UNDERSCORE | KEY_BACKQUOTE | KEY_a | KEY_b | KEY_c | KEY_d | KEY_e | KEY_f | KEY_g | KEY_h | KEY_i | KEY_j | KEY_k | KEY_l | KEY_m | KEY_n | KEY_o | KEY_p | KEY_q | KEY_r | KEY_s | KEY_t | KEY_u | KEY_v | KEY_w | KEY_x | KEY_y | KEY_z | KEY_DELETE (* End of ASCII mapped keysyms *) | KEY_WORLD_0 (* International keyboard syms *) | KEY_WORLD_1 | KEY_WORLD_2 | KEY_WORLD_3 | KEY_WORLD_4 | KEY_WORLD_5 | KEY_WORLD_6 | KEY_WORLD_7 | KEY_WORLD_8 | KEY_WORLD_9 | KEY_WORLD_10 | KEY_WORLD_11 | KEY_WORLD_12 | KEY_WORLD_13 | KEY_WORLD_14 | KEY_WORLD_15 | KEY_WORLD_16 | KEY_WORLD_17 | KEY_WORLD_18 | KEY_WORLD_19 | KEY_WORLD_20 | KEY_WORLD_21 | KEY_WORLD_22 | KEY_WORLD_23 | KEY_WORLD_24 | KEY_WORLD_25 | KEY_WORLD_26 | KEY_WORLD_27 | KEY_WORLD_28 | KEY_WORLD_29 | KEY_WORLD_30 | KEY_WORLD_31 | KEY_WORLD_32 | KEY_WORLD_33 | KEY_WORLD_34 | KEY_WORLD_35 | KEY_WORLD_36 | KEY_WORLD_37 | KEY_WORLD_38 | KEY_WORLD_39 | KEY_WORLD_40 | KEY_WORLD_41 | KEY_WORLD_42 | KEY_WORLD_43 | KEY_WORLD_44 | KEY_WORLD_45 | KEY_WORLD_46 | KEY_WORLD_47 | KEY_WORLD_48 | KEY_WORLD_49 | KEY_WORLD_50 | KEY_WORLD_51 | KEY_WORLD_52 | KEY_WORLD_53 | KEY_WORLD_54 | KEY_WORLD_55 | KEY_WORLD_56 | KEY_WORLD_57 | KEY_WORLD_58 | KEY_WORLD_59 | KEY_WORLD_60 | KEY_WORLD_61 | KEY_WORLD_62 | KEY_WORLD_63 | KEY_WORLD_64 | KEY_WORLD_65 | KEY_WORLD_66 | KEY_WORLD_67 | KEY_WORLD_68 | KEY_WORLD_69 | KEY_WORLD_70 | KEY_WORLD_71 | KEY_WORLD_72 | KEY_WORLD_73 | KEY_WORLD_74 | KEY_WORLD_75 | KEY_WORLD_76 | KEY_WORLD_77 | KEY_WORLD_78 | KEY_WORLD_79 | KEY_WORLD_80 | KEY_WORLD_81 | KEY_WORLD_82 | KEY_WORLD_83 | KEY_WORLD_84 | KEY_WORLD_85 | KEY_WORLD_86 | KEY_WORLD_87 | KEY_WORLD_88 | KEY_WORLD_89 | KEY_WORLD_90 | KEY_WORLD_91 | KEY_WORLD_92 | KEY_WORLD_93 | KEY_WORLD_94 | KEY_WORLD_95 | KEY_KP0 (* Numeric keypad *) | KEY_KP1 | KEY_KP2 | KEY_KP3 | KEY_KP4 | KEY_KP5 | KEY_KP6 | KEY_KP7 | KEY_KP8 | KEY_KP9 | KEY_KP_PERIOD | KEY_KP_DIVIDE | KEY_KP_MULTIPLY | KEY_KP_MINUS | KEY_KP_PLUS | KEY_KP_ENTER | KEY_KP_EQUALS | KEY_UP (* Arrows + Home/End pad *) | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_INSERT | KEY_HOME | KEY_END | KEY_PAGEUP | KEY_PAGEDOWN | KEY_F1 (* Function keys *) | KEY_F2 | KEY_F3 | KEY_F4 | KEY_F5 | KEY_F6 | KEY_F7 | KEY_F8 | KEY_F9 | KEY_F10 | KEY_F11 | KEY_F12 | KEY_F13 | KEY_F14 | KEY_F15 | KEY_NUMLOCK (* Key state modifier keys *) | KEY_CAPSLOCK | KEY_SCROLLOCK | KEY_RSHIFT | KEY_LSHIFT | KEY_RCTRL | KEY_LCTRL | KEY_RALT | KEY_LALT | KEY_RMETA | KEY_LMETA | KEY_LSUPER (* Left "Windows" key *) | KEY_RSUPER (* Right "Windows" key *) | KEY_MODE (* "Alt Gr" key *) | KEY_COMPOSE (* Multi-key compose key *) | KEY_HELP (* Miscellaneous function keys *) | KEY_PRINT | KEY_SYSREQ | KEY_BREAK | KEY_MENU | KEY_POWER (* Power Macintosh power key *) | KEY_EURO (* Some european keyboards *) | KEY_UNDO (* Atari keyboard has Undo *) } @end format @tyindex t Concrete type describing keyboard keys ("keysym") @format @t{ @minus{} val int_of_key : t -> int} @end format @vaindex int_of_key get the SDL keysym of the key @format @t{ @minus{} val key_of_int : int -> t} @end format @vaindex key_of_int get the key corresponding to a SDL keysym @* @strong{Raises} @code{Invalid_arg} if not a valid SDL keysym @format @t{ @minus{} val char_of_key : t -> char} @end format @vaindex char_of_key Returns a (iso-8859-1) character corresponding to a key @* @strong{Raises} @code{Invalid_arg} if corresponding SDL keysym is > 255 @format @t{ @minus{} val num_keys : int} @end format @vaindex num_keys number of keys in the Sdlkey.t variant type : should be @code{232} @format @t{ @minus{} val max_code : int} @end format @vaindex max_code highest SDL keysym : should be @code{322} @format @t{ @minus{} val name : t -> string} @end format @vaindex name @* @strong{Returns} a short string describing the key @subsection Keyboard handling @format @t{ @minus{} val enable_unicode : bool -> unit} @end format @vaindex enable_unicode Enable unicode translation of keysyms for keyboard events @format @t{ @minus{} val query_unicode : unit -> bool} @end format @vaindex query_unicode @format @t{ @minus{} val disable_key_repeat : unit -> unit} @end format @vaindex disable_key_repeat Disable keyboard repeat @format @t{ @minus{} val enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit} @end format @vaindex enable_key_repeat Enable keyboard repeat @* @strong{Parameters} delay: initial delay in ms between the time when a key is pressed, and keyboard repeat begins @* @strong{Parameters} interval: the time in ms between keyboard repeat events @format @t{ @minus{} val get_key_state : unit -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex get_key_state Get a snapshot of the current state of the keyboard. @* @strong{Returns} an array of keystates, indexed by the SDL keysyms (cf Sdlkey.int_of_key) @format @t{ @minus{} val is_key_pressed : t -> bool} @end format @vaindex is_key_pressed Checks wether a key is currently pressed on the keyboard. @subsection Key modifiers @format @t{ @minus{} type mod_state = int } @end format @tyindex mod_state The following values are flags. Use with @code{land}, @code{lor}, etc. @format @t{ @minus{} val kmod_none : mod_state} @end format @vaindex kmod_none @format @t{ @minus{} val kmod_lshift : mod_state} @end format @vaindex kmod_lshift @format @t{ @minus{} val kmod_rshift : mod_state} @end format @vaindex kmod_rshift @format @t{ @minus{} val kmod_lctrl : mod_state} @end format @vaindex kmod_lctrl @format @t{ @minus{} val kmod_rctrl : mod_state} @end format @vaindex kmod_rctrl @format @t{ @minus{} val kmod_lalt : mod_state} @end format @vaindex kmod_lalt @format @t{ @minus{} val kmod_ralt : mod_state} @end format @vaindex kmod_ralt @format @t{ @minus{} val kmod_lmeta : mod_state} @end format @vaindex kmod_lmeta @format @t{ @minus{} val kmod_rmeta : mod_state} @end format @vaindex kmod_rmeta @format @t{ @minus{} val kmod_num : mod_state} @end format @vaindex kmod_num @format @t{ @minus{} val kmod_caps : mod_state} @end format @vaindex kmod_caps @format @t{ @minus{} val kmod_mode : mod_state} @end format @vaindex kmod_mode @format @t{ @minus{} val kmod_ctrl : mod_state} @end format @vaindex kmod_ctrl @format @t{ @minus{} val kmod_shift : mod_state} @end format @vaindex kmod_shift @format @t{ @minus{} val kmod_alt : mod_state} @end format @vaindex kmod_alt @format @t{ @minus{} val kmod_meta : mod_state} @end format @vaindex kmod_meta @format @t{ @minus{} val get_mod_state : unit -> mod_state} @end format @vaindex get_mod_state Get the current key modifier state @format @t{ @minus{} val set_mod_state : mod_state -> unit} @end format @vaindex set_mod_state Set the current key modifier state This does not change the keyboard state, only the key modifier flags. @node Sdlmouse, @chapter Module @code{Sdlmouse} @moindex Sdlmouse @section Description Mouse event handling and cursors @section Interface @subsection Mouse state @format @t{ @minus{} type button = | BUTTON_LEFT | BUTTON_MIDDLE | BUTTON_RIGHT | BUTTON_WHEELUP | BUTTON_WHEELDOWN | BUTTON_X of int (* BUTTON_X is only seen in a Sdlevent.mousebutton_event, it is not returned by Sdlmouse.get_state *) } @end format @tyindex button @format @t{ @minus{} val get_state : ?relative:bool -> unit -> int * int * button list} @end format @vaindex get_state Retrieve the current state of the mouse : current mouse position and list of pressed buttons @* @strong{Parameters} relative: if true returns mouse delta instead of position @format @t{ @minus{} val warp : int -> int -> unit} @end format @vaindex warp Set the position of the mouse cursor (generates a mouse motion event) @subsection Cursors @format @t{ @minus{} type cursor } @end format @tyindex cursor abstract type for cursors @format @t{ @minus{} type cursor_data = @{ data : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ; (* B/W cursor data *) mask : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ; (* B/W cursor mask *) w : int ; (* width in pixels *) h : int ; (* height in pixels *) hot_x : int ; (* the "tip" of the cursor *) hot_y : int ; (* the "tip" of the cursor *) @}} @end format @tyindex cursor_data @format @t{ @minus{} val make_cursor : data:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t -> mask:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t -> hot_x:int -> hot_y:int -> cursor} @end format @vaindex make_cursor Create a cursor using the specified data and mask (in MSB format). 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 Sdlmouse.free_cursor. @format @t{ @minus{} val free_cursor : cursor -> unit} @end format @vaindex free_cursor Deallocates a cursor. @format @t{ @minus{} val set_cursor : cursor -> unit} @end format @vaindex set_cursor Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display. @format @t{ @minus{} val get_cursor : unit -> cursor} @end format @vaindex get_cursor Returns the currently active cursor. @format @t{ @minus{} val cursor_visible : unit -> bool} @end format @vaindex cursor_visible Tests if cursor is shown on screen @format @t{ @minus{} val show_cursor : bool -> unit} @end format @vaindex show_cursor Toggle cursor display @format @t{ @minus{} val cursor_data : cursor -> cursor_data} @end format @vaindex cursor_data converts an abstract cursor value to concrete cursor data @format @t{ @minus{} val pprint_cursor : cursor -> unit} @end format @vaindex pprint_cursor for debugging : prints on stdout @format @t{ @minus{} val convert_to_cursor : data:int array -> mask:int array -> w:int -> h:int -> hot_x:int -> hot_y:int -> cursor} @end format @vaindex convert_to_cursor @node Sdlevent, @chapter Module @code{Sdlevent} @moindex Sdlevent @section Description SDL event handling @ifinfo @heading Subparts @end ifinfo @menu * Old: Sdlevent/Old. Module @end menu @section Interface @format @t{ @minus{} exception Event_exn of string} @end format @exindex Event_exn The exception used for reporting events-related errors. @subsection Application focus @format @t{ @minus{} type active_state = | MOUSEFOCUS (* The app has mouse coverage *) | INPUTFOCUS (* The app has input focus *) | APPACTIVE (* The application is active *) } @end format @tyindex active_state The available application states @format @t{ @minus{} val get_app_state : unit -> active_state list} @end format @vaindex get_app_state This function returns the current state of the application. If ACTIVE is set, then the user is able to see your application, otherwise it has been iconified or disabled. @subsection Events datatypes @format @t{ @minus{} type active_event = @{ gain : bool ; (* Whether given states were gained or lost *) ae_state : Sdlevent.active_state list ; (* A list of the focus states *) @}} @end format @tyindex active_event Application visibility event record @format @t{ @minus{} type switch_state = | RELEASED | PRESSED } @end format @tyindex switch_state @format @t{ @minus{} type keyboard_event = @{ ke_which : int ; (* The keyboard device index *) ke_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) keysym : Sdlkey.t ; (* SDL virtual keysym *) keymod : Sdlkey.mod_state ; (* current key modifiers *) keycode : char ; (* translated character *) unicode : int ; @}} @end format @tyindex keyboard_event Keyboard event record @format @t{ @minus{} type mousemotion_event = @{ mme_which : int ; (* The mouse device index *) mme_state : Sdlmouse.button list ; (* The current button state *) mme_x : int ; (* The X/Y coordinates of the mouse *) mme_y : int ; mme_xrel : int ; (* The relative motion in the X direction *) mme_yrel : int ; (* The relative motion in the Y direction *) @}} @end format @tyindex mousemotion_event Mouse motion event record @format @t{ @minus{} type mousebutton_event = @{ mbe_which : int ; (* The mouse device index *) mbe_button : Sdlmouse.button ; (* The mouse button index *) mbe_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) mbe_x : int ; (* The X/Y coordinates of the mouse at press time *) mbe_y : int ; @}} @end format @tyindex mousebutton_event Mouse button event record @format @t{ @minus{} type joyaxis_event = @{ jae_which : int ; (* The joystick device index *) jae_axis : int ; (* The joystick axis index *) jae_value : int ; (* The axis value (range: -32768 to 32767) *) @}} @end format @tyindex joyaxis_event Joystick axis motion event record @format @t{ @minus{} type joyball_event = @{ jle_which : int ; (* The joystick device index *) jle_ball : int ; (* The joystick trackball index *) jle_xrel : int ; (* The relative motion in the X direction *) jle_yrel : int ; (* The relative motion in the Y direction *) @}} @end format @tyindex joyball_event Joystick axis motion event record @format @t{ @minus{} type joyhat_event = @{ jhe_which : int ; (* The joystick device index *) jhe_hat : int ; (* The joystick hat index *) jhe_value : int ; (* The hat position value: 8 1 2 7 0 3 6 5 4 Note that zero means the POV is centered. *) @}} @end format @tyindex joyhat_event Joystick hat position change event record @format @t{ @minus{} type joybutton_event = @{ jbe_which : int ; (* The joystick device index *) jbe_button : int ; (* The joystick button index *) jbe_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) @}} @end format @tyindex joybutton_event Joystick button event record @format @t{ @minus{} type event = | ACTIVE of Sdlevent.active_event (* Application loses/gains visibility *) | KEYDOWN of Sdlevent.keyboard_event (* Keys pressed *) | KEYUP of Sdlevent.keyboard_event (* Keys released *) | MOUSEMOTION of Sdlevent.mousemotion_event (* Mouse moved *) | MOUSEBUTTONDOWN of Sdlevent.mousebutton_event (* Mouse button pressed *) | MOUSEBUTTONUP of Sdlevent.mousebutton_event (* Mouse button released *) | JOYAXISMOTION of Sdlevent.joyaxis_event (* Joystick axis motion *) | JOYBALLMOTION of Sdlevent.joyball_event (* Joystick trackball motion *) | JOYHATMOTION of Sdlevent.joyhat_event (* Joystick hat position change *) | JOYBUTTONDOWN of Sdlevent.joybutton_event (* Joystick button pressed *) | JOYBUTTONUP of Sdlevent.joybutton_event (* Joystick button released *) | QUIT (* User-requested quit *) | SYSWM (* System specific event *) | VIDEORESIZE of (int * int) (* User resized video mode *) | VIDEOEXPOSE (* Screen needs to be redrawn *) | USER of int (* for your use ! *) } @end format @tyindex event The main event type @format @t{ @minus{} val string_of_event : event -> string} @end format @vaindex string_of_event Returns a short string descriptive of the event type, for debugging @subsection Event masks @format @t{ @minus{} type event_mask = int } @end format @tyindex event_mask Event masks values are ints and should be manipulated with @code{lor}, @code{land}, etc. @format @t{ @minus{} val active_mask : event_mask} @end format @vaindex active_mask @format @t{ @minus{} val keydown_mask : event_mask} @end format @vaindex keydown_mask @format @t{ @minus{} val keyup_mask : event_mask} @end format @vaindex keyup_mask @format @t{ @minus{} val mousemotion_mask : event_mask} @end format @vaindex mousemotion_mask @format @t{ @minus{} val mousebuttondown_mask : event_mask} @end format @vaindex mousebuttondown_mask @format @t{ @minus{} val mousebuttonup_mask : event_mask} @end format @vaindex mousebuttonup_mask @format @t{ @minus{} val joyaxismotion_mask : event_mask} @end format @vaindex joyaxismotion_mask @format @t{ @minus{} val joyballmotion_mask : event_mask} @end format @vaindex joyballmotion_mask @format @t{ @minus{} val joyhatmotion_mask : event_mask} @end format @vaindex joyhatmotion_mask @format @t{ @minus{} val joybuttondown_mask : event_mask} @end format @vaindex joybuttondown_mask @format @t{ @minus{} val joybuttonup_mask : event_mask} @end format @vaindex joybuttonup_mask @format @t{ @minus{} val quit_mask : event_mask} @end format @vaindex quit_mask @format @t{ @minus{} val syswmevent_mask : event_mask} @end format @vaindex syswmevent_mask @format @t{ @minus{} val videoresize_mask : event_mask} @end format @vaindex videoresize_mask @format @t{ @minus{} val videoexpose_mask : event_mask} @end format @vaindex videoexpose_mask @format @t{ @minus{} val userevent_mask : event_mask} @end format @vaindex userevent_mask @format @t{ @minus{} val keyboard_event_mask : event_mask} @end format @vaindex keyboard_event_mask @format @t{ @minus{} val mouse_event_mask : event_mask} @end format @vaindex mouse_event_mask @format @t{ @minus{} val joystick_event_mask : event_mask} @end format @vaindex joystick_event_mask @format @t{ @minus{} val all_events_mask : event_mask} @end format @vaindex all_events_mask @format @t{ @minus{} type event_kind = | ACTIVE_EVENT | KEYDOWN_EVENT | KEYUP_EVENT | MOUSEMOTION_EVENT | MOUSEBUTTONDOWN_EVENT | MOUSEBUTTONUP_EVENT | JOYAXISMOTION_EVENT | JOYBALL_EVENT | JOYHAT_EVENT | JOYBUTTONDOWN_EVENT | JOYBUTTONUP_EVENT | QUIT_EVENT | SYSWM_EVENT | RESIZE_EVENT | EXPOSE_EVENT | USER_EVENT } @end format @tyindex event_kind @format @t{ @minus{} val make_mask : event_kind list -> event_mask} @end format @vaindex make_mask @format @t{ @minus{} val of_mask : event_mask -> event_kind list} @end format @vaindex of_mask @subsection Enabling/Disabling event collecting @format @t{ @minus{} val enable_events : event_mask -> unit} @end format @vaindex enable_events Specified events are collected and added to the event queue (when @code{pump} is called). @format @t{ @minus{} val disable_events : event_mask -> unit} @end format @vaindex disable_events Specified events are not collected and won't appear in the event queue. @format @t{ @minus{} val get_enabled_events : unit -> event_mask} @end format @vaindex get_enabled_events The mask of currently reported events. @format @t{ @minus{} val get_state : event_kind -> bool} @end format @vaindex get_state Query the reporting state of an event type. @format @t{ @minus{} val set_state : bool -> event_kind -> unit} @end format @vaindex set_state Set the reporting state of one individual event type. @subsection Handling events @format @t{ @minus{} val pump : unit -> unit} @end format @vaindex pump 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. @format @t{ @minus{} val wait_event : unit -> event} @end format @vaindex wait_event Wait indefinitely for the next available event and return it. @format @t{ @minus{} val wait : unit -> unit} @end format @vaindex wait Wait indefinitely for the next available event but leave it in the queue. @format @t{ @minus{} val poll : unit -> event option} @end format @vaindex poll Poll for currently pending events and return one if available. @format @t{ @minus{} val has_event : unit -> bool} @end format @vaindex has_event Poll for currently pending events and return @code{false} if the queue is empty. @format @t{ @minus{} val peek : ?mask:event_mask -> int -> event list} @end format @vaindex peek Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will not be removed from the queue. @format @t{ @minus{} val get : ?mask:event_mask -> int -> event list} @end format @vaindex get Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will be removed from the queue. @format @t{ @minus{} val add : event list -> unit} @end format @vaindex add Add events to the back of the event queue. @subsection Old event-handling interface @format @t{ @minus{} module Old} @end format @xref{Sdlevent/Old,Module Old}. Deprecated. this interface was used in version of ocamlsdl < 0.6 Callback-based event handling. @node Sdlevent/Old, @section Module @code{Sdlevent.Old} @moindex Old @subsection Description Deprecated. this interface was used in version of ocamlsdl < 0.6 Callback-based event handling. @subsection Interface @subsubsection Definition of the event callbacks @format @t{ @minus{} type keyboard_event_func = Sdlkey.t -> Sdlevent.switch_state -> int -> int -> unit } @end format @tyindex keyboard_event_func Keyboard event called with the activated key, its state and the coordinates of the mouse pointer @format @t{ @minus{} type mouse_event_func = Sdlmouse.button -> Sdlevent.switch_state -> int -> int -> unit } @end format @tyindex mouse_event_func Mouse button event called with the activated button, its state and the coordinates of the mouse pointer @format @t{ @minus{} type mousemotion_event_func = int -> int -> unit } @end format @tyindex mousemotion_event_func Mouse motion event called with the coordinates of the mouse pointer @format @t{ @minus{} type idle_event_func = unit -> unit } @end format @tyindex idle_event_func @format @t{ @minus{} type resize_event_func = int -> int -> unit } @end format @tyindex resize_event_func @subsubsection Functions for setting the current event callbacks @format @t{ @minus{} val set_keyboard_event_func : keyboard_event_func -> unit} @end format @vaindex set_keyboard_event_func @format @t{ @minus{} val set_mouse_event_func : mouse_event_func -> unit} @end format @vaindex set_mouse_event_func @format @t{ @minus{} val set_mousemotion_event_func : mousemotion_event_func -> unit} @end format @vaindex set_mousemotion_event_func @format @t{ @minus{} val set_idle_event_func : idle_event_func -> unit} @end format @vaindex set_idle_event_func @format @t{ @minus{} val set_resize_event_func : resize_event_func -> unit} @end format @vaindex set_resize_event_func @subsubsection Event loop @format @t{ @minus{} val start_event_loop : unit -> unit} @end format @vaindex start_event_loop @format @t{ @minus{} val exit_event_loop : unit -> unit} @end format @vaindex exit_event_loop @node Sdlvideo, @chapter Module @code{Sdlvideo} @moindex Sdlvideo @section Description Module for video manipulations @section Interface @format @t{ @minus{} exception Video_exn of string} @end format @exindex Video_exn @subsection Rectangles @format @t{ @minus{} type rect = @{ r_x : int ; r_y : int ; r_w : int ; r_h : int ; @}} @end format @tyindex rect rectangular area (x, y, w, h) @format @t{ @minus{} val rect : x:int -> y:int -> w:int -> h:int -> rect} @end format @vaindex rect @format @t{ @minus{} val copy_rect : rect -> rect} @end format @vaindex copy_rect @* @strong{Returns} a copy of the rectangle @subsection Video mode informations @format @t{ @minus{} type pixel_format_info = @{ palette : bool ; bits_pp : int ; (* bits per pixel *) bytes_pp : int ; (* bytes per pixel *) rmask : int32 ; (* red mask value *) gmask : int32 ; (* green mask value *) bmask : int32 ; (* blue mask value *) amask : int32 ; (* alpha mask value *) rshift : int ; gshift : int ; bshift : int ; ashift : int ; rloss : int ; gloss : int ; bloss : int ; aloss : int ; colorkey : int32 ; (* RGB color key information *) alpha : int ; (* Alpha value information (per-surface alpha) *) @}} @end format @tyindex pixel_format_info Structure describing how color are encoded as pixels @format @t{ @minus{} type video_info = @{ hw_available : bool ; (* Hardware surfaces? *) wm_available : bool ; (* Window manager present? *) blit_hw : bool ; (* Accelerated blits HW -> HW *) blit_hw_color_key : bool ; (* Accelerated blits with color key *) blit_hw_alpha : bool ; (* Accelerated blits with alpha *) blit_sw : bool ; (* Accelerated blits SW -> HW *) blit_sw_color_key : bool ; (* Accelerated blits with color key *) blit_sw_alpha : bool ; (* Accelerated blits with alpha *) blit_fill : bool ; (* Accelerated color fill *) video_mem : int ; (* Total amount of video memory (Ko) *) @}} @end format @tyindex video_info Information on either the 'best' available mode (if called before @code{set_video_mode}) or the current video mode. @format @t{ @minus{} val get_video_info : unit -> video_info} @end format @vaindex get_video_info @format @t{ @minus{} val get_video_info_format : unit -> pixel_format_info} @end format @vaindex get_video_info_format @* @strong{Returns} information about the pixel format @format @t{ @minus{} val driver_name : unit -> string} @end format @vaindex driver_name @* @strong{Returns} the name of the video driver @format @t{ @minus{} type video_flag = [ `ANYFORMAT | `ASYNCBLIT | `DOUBLEBUF | `FULLSCREEN | `HWPALETTE | `HWSURFACE | `NOFRAME | `OPENGL | `OPENGLBLIT | `RESIZABLE | `SWSURFACE ] } @end format @tyindex video_flag @format @t{ @minus{} type modes = | NOMODE (* no dimensions available for the requested format *) | ANY (* any dimension okay *) | DIM of (int * int) list } @end format @tyindex modes @format @t{ @minus{} val list_modes : ?bpp:int -> video_flag list -> modes} @end format @vaindex list_modes @* @strong{Returns} a list of available screen dimensions for the given format and video flags, sorted largest to smallest or NOMODE or ANY @format @t{ @minus{} val video_mode_ok : w:int -> h:int -> bpp:int -> video_flag list -> int} @end format @vaindex video_mode_ok Check to see if a particular video mode is supported. @* @strong{Returns} 0 if the requested mode is not supported 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, set_video_mode will succeed, but will emulate the requested bits-per-pixel with a shadow surface. @subsection Surfaces @format @t{ @minus{} type surface } @end format @tyindex surface Graphical surface datatype @format @t{ @minus{} type surface_flags = [ `ANYFORMAT | `ASYNCBLIT | `DOUBLEBUF | `FULLSCREEN | `HWACCEL | `HWPALETTE | `HWSURFACE | `NOFRAME | `OPENGL | `OPENGLBLIT | `PREALLOC | `RESIZABLE | `RLEACCEL | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] } @end format @tyindex surface_flags @format @t{ @minus{} type surface_info = @{ flags : Sdlvideo.surface_flags list ; w : int ; (* width *) h : int ; (* height *) pitch : int ; (* pitch *) clip_rect : Sdlvideo.rect ; (* clipping information *) refcount : int ; (* reference count *) @}} @end format @tyindex surface_info @format @t{ @minus{} val surface_info : surface -> surface_info} @end format @vaindex surface_info @* @strong{Returns} information for the given @code{surface} @format @t{ @minus{} val surface_format : surface -> pixel_format_info} @end format @vaindex surface_format @* @strong{Returns} pixel format information for the given @code{surface} @format @t{ @minus{} val surface_dims : surface -> int * int * int} @end format @vaindex surface_dims @* @strong{Returns} width, height and pitch of the given @code{surface} @format @t{ @minus{} val surface_flags : surface -> surface_flags list} @end format @vaindex surface_flags @* @strong{Returns} flag list for the given @code{surface} @format @t{ @minus{} val surface_bpp : surface -> int} @end format @vaindex surface_bpp @* @strong{Returns} bits-per-pixel for the given @code{surface} @subsection Video modes-related functions @format @t{ @minus{} val get_video_surface : unit -> surface} @end format @vaindex get_video_surface @* @strong{Returns} the current display @code{surface} @format @t{ @minus{} val set_video_mode : w:int -> h:int -> ?bpp:int -> video_flag list -> surface} @end format @vaindex set_video_mode Set up a video mode with the specified @code{width}, @code{height} and @code{bits-per-pixel}. @* @strong{Parameters} bpp: if omited, it is treated as the current display bits per pixel @* @strong{Returns} the current display @code{surface} @format @t{ @minus{} val update_rect : ?rect:rect -> surface -> unit} @end format @vaindex update_rect @* @strong{Parameters} rect: makes sure the given area is updated on the given screen. The rectangle must be confined within the screen boundaries (no clipping is done). Updates the entire screen if omitted @format @t{ @minus{} val update_rects : rect list -> surface -> unit} @end format @vaindex update_rects Makes sure the given list of rectangles is updated on the given screen. The rectangles must all be confined within the screen boundaries (no clipping is done). This function should not be called while screen is locked. @format @t{ @minus{} val flip : surface -> unit} @end format @vaindex flip Swaps screen buffers. On hardware that supports double-buffering (@code{`DOUBLEBUF}), 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 @code{update_rect} @subsection Color manipulation @format @t{ @minus{} val set_gamma : r:float -> g:float -> b:float -> unit} @end format @vaindex set_gamma 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. @format @t{ @minus{} type color = int * int * int } @end format @tyindex color Format independent color description @code{(r,g,b)} are 8 bits unsigned integers @format @t{ @minus{} val black : color} @end format @vaindex black @format @t{ @minus{} val white : color} @end format @vaindex white @format @t{ @minus{} val red : color} @end format @vaindex red @format @t{ @minus{} val green : color} @end format @vaindex green @format @t{ @minus{} val blue : color} @end format @vaindex blue @format @t{ @minus{} val yellow : color} @end format @vaindex yellow @format @t{ @minus{} val cyan : color} @end format @vaindex cyan @format @t{ @minus{} val magenta : color} @end format @vaindex magenta @subsubsection Palettes @format @t{ @minus{} val use_palette : surface -> bool} @end format @vaindex use_palette @* @strong{Returns} @code{true} if surface use indexed colors @format @t{ @minus{} val palette_ncolors : surface -> int} @end format @vaindex palette_ncolors Number of colors in the surface's palette @format @t{ @minus{} val get_palette_color : surface -> int -> color} @end format @vaindex get_palette_color Retrieve a color by its index in a surface's palette @format @t{ @minus{} type palette_flag = | LOGPAL (* set logical palette, which controls how blits are mapped to/from the surface *) | PHYSPAL (* set physical palette, which controls how pixels look on the screen *) | LOGPHYSPAL } @end format @tyindex palette_flag @format @t{ @minus{} val set_palette : surface -> ?flag:palette_flag -> ?firstcolor:int -> color array -> unit} @end format @vaindex set_palette Sets a portion of the palette for a given 8-bit @code{surface}. @* @strong{Parameters} flag: defaults to LOGPHYSPAL @* @strong{Parameters} firstcolor: where to blit the color array given as argument (defaults to 0) @subsubsection Conversions @format @t{ @minus{} val map_RGB : surface -> ?alpha:int -> color -> int32} @end format @vaindex map_RGB Maps an RGB triple or an RGBA quadruple to a pixel value for a given pixel format @format @t{ @minus{} val get_RGB : surface -> int32 -> color} @end format @vaindex get_RGB Maps a pixel value into the RGB components for a given pixel format @* @strong{Returns} RGB color @format @t{ @minus{} val get_RGBA : surface -> int32 -> color * int} @end format @vaindex get_RGBA Maps a pixel value into the RGBA components for a given pixel format * @* @strong{Returns} RGB color and alpha value @subsection Creating RGB surface @format @t{ @minus{} val create_RGB_surface : [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list -> w:int -> h:int -> bpp:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface} @end format @vaindex create_RGB_surface Creates a RGB surface. 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 given masks. @* @strong{Returns} the new surface @format @t{ @minus{} val create_RGB_surface_format : surface -> [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list -> w:int -> h:int -> surface} @end format @vaindex create_RGB_surface_format Creates a RGB surface with the same pixel format as the first parameter. @format @t{ @minus{} val create_RGB_surface_from_32 : (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface} @end format @vaindex create_RGB_surface_from_32 @format @t{ @minus{} val create_RGB_surface_from_24 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface} @end format @vaindex create_RGB_surface_from_24 @format @t{ @minus{} val create_RGB_surface_from_16 : (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface} @end format @vaindex create_RGB_surface_from_16 @format @t{ @minus{} val create_RGB_surface_from_8 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface} @end format @vaindex create_RGB_surface_from_8 @subsection Locking/Unlocking surface @format @t{ @minus{} val must_lock : surface -> bool} @end format @vaindex must_lock @* @strong{Returns} @code{true} if the surface should be locked before accessing its pixels @format @t{ @minus{} val lock : surface -> unit} @end format @vaindex lock Sets up a surface for directly accessing the pixels. @format @t{ @minus{} val unlock : surface -> unit} @end format @vaindex unlock Releases the lock on the given @code{surface} @subsection Accessing surface pixels @format @t{ @minus{} val pixel_data : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex pixel_data @format @t{ @minus{} val pixel_data_8 : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex pixel_data_8 @format @t{ @minus{} val pixel_data_16 : surface -> (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex pixel_data_16 @format @t{ @minus{} val pixel_data_24 : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex pixel_data_24 @format @t{ @minus{} val pixel_data_32 : surface -> (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t} @end format @vaindex pixel_data_32 @format @t{ @minus{} val get_pixel : surface -> x:int -> y:int -> int32} @end format @vaindex get_pixel @format @t{ @minus{} val get_pixel_color : surface -> x:int -> y:int -> color} @end format @vaindex get_pixel_color Access an individual pixel on a surface and returns is as a @code{color}. The surface may have to be locked before access. @format @t{ @minus{} val put_pixel : surface -> x:int -> y:int -> int32 -> unit} @end format @vaindex put_pixel @format @t{ @minus{} val put_pixel_color : surface -> x:int -> y:int -> color -> unit} @end format @vaindex put_pixel_color Sets an individual pixel on a surface. The surface may have to be locked before access. @subsection Reading/writing in BMP files @format @t{ @minus{} val load_BMP : string -> surface} @end format @vaindex load_BMP Loads a surface from a named Windows BMP file. @format @t{ @minus{} val load_BMP_from_mem : string -> surface} @end format @vaindex load_BMP_from_mem Loads a BMP image from a memory buffer. @format @t{ @minus{} val save_BMP : surface -> string -> unit} @end format @vaindex save_BMP Saves the @code{surface} as a Windows BMP file named file. @subsection Colorkey and alpha stuff @format @t{ @minus{} val unset_color_key : surface -> unit} @end format @vaindex unset_color_key @format @t{ @minus{} val set_color_key : surface -> ?rle:bool -> int32 -> unit} @end format @vaindex set_color_key Sets the color key (transparent pixel) in a blittable @code{surface}. @format @t{ @minus{} val get_color_key : surface -> int32} @end format @vaindex get_color_key @* @strong{Returns} the color key of the given @code{surface} @format @t{ @minus{} val unset_alpha : surface -> unit} @end format @vaindex unset_alpha @format @t{ @minus{} val set_alpha : surface -> ?rle:bool -> int -> unit} @end format @vaindex set_alpha sets the alpha value for the entire @code{surface}, as opposed to using the alpha component of each pixel. @format @t{ @minus{} val get_alpha : surface -> int} @end format @vaindex get_alpha @* @strong{Returns} the alpha value of the given @code{surface} @subsection Clipping @format @t{ @minus{} val unset_clip_rect : surface -> unit} @end format @vaindex unset_clip_rect disable clipping for the given @code{surface} @format @t{ @minus{} val set_clip_rect : surface -> rect -> unit} @end format @vaindex set_clip_rect Sets the clipping rectangle for the destination @code{surface} in a blit. @format @t{ @minus{} val get_clip_rect : surface -> rect} @end format @vaindex get_clip_rect @* @strong{Returns} the clipping rectangle for the destination @code{surface} in a blit. @subsection Blitting @format @t{ @minus{} val blit_surface : src:surface -> ?src_rect:rect -> dst:surface -> ?dst_rect:rect -> unit -> unit} @end format @vaindex blit_surface Performs a fast blit from the source @code{surface} to the destination @code{surface}. @* @strong{Parameters} src_rect: the width and height determine the size of the copied rectangle. If omitted, the entire surface is copied. @* @strong{Parameters} dst_rect: only the position is used (the width and height are ignored). If omitted, the detination position (upper left corner) is (0, 0). The final blit rectangles are saved in @code{src_rect} and @code{dst_rect} after all clipping is performed. The blit function should not be called on a locked surface. @format @t{ @minus{} val fill_rect : ?rect:rect -> surface -> int32 -> unit} @end format @vaindex fill_rect performs a fast fill of the given rectangle with 'color' @format @t{ @minus{} val display_format : ?alpha:bool -> surface -> surface} @end format @vaindex display_format 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. @* @strong{Parameters} alpha: if @code{true}, include an alpha channel in the new surface @node Sdlwm, @chapter Module @code{Sdlwm} @moindex Sdlwm @section Description Window Manager interaction @section Interface @format @t{ @minus{} val set_caption : title:string -> icon:string -> unit} @end format @vaindex set_caption Sets the title and icon text of the display window @format @t{ @minus{} val get_caption : unit -> string * string} @end format @vaindex get_caption Gets the title and icon text of the display window @format @t{ @minus{} val set_icon : Sdlvideo.surface -> unit} @end format @vaindex set_icon Sets the icon for the display window. This function must be called before the first call to Sdlvideo.set_video_mode. @format @t{ @minus{} val iconify : unit -> bool} @end format @vaindex iconify This function iconifies the window, and returns @code{true} if it succeeded. If the function succeeds, it generates an Sdlevent.active_event loss event. This function is a noop and returns @code{false} in non-windowed environments. @format @t{ @minus{} val toggle_fullscreen : unit -> bool} @end format @vaindex toggle_fullscreen Toggle fullscreen mode without changing the contents of the screen. If this function was able to toggle fullscreen mode (change from running in a window to fullscreen, or vice-versa), it will return @code{true}. If it is not implemented, or fails, it returns @code{false}. @format @t{ @minus{} val grab_input : bool -> unit} @end format @vaindex grab_input Set the input grab state of the application. 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. @format @t{ @minus{} val query_grab : unit -> bool} @end format @vaindex query_grab @node Sdlttf, @chapter Module @code{Sdlttf} @moindex Sdlttf @section Description This module provides TTF (TrueType Font) support @section Interface @format @t{ @minus{} exception SDLttf_exception of string} @end format @exindex SDLttf_exception Exception for reporting errors @format @t{ @minus{} val init : unit -> unit} @end format @vaindex init Initialise SDL_tff and freetype @format @t{ @minus{} val quit : unit -> unit} @end format @vaindex quit Quits the system @subsection General operations on font datatype @format @t{ @minus{} type font } @end format @tyindex font abstract font datatype @format @t{ @minus{} val open_font : string -> ?index:int -> int -> font} @end format @vaindex open_font open a font file and create a font of the specified point size @* @strong{Returns} font datatype Set and retrieve the font style This font style is implemented by modifying the font glyphs, and doesn't reflect any inherent properties of the truetype font file. @format @t{ @minus{} type font_style = | NORMAL | BOLD | ITALIC | UNDERLINE } @end format @tyindex font_style @format @t{ @minus{} val get_font_style : font -> font_style list} @end format @vaindex get_font_style Retrieve the font style : either @code{NORMAL} or a combination of @code{BOLD}, @code{ITALIC} and @code{UNDERLINE} @format @t{ @minus{} val set_font_style : font -> font_style list -> unit} @end format @vaindex set_font_style @subsection Font information @format @t{ @minus{} val font_height : font -> int} @end format @vaindex font_height @* @strong{Returns} the total height(int) of the font (usually equal to point size) @format @t{ @minus{} val font_ascent : font -> int} @end format @vaindex font_ascent @* @strong{Returns} the offset(int) from the baseline to the top of the font this is a positive value, relative to the baseline @format @t{ @minus{} val font_descent : font -> int} @end format @vaindex font_descent @* @strong{Returns} the offset from the baseline to the bottom of the font this is a negative value, relative to the baseline @format @t{ @minus{} val font_lineskip : font -> int} @end format @vaindex font_lineskip Get the recommended spacing between lines of text for this font @format @t{ @minus{} val font_faces : font -> int} @end format @vaindex font_faces Get the number of faces of the font Get some font face attributes, if any @format @t{ @minus{} val is_fixed_width : font -> bool} @end format @vaindex is_fixed_width @format @t{ @minus{} val family_name : font -> string} @end format @vaindex family_name @format @t{ @minus{} val style_name : font -> string} @end format @vaindex style_name @subsection Text rendering functions @format @t{ @minus{} val size_text : font -> string -> int * int} @end format @vaindex size_text Get the dimensions of a rendered string of text @format @t{ @minus{} val size_utf8 : font -> string -> int * int} @end format @vaindex size_utf8 @format @t{ @minus{} val glyph_metrics : font -> char -> int * int * int * int} @end format @vaindex glyph_metrics @* @strong{Returns} the metrics (minx,maxx,miny,maxy) of a glyph @format @t{ @minus{} type render_kind = | SOLID of Sdlvideo.color | SHADED of (Sdlvideo.color * Sdlvideo.color) | BLENDED of Sdlvideo.color } @end format @tyindex render_kind Variant type for the generic rendering functions @subsubsection Text rendering functions @format @t{ @minus{} val render_text_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_text_solid @format @t{ @minus{} val render_text_shaded : font -> string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_text_shaded @format @t{ @minus{} val render_text_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_text_blended @format @t{ @minus{} val render_utf8_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_utf8_solid @format @t{ @minus{} val render_utf8_shaded : font -> string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_utf8_shaded @format @t{ @minus{} val render_utf8_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_utf8_blended @format @t{ @minus{} val render_text : font -> render_kind -> string -> Sdlvideo.surface} @end format @vaindex render_text @subsubsection Glyph rendering functions @format @t{ @minus{} val render_glyph_solid : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_glyph_solid @format @t{ @minus{} val render_glyph_shaded : font -> char -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_glyph_shaded @format @t{ @minus{} val render_glyph_blended : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface} @end format @vaindex render_glyph_blended @format @t{ @minus{} val render_glyph : font -> render_kind -> char -> Sdlvideo.surface} @end format @vaindex render_glyph @node Sdlloader, @chapter Module @code{Sdlloader} @moindex Sdlloader @section Description Image loader module @section Interface @format @t{ @minus{} exception SDLloader_exception of string} @end format @exindex SDLloader_exception Exception to report errors @format @t{ @minus{} val load_image : string -> Sdlvideo.surface} @end format @vaindex load_image load an image as a surface @format @t{ @minus{} val load_image_from_mem : string -> Sdlvideo.surface} @end format @vaindex load_image_from_mem @format @t{ @minus{} val read_XPM_from_array : string array -> Sdlvideo.surface} @end format @vaindex read_XPM_from_array creates a surface from an array of strings (in the source code) @node Sdlmixer, @chapter Module @code{Sdlmixer} @moindex Sdlmixer @section Description Simple multi-channel audio mixer @section Interface @format @t{ @minus{} exception SDLmixer_exception of string} @end format @exindex SDLmixer_exception Exception used to report errors @subsection General API @format @t{ @minus{} val version : unit -> Sdl.version} @end format @vaindex version Get the version of the dynamically linked SDL_mixer library @format @t{ @minus{} type format = | AUDIO_FORMAT_U8 (* Unsigned 8-bit samples *) | AUDIO_FORMAT_S8 (* Signed 8-bit samples *) | AUDIO_FORMAT_U16LSB (* Unsigned 16-bit samples *) | AUDIO_FORMAT_S16LSB (* Signed 16-bit samples *) | AUDIO_FORMAT_U16MSB (* As above, but big-endian byte order *) | AUDIO_FORMAT_S16MSB (* As above, but big-endian byte order *) | AUDIO_FORMAT_U16SYS (* Unsigned, native audio byte ordering *) | AUDIO_FORMAT_S16SYS (* Signed, native audio byte ordering *) } @end format @tyindex format Audio format flags @format @t{ @minus{} type channels = | MONO | STEREO } @end format @tyindex channels @format @t{ @minus{} val open_audio : ?freq:int -> ?format:format -> ?chunksize:int -> ?channels:channels -> unit -> unit} @end format @vaindex open_audio @code{open_audio frequency format chunksize channels ()} opens the mixer with a certain audio format. @itemize @item frequency could be 8000 11025 22050 44100 ; defaults to 22050 @item format defaults to AUDIO_FORMAT_S16SYS @item chunksize defaults to 4096 @item channels defaults to STEREO @end itemize @format @t{ @minus{} val close_audio : unit -> unit} @end format @vaindex close_audio Close the mixer, halting all playing audio @format @t{ @minus{} type specs = @{ frequency : int ; format : Sdlmixer.format ; channels : Sdlmixer.channels ; @}} @end format @tyindex specs @format @t{ @minus{} val query_specs : unit -> specs} @end format @vaindex query_specs Find out what the actual audio device parameters are. @* @strong{Raises} @code{SDLmixer_exception} if the audio has not been opened @subsection Samples @format @t{ @minus{} type chunk } @end format @tyindex chunk @format @t{ @minus{} val loadWAV : string -> chunk} @end format @vaindex loadWAV Load a wave file @format @t{ @minus{} val loadWAV_from_mem : string -> chunk} @end format @vaindex loadWAV_from_mem @format @t{ @minus{} val load_string : string -> chunk} @end format @vaindex load_string Load a wave file of the mixer format from a memory buffer @format @t{ @minus{} val load_string_raw : string -> chunk} @end format @vaindex load_string_raw Load raw audio data of the mixer format from a memory buffer @format @t{ @minus{} val volume_chunk : chunk -> float} @end format @vaindex volume_chunk @format @t{ @minus{} val setvolume_chunk : chunk -> float -> unit} @end format @vaindex setvolume_chunk @format @t{ @minus{} val free_chunk : chunk -> unit} @end format @vaindex free_chunk Free an audio chunk previously loaded @subsection Channels @format @t{ @minus{} type channel = int } @end format @tyindex channel @format @t{ @minus{} val all_channels : channel} @end format @vaindex all_channels A special value for representing all channels (-1 actually). @format @t{ @minus{} val num_channels : unit -> int} @end format @vaindex num_channels @* @strong{Returns} the number of channels currently allocated @format @t{ @minus{} val allocate_channels : int -> int} @end format @vaindex allocate_channels Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped. @* @strong{Returns} the new number of allocated channels @format @t{ @minus{} val play_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> unit} @end format @vaindex play_channel @code{play_channel channel loops ticks chunk } Play an audio chunk. @* @strong{Parameters} channel: channel to play on. If not specified, play on the first free channel. @* @strong{Parameters} loops: number of times to play the chunk. If @code{-1}, loop infinitely (~65000 times). @* @strong{Parameters} ticks: if specified, play for at most 'ticks' seconds. @format @t{ @minus{} val play_sound : chunk -> unit} @end format @vaindex play_sound Play an audio chunk. Same as above, without the optional parameters @format @t{ @minus{} val fadein_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> float -> unit} @end format @vaindex fadein_channel @code{fadein_channel channel loops ticks chunck ms} : same as @code{play_channel} but fades in a over @code{ms} seconds. @format @t{ @minus{} val volume_channel : channel -> float} @end format @vaindex volume_channel Returns the original volume of a specific channel, chunk or music @* @strong{Returns} float between 0 and 1. @format @t{ @minus{} val setvolume_channel : channel -> float -> unit} @end format @vaindex setvolume_channel Sets the volume for specified channel or chunk. Volume is a float between 0 and 1. If lower than 0, nothing is done. If greater than 1, volume is set to 1 @format @t{ @minus{} val pause_channel : channel -> unit} @end format @vaindex pause_channel @format @t{ @minus{} val resume_channel : channel -> unit} @end format @vaindex resume_channel @format @t{ @minus{} val halt_channel : channel -> unit} @end format @vaindex halt_channel @format @t{ @minus{} val expire_channel : channel -> float option -> unit} @end format @vaindex expire_channel @code{expire_channel channel ticks} Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' seconds have elapsed, or remove the expiration if 'ticks' is @code{None} @format @t{ @minus{} val fadeout_channel : channel -> float -> unit} @end format @vaindex fadeout_channel @code{fadeout_channel channel ticks} Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. @format @t{ @minus{} val playing_channel : channel -> bool} @end format @vaindex playing_channel @format @t{ @minus{} val num_playing_channel : unit -> int} @end format @vaindex num_playing_channel @format @t{ @minus{} val paused_channel : channel -> bool} @end format @vaindex paused_channel @format @t{ @minus{} val num_paused_channel : unit -> int} @end format @vaindex num_paused_channel @format @t{ @minus{} type fade_status = | NO_FADING | FADING_OUT | FADING_IN } @end format @tyindex fade_status The different fading types supported @format @t{ @minus{} val fading_channel : channel -> fade_status} @end format @vaindex fading_channel Query the fading status of a channel @subsection Groups @format @t{ @minus{} type group = int } @end format @tyindex group @format @t{ @minus{} val default_group : group} @end format @vaindex default_group The group tag used to represent the group of all the channels. Used to remove a group tag @format @t{ @minus{} val reserve_channels : int -> int} @end format @vaindex reserve_channels Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if no channel is specified (see Sdlmixer.play_channel). @* @strong{Returns} the number of reserved channels @format @t{ @minus{} val group_channel : channel -> group -> unit} @end format @vaindex group_channel Attach a group tag to a channel. A group tag can be assigned to several mixer channels, to form groups of channels. If group is @code{default_group}, the tag is removed. @format @t{ @minus{} val group_channels : from_c:channel -> to_c:channel -> group -> unit} @end format @vaindex group_channels Same as above but for a range of channels. @format @t{ @minus{} val group_count : group -> int} @end format @vaindex group_count Returns the number of channels in a group. This is also a subtle way to get the total number of channels when @code{group} is @code{default_group}. @format @t{ @minus{} val group_available : group -> channel} @end format @vaindex group_available Finds the first available @code{channel} in a @code{group} of channels @* @strong{Raises} @code{Not_found} if none are available. @format @t{ @minus{} val group_oldest : group -> channel} @end format @vaindex group_oldest Finds the "oldest" sample playing in a @code{group} of channels @format @t{ @minus{} val group_newer : group -> channel} @end format @vaindex group_newer Finds the "most recent" (i.e. last) sample playing in a @code{group} of channels @format @t{ @minus{} val fadeout_group : group -> float -> unit} @end format @vaindex fadeout_group @code{fadeout_group group ticks} Halt a group of channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. @format @t{ @minus{} val halt_group : group -> unit} @end format @vaindex halt_group @subsection Music @format @t{ @minus{} type music } @end format @tyindex music @format @t{ @minus{} type music_kind = | NONE | CMD | WAV | MOD | MID | OGG | MP3 } @end format @tyindex music_kind The different music types supported @format @t{ @minus{} val load_music : string -> music} @end format @vaindex load_music Load a music file (.mod .s3m .it .xm .ogg) @format @t{ @minus{} val free_music : music -> unit} @end format @vaindex free_music Free music previously loaded @format @t{ @minus{} val play_music : ?loops:int -> music -> unit} @end format @vaindex play_music Play a music chunk. @* @strong{Parameters} loops: number of times to play through the music @format @t{ @minus{} val fadein_music : ?loops:int -> music -> float -> unit} @end format @vaindex fadein_music @code{fadein_music chunck loops music ms} : fade in music over @code{ms} seconds, same semantics as the @code{play_music} function @format @t{ @minus{} val volume_music : unit -> float} @end format @vaindex volume_music @format @t{ @minus{} val setvolume_music : float -> unit} @end format @vaindex setvolume_music @format @t{ @minus{} val pause_music : unit -> unit} @end format @vaindex pause_music @format @t{ @minus{} val resume_music : unit -> unit} @end format @vaindex resume_music @format @t{ @minus{} val rewind_music : unit -> unit} @end format @vaindex rewind_music @format @t{ @minus{} val set_music_cmd : string -> unit} @end format @vaindex set_music_cmd Stop music and set external music playback command @format @t{ @minus{} val unset_music_cmd : unit -> unit} @end format @vaindex unset_music_cmd Turn off using an external command for music, returning to the internal music playing functionality @format @t{ @minus{} val halt_music : unit -> unit} @end format @vaindex halt_music @format @t{ @minus{} val fadeout_music : float -> unit} @end format @vaindex fadeout_music @code{fadeout_music ticks} Halt the music, fading it out progressively till it's silent. The ms parameter indicates the number of seconds the fading will take. @format @t{ @minus{} val music_type : music option -> music_kind} @end format @vaindex music_type Find out the music format of a mixer music, or the currently playing music, if parameter is @code{None}. @format @t{ @minus{} val playing_music : unit -> bool} @end format @vaindex playing_music @format @t{ @minus{} val paused_music : unit -> bool} @end format @vaindex paused_music @format @t{ @minus{} val fading_music : unit -> fade_status} @end format @vaindex fading_music Query the fading status of a music @node Sdlgfx, @chapter Module @code{Sdlgfx} @moindex Sdlgfx @section Interface @format @t{ @minus{} val pixelColor : Sdlvideo.surface -> int -> int -> int32 -> bool} @end format @vaindex pixelColor @format @t{ @minus{} val pixelRGBA : Sdlvideo.surface -> int -> int -> Sdlvideo.color -> int -> bool} @end format @vaindex pixelRGBA @format @t{ @minus{} val rectangleColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex rectangleColor @format @t{ @minus{} val rectangleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex rectangleRGBA @format @t{ @minus{} val boxColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex boxColor @format @t{ @minus{} val boxRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex boxRGBA @format @t{ @minus{} val lineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex lineColor @format @t{ @minus{} val lineRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex lineRGBA @format @t{ @minus{} val aalineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex aalineColor @format @t{ @minus{} val aalineRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex aalineRGBA @format @t{ @minus{} val circleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool} @end format @vaindex circleColor @format @t{ @minus{} val circleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool} @end format @vaindex circleRGBA @format @t{ @minus{} val aacircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool} @end format @vaindex aacircleColor @format @t{ @minus{} val aacircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool} @end format @vaindex aacircleRGBA @format @t{ @minus{} val filledCircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool} @end format @vaindex filledCircleColor @format @t{ @minus{} val filledCircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool} @end format @vaindex filledCircleRGBA @format @t{ @minus{} val ellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex ellipseColor @format @t{ @minus{} val ellipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex ellipseRGBA @format @t{ @minus{} val aaellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex aaellipseColor @format @t{ @minus{} val aaellipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex aaellipseRGBA @format @t{ @minus{} val filledEllipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool} @end format @vaindex filledEllipseColor @format @t{ @minus{} val filledEllipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool} @end format @vaindex filledEllipseRGBA @format @t{ @minus{} val characterColor : Sdlvideo.surface -> Sdlvideo.rect -> char -> int32 -> bool} @end format @vaindex characterColor @format @t{ @minus{} val characterRGBA : Sdlvideo.surface -> Sdlvideo.rect -> char -> Sdlvideo.color -> int -> bool} @end format @vaindex characterRGBA @format @t{ @minus{} val stringColor : Sdlvideo.surface -> Sdlvideo.rect -> string -> int32 -> bool} @end format @vaindex stringColor @format @t{ @minus{} val stringRGBA : Sdlvideo.surface -> Sdlvideo.rect -> string -> Sdlvideo.color -> int -> bool} @end format @vaindex stringRGBA @format @t{ @minus{} val gfxPrimitivesSetFont : string -> int -> int -> unit} @end format @vaindex gfxPrimitivesSetFont @format @t{ @minus{} val rotozoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface} @end format @vaindex rotozoomSurface @format @t{ @minus{} val rotozoomSurfaceXY : Sdlvideo.surface -> float -> float -> float -> bool -> Sdlvideo.surface} @end format @vaindex rotozoomSurfaceXY @format @t{ @minus{} val zoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface} @end format @vaindex zoomSurface @node Types index, @unnumbered Types index @printindex ty @node Exceptions index, @unnumbered Exceptions index @printindex ex @node Values index, @unnumbered Values index @printindex va @node Modules index, @unnumbered Modules index @printindex mo @contents @bye ocamlsdl-0.9.1/doc/ocamlsdl.info0000664000076400007640000026116511774643063015303 0ustar olivolivThis is doc/ocamlsdl.info, produced by makeinfo version 4.13 from doc/ocamlsdl.texi. INFO-DIR-SECTION Objective Caml START-INFO-DIR-ENTRY * OCamlSDL 0.9.1: (ocamlsdl). END-INFO-DIR-ENTRY This file was generated by Ocamldoc using the Texinfo generator.  File: ocamlsdl.info, Node: Top, Up: (dir) OCamlSDL 0.9.1 ************** Documentation for OCamlSDL 0.9.1 * Menu: * Sdl:: Module * Sdlcdrom:: Module * Sdltimer:: Module * Sdljoystick:: Module * Sdlkey:: Module * Sdlmouse:: Module * Sdlevent:: Module * Sdlvideo:: Module * Sdlwm:: Module * Sdlttf:: Module * Sdlloader:: Module * Sdlmixer:: Module * Sdlgfx:: Module Indices : * Types index:: * Exceptions index:: * Values index:: * Modules index::  File: ocamlsdl.info, Node: Sdl, Next: Sdlcdrom, Prev: Top, Up: Top 1 Module `Sdl' ************** 1.1 Description =============== This module contains functions for initializing/quitting the library 1.2 Interface ============= - exception SDL_init_exception of string Exception for reporting errors during initialization 1.2.1 Main functions -------------------- - type subsystem = [ `AUDIO | `CDROM | `JOYSTICK | `TIMER | `VIDEO ] Initialization flag type - val init : ?auto_clean:bool -> [< `AUDIO | `CDROM | `EVENTTHREAD | `EVERYTHING | `JOYSTICK | `NOPARACHUTE | `TIMER | `VIDEO ] list -> unit Initialize the SDL library. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize. * `NOPARACHUTE : Don't catch fatal signals * `EVENTTHREAD : Automatically pump events in a separate threads * `EVERYTHING : initialize all subsystems - val init_subsystem : subsystem list -> unit - val was_init : unit -> subsystem list - val quit : unit -> unit `quit' shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. - val quit_subsystem : subsystem list -> unit 1.2.2 Versioning information ---------------------------- - type version = { major : int ; minor : int ; patch : int ; } - val version : unit -> version version of the SDL library - val string_of_version : version -> string 1.2.3 Environment variables --------------------------- - val getenv : string -> string - val putenv : string -> string -> unit  File: ocamlsdl.info, Node: Sdlcdrom, Next: Sdltimer, Prev: Sdl, Up: Top 2 Module `Sdlcdrom' ******************* 2.1 Description =============== This module provides CD-ROM handling 2.2 Interface ============= - exception SDLcdrom_exception of string Exception used to report errors - exception Trayempty Exception to report that thre's no cd in the drive 2.2.1 Types ----------- - type cdrom_drive abstract type for handling cdrom - type cdrom_drive_status = | CD_TRAYEMPTY (* cdrom drive is empty *) | CD_STOPPED (* cdrom drive is stopped *) | CD_PLAYING (* cdrom drive is playing *) | CD_PAUSED (* cdrom drive is paused *) enumeration of different status cdrom drive - type track_type = | TRACK_AUDIO (* audio track type *) | TRACK_DATA (* data track type *) the types of CD-ROM track possible - type track = { id : int ; kind : Sdlcdrom.track_type ; length : int ; offset : int ; } - type cdrom_info = { num_tracks : int ; curr_track : int ; curr_frame : int ; tracks : Sdlcdrom.track array ; } 2.2.2 General API ----------------- An SDLcdrom_exception is raised on errors - val get_num_drives : unit -> int `get_num_drives' returns the number of CD-ROM drives on the system - val drive_name : int -> string `drive_name drive' 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 `get_num_drives()-1'. 2.2.3 CD-ROM drive handling --------------------------- - val cd_open : int -> cdrom_drive `cd_open drive' open a CD-ROM drive for access - val cd_close : cdrom_drive -> unit Closes the handle for the cdrom_drive - val cd_status : cdrom_drive -> cdrom_drive_status *Returns* the current status of the given drive. - val cd_info : cdrom_drive -> cdrom_info *Raises* `Trayempty' if there's no cd in the drive *Returns* the table of contents of the CD and current play position 2.2.4 Playing audio tracks -------------------------- - val msf_of_frames : int -> int * int * int - val frames_of_msf : int * int * int -> int - val cd_play_tracks : cdrom_drive -> start_track:int -> start_frame:int -> num_tracks:int -> num_frames:int -> unit `cd_play_tracks cdrom_drive start_track start_frame num_tracks num_frames' play the given CD with these parameters *Parameters* start_track: the starting track *Parameters* start_frame: the starting frame *Parameters* num_tracks: the number of tracks to play *Parameters* num_frames: the number of frames to play *Raises* `Trayempty' if there's no cd in the drive - val cd_play_track : cdrom_drive -> track -> unit Play the track n on the given cdrom_drive - val cd_pause : cdrom_drive -> unit Pause play - val cd_resume : cdrom_drive -> unit Resume play - val cd_stop : cdrom_drive -> unit Stop play - val cd_eject : cdrom_drive -> unit Eject CD-ROM  File: ocamlsdl.info, Node: Sdltimer, Next: Sdljoystick, Prev: Sdlcdrom, Up: Top 3 Module `Sdltimer' ******************* 3.1 Description =============== Time-related functions 3.2 Interface ============= - val delay : int -> unit Wait a specified number of milliseconds before returning - val get_ticks : unit -> int Get the number of milliseconds since the SDL library initialization.  File: ocamlsdl.info, Node: Sdljoystick, Next: Sdlkey, Prev: Sdltimer, Up: Top 4 Module `Sdljoystick' ********************** 4.1 Description =============== Module for SDL joystick event handling 4.2 Interface ============= In order to use these functions, Sdl.init must have been called with the `JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers. - exception SDLjoystick_exception of string exception for error reporting - type t The joystick abstract type used to identify an SDL joystick - val num_joysticks : unit -> int Count the number of joysticks attached to the system - val name : int -> string Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. - val open_joystick : int -> t 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. *Raises* `SDLjoystick_exception' if an error occurred - val opened : int -> bool *Returns* `true' if joystick has been opened - val index : t -> int Get the device index of an opened joystick - val num_axes : t -> int Get the number of general axis controls on a joystick - val num_balls : t -> int Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled. - val num_hats : t -> int Get the number of POV hats on a joystick - val num_buttons : t -> int Get the number of buttons on a joystick 4.2.1 Joystick state -------------------- - val update : t -> unit Update the current state of the open joysticks. This is called automatically by the event loop if any joystick events are enabled. Enable/disable joystick event polling. If joystick events are disabled, you must call Sdljoystick.update yourself and check the state of the joystick when you want joystick information. - val set_event_state : bool -> unit - val get_event_state : unit -> bool - type hat_value = int - val hat_centered : hat_value - val hat_up : hat_value - val hat_right : hat_value - val hat_down : hat_value - val hat_left : hat_value - val hat_rightup : hat_value - val hat_rightdown : hat_value - val hat_leftup : hat_value - val hat_leftdown : hat_value - val get_axis : t -> int -> int - val get_hat : t -> int -> hat_value - val get_ball : t -> int -> int * int - val get_button : t -> int -> bool - val close : t -> unit Close a joystick previously opened with Sdljoystick.open_joystick  File: ocamlsdl.info, Node: Sdlkey, Next: Sdlmouse, Prev: Sdljoystick, Up: Top 5 Module `Sdlkey' ***************** 5.1 Description =============== Keyboard handling and key symbols 5.2 Interface ============= 5.2.1 Keysyms ------------- - type t = | KEY_UNKNOWN | KEY_BACKSPACE | KEY_TAB | KEY_CLEAR | KEY_RETURN | KEY_PAUSE | KEY_ESCAPE | KEY_SPACE | KEY_EXCLAIM | KEY_QUOTEDBL | KEY_HASH | KEY_DOLLAR | KEY_AMPERSAND | KEY_QUOTE | KEY_LEFTPAREN | KEY_RIGHTPAREN | KEY_ASTERISK | KEY_PLUS | KEY_COMMA | KEY_MINUS | KEY_PERIOD | KEY_SLASH | KEY_0 | KEY_1 | KEY_2 | KEY_3 | KEY_4 | KEY_5 | KEY_6 | KEY_7 | KEY_8 | KEY_9 | KEY_COLON | KEY_SEMICOLON | KEY_LESS | KEY_EQUALS | KEY_GREATER | KEY_QUESTION | KEY_AT (* Skip uppercase letters *) | KEY_LEFTBRACKET | KEY_BACKSLASH | KEY_RIGHTBRACKET | KEY_CARET | KEY_UNDERSCORE | KEY_BACKQUOTE | KEY_a | KEY_b | KEY_c | KEY_d | KEY_e | KEY_f | KEY_g | KEY_h | KEY_i | KEY_j | KEY_k | KEY_l | KEY_m | KEY_n | KEY_o | KEY_p | KEY_q | KEY_r | KEY_s | KEY_t | KEY_u | KEY_v | KEY_w | KEY_x | KEY_y | KEY_z | KEY_DELETE (* End of ASCII mapped keysyms *) | KEY_WORLD_0 (* International keyboard syms *) | KEY_WORLD_1 | KEY_WORLD_2 | KEY_WORLD_3 | KEY_WORLD_4 | KEY_WORLD_5 | KEY_WORLD_6 | KEY_WORLD_7 | KEY_WORLD_8 | KEY_WORLD_9 | KEY_WORLD_10 | KEY_WORLD_11 | KEY_WORLD_12 | KEY_WORLD_13 | KEY_WORLD_14 | KEY_WORLD_15 | KEY_WORLD_16 | KEY_WORLD_17 | KEY_WORLD_18 | KEY_WORLD_19 | KEY_WORLD_20 | KEY_WORLD_21 | KEY_WORLD_22 | KEY_WORLD_23 | KEY_WORLD_24 | KEY_WORLD_25 | KEY_WORLD_26 | KEY_WORLD_27 | KEY_WORLD_28 | KEY_WORLD_29 | KEY_WORLD_30 | KEY_WORLD_31 | KEY_WORLD_32 | KEY_WORLD_33 | KEY_WORLD_34 | KEY_WORLD_35 | KEY_WORLD_36 | KEY_WORLD_37 | KEY_WORLD_38 | KEY_WORLD_39 | KEY_WORLD_40 | KEY_WORLD_41 | KEY_WORLD_42 | KEY_WORLD_43 | KEY_WORLD_44 | KEY_WORLD_45 | KEY_WORLD_46 | KEY_WORLD_47 | KEY_WORLD_48 | KEY_WORLD_49 | KEY_WORLD_50 | KEY_WORLD_51 | KEY_WORLD_52 | KEY_WORLD_53 | KEY_WORLD_54 | KEY_WORLD_55 | KEY_WORLD_56 | KEY_WORLD_57 | KEY_WORLD_58 | KEY_WORLD_59 | KEY_WORLD_60 | KEY_WORLD_61 | KEY_WORLD_62 | KEY_WORLD_63 | KEY_WORLD_64 | KEY_WORLD_65 | KEY_WORLD_66 | KEY_WORLD_67 | KEY_WORLD_68 | KEY_WORLD_69 | KEY_WORLD_70 | KEY_WORLD_71 | KEY_WORLD_72 | KEY_WORLD_73 | KEY_WORLD_74 | KEY_WORLD_75 | KEY_WORLD_76 | KEY_WORLD_77 | KEY_WORLD_78 | KEY_WORLD_79 | KEY_WORLD_80 | KEY_WORLD_81 | KEY_WORLD_82 | KEY_WORLD_83 | KEY_WORLD_84 | KEY_WORLD_85 | KEY_WORLD_86 | KEY_WORLD_87 | KEY_WORLD_88 | KEY_WORLD_89 | KEY_WORLD_90 | KEY_WORLD_91 | KEY_WORLD_92 | KEY_WORLD_93 | KEY_WORLD_94 | KEY_WORLD_95 | KEY_KP0 (* Numeric keypad *) | KEY_KP1 | KEY_KP2 | KEY_KP3 | KEY_KP4 | KEY_KP5 | KEY_KP6 | KEY_KP7 | KEY_KP8 | KEY_KP9 | KEY_KP_PERIOD | KEY_KP_DIVIDE | KEY_KP_MULTIPLY | KEY_KP_MINUS | KEY_KP_PLUS | KEY_KP_ENTER | KEY_KP_EQUALS | KEY_UP (* Arrows + Home/End pad *) | KEY_DOWN | KEY_RIGHT | KEY_LEFT | KEY_INSERT | KEY_HOME | KEY_END | KEY_PAGEUP | KEY_PAGEDOWN | KEY_F1 (* Function keys *) | KEY_F2 | KEY_F3 | KEY_F4 | KEY_F5 | KEY_F6 | KEY_F7 | KEY_F8 | KEY_F9 | KEY_F10 | KEY_F11 | KEY_F12 | KEY_F13 | KEY_F14 | KEY_F15 | KEY_NUMLOCK (* Key state modifier keys *) | KEY_CAPSLOCK | KEY_SCROLLOCK | KEY_RSHIFT | KEY_LSHIFT | KEY_RCTRL | KEY_LCTRL | KEY_RALT | KEY_LALT | KEY_RMETA | KEY_LMETA | KEY_LSUPER (* Left "Windows" key *) | KEY_RSUPER (* Right "Windows" key *) | KEY_MODE (* "Alt Gr" key *) | KEY_COMPOSE (* Multi-key compose key *) | KEY_HELP (* Miscellaneous function keys *) | KEY_PRINT | KEY_SYSREQ | KEY_BREAK | KEY_MENU | KEY_POWER (* Power Macintosh power key *) | KEY_EURO (* Some european keyboards *) | KEY_UNDO (* Atari keyboard has Undo *) Concrete type describing keyboard keys ("keysym") - val int_of_key : t -> int get the SDL keysym of the key - val key_of_int : int -> t get the key corresponding to a SDL keysym *Raises* `Invalid_arg' if not a valid SDL keysym - val char_of_key : t -> char Returns a (iso-8859-1) character corresponding to a key *Raises* `Invalid_arg' if corresponding SDL keysym is > 255 - val num_keys : int number of keys in the Sdlkey.t variant type : should be `232' - val max_code : int highest SDL keysym : should be `322' - val name : t -> string *Returns* a short string describing the key 5.2.2 Keyboard handling ----------------------- - val enable_unicode : bool -> unit Enable unicode translation of keysyms for keyboard events - val query_unicode : unit -> bool - val disable_key_repeat : unit -> unit Disable keyboard repeat - val enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit Enable keyboard repeat *Parameters* delay: initial delay in ms between the time when a key is pressed, and keyboard repeat begins *Parameters* interval: the time in ms between keyboard repeat events - val get_key_state : unit -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t Get a snapshot of the current state of the keyboard. *Returns* an array of keystates, indexed by the SDL keysyms (cf Sdlkey.int_of_key) - val is_key_pressed : t -> bool Checks wether a key is currently pressed on the keyboard. 5.2.3 Key modifiers ------------------- - type mod_state = int The following values are flags. Use with `land', `lor', etc. - val kmod_none : mod_state - val kmod_lshift : mod_state - val kmod_rshift : mod_state - val kmod_lctrl : mod_state - val kmod_rctrl : mod_state - val kmod_lalt : mod_state - val kmod_ralt : mod_state - val kmod_lmeta : mod_state - val kmod_rmeta : mod_state - val kmod_num : mod_state - val kmod_caps : mod_state - val kmod_mode : mod_state - val kmod_ctrl : mod_state - val kmod_shift : mod_state - val kmod_alt : mod_state - val kmod_meta : mod_state - val get_mod_state : unit -> mod_state Get the current key modifier state - val set_mod_state : mod_state -> unit Set the current key modifier state This does not change the keyboard state, only the key modifier flags.  File: ocamlsdl.info, Node: Sdlmouse, Next: Sdlevent, Prev: Sdlkey, Up: Top 6 Module `Sdlmouse' ******************* 6.1 Description =============== Mouse event handling and cursors 6.2 Interface ============= 6.2.1 Mouse state ----------------- - type button = | BUTTON_LEFT | BUTTON_MIDDLE | BUTTON_RIGHT | BUTTON_WHEELUP | BUTTON_WHEELDOWN | BUTTON_X of int (* BUTTON_X is only seen in a Sdlevent.mousebutton_event, it is not returned by Sdlmouse.get_state *) - val get_state : ?relative:bool -> unit -> int * int * button list Retrieve the current state of the mouse : current mouse position and list of pressed buttons *Parameters* relative: if true returns mouse delta instead of position - val warp : int -> int -> unit Set the position of the mouse cursor (generates a mouse motion event) 6.2.2 Cursors ------------- - type cursor abstract type for cursors - type cursor_data = { data : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ; (* B/W cursor data *) mask : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ; (* B/W cursor mask *) w : int ; (* width in pixels *) h : int ; (* height in pixels *) hot_x : int ; (* the "tip" of the cursor *) hot_y : int ; (* the "tip" of the cursor *) } - val make_cursor : data:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t -> mask:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t -> hot_x:int -> hot_y:int -> cursor Create a cursor using the specified data and mask (in MSB format). 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 Sdlmouse.free_cursor. - val free_cursor : cursor -> unit Deallocates a cursor. - val set_cursor : cursor -> unit Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display. - val get_cursor : unit -> cursor Returns the currently active cursor. - val cursor_visible : unit -> bool Tests if cursor is shown on screen - val show_cursor : bool -> unit Toggle cursor display - val cursor_data : cursor -> cursor_data converts an abstract cursor value to concrete cursor data - val pprint_cursor : cursor -> unit for debugging : prints on stdout - val convert_to_cursor : data:int array -> mask:int array -> w:int -> h:int -> hot_x:int -> hot_y:int -> cursor  File: ocamlsdl.info, Node: Sdlevent, Next: Sdlvideo, Prev: Sdlmouse, Up: Top 7 Module `Sdlevent' ******************* 7.1 Description =============== SDL event handling Subparts ======== * Menu: * Old: Sdlevent/Old. Module 7.2 Interface ============= - exception Event_exn of string The exception used for reporting events-related errors. 7.2.1 Application focus ----------------------- - type active_state = | MOUSEFOCUS (* The app has mouse coverage *) | INPUTFOCUS (* The app has input focus *) | APPACTIVE (* The application is active *) The available application states - val get_app_state : unit -> active_state list This function returns the current state of the application. If ACTIVE is set, then the user is able to see your application, otherwise it has been iconified or disabled. 7.2.2 Events datatypes ---------------------- - type active_event = { gain : bool ; (* Whether given states were gained or lost *) ae_state : Sdlevent.active_state list ; (* A list of the focus states *) } Application visibility event record - type switch_state = | RELEASED | PRESSED - type keyboard_event = { ke_which : int ; (* The keyboard device index *) ke_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) keysym : Sdlkey.t ; (* SDL virtual keysym *) keymod : Sdlkey.mod_state ; (* current key modifiers *) keycode : char ; (* translated character *) unicode : int ; } Keyboard event record - type mousemotion_event = { mme_which : int ; (* The mouse device index *) mme_state : Sdlmouse.button list ; (* The current button state *) mme_x : int ; (* The X/Y coordinates of the mouse *) mme_y : int ; mme_xrel : int ; (* The relative motion in the X direction *) mme_yrel : int ; (* The relative motion in the Y direction *) } Mouse motion event record - type mousebutton_event = { mbe_which : int ; (* The mouse device index *) mbe_button : Sdlmouse.button ; (* The mouse button index *) mbe_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) mbe_x : int ; (* The X/Y coordinates of the mouse at press time *) mbe_y : int ; } Mouse button event record - type joyaxis_event = { jae_which : int ; (* The joystick device index *) jae_axis : int ; (* The joystick axis index *) jae_value : int ; (* The axis value (range: -32768 to 32767) *) } Joystick axis motion event record - type joyball_event = { jle_which : int ; (* The joystick device index *) jle_ball : int ; (* The joystick trackball index *) jle_xrel : int ; (* The relative motion in the X direction *) jle_yrel : int ; (* The relative motion in the Y direction *) } Joystick axis motion event record - type joyhat_event = { jhe_which : int ; (* The joystick device index *) jhe_hat : int ; (* The joystick hat index *) jhe_value : int ; (* The hat position value: 8 1 2 7 0 3 6 5 4 Note that zero means the POV is centered. *) } Joystick hat position change event record - type joybutton_event = { jbe_which : int ; (* The joystick device index *) jbe_button : int ; (* The joystick button index *) jbe_state : Sdlevent.switch_state ; (* PRESSED or RELEASED *) } Joystick button event record - type event = | ACTIVE of Sdlevent.active_event (* Application loses/gains visibility *) | KEYDOWN of Sdlevent.keyboard_event (* Keys pressed *) | KEYUP of Sdlevent.keyboard_event (* Keys released *) | MOUSEMOTION of Sdlevent.mousemotion_event (* Mouse moved *) | MOUSEBUTTONDOWN of Sdlevent.mousebutton_event (* Mouse button pressed *) | MOUSEBUTTONUP of Sdlevent.mousebutton_event (* Mouse button released *) | JOYAXISMOTION of Sdlevent.joyaxis_event (* Joystick axis motion *) | JOYBALLMOTION of Sdlevent.joyball_event (* Joystick trackball motion *) | JOYHATMOTION of Sdlevent.joyhat_event (* Joystick hat position change *) | JOYBUTTONDOWN of Sdlevent.joybutton_event (* Joystick button pressed *) | JOYBUTTONUP of Sdlevent.joybutton_event (* Joystick button released *) | QUIT (* User-requested quit *) | SYSWM (* System specific event *) | VIDEORESIZE of (int * int) (* User resized video mode *) | VIDEOEXPOSE (* Screen needs to be redrawn *) | USER of int (* for your use ! *) The main event type - val string_of_event : event -> string Returns a short string descriptive of the event type, for debugging 7.2.3 Event masks ----------------- - type event_mask = int Event masks values are ints and should be manipulated with `lor', `land', etc. - val active_mask : event_mask - val keydown_mask : event_mask - val keyup_mask : event_mask - val mousemotion_mask : event_mask - val mousebuttondown_mask : event_mask - val mousebuttonup_mask : event_mask - val joyaxismotion_mask : event_mask - val joyballmotion_mask : event_mask - val joyhatmotion_mask : event_mask - val joybuttondown_mask : event_mask - val joybuttonup_mask : event_mask - val quit_mask : event_mask - val syswmevent_mask : event_mask - val videoresize_mask : event_mask - val videoexpose_mask : event_mask - val userevent_mask : event_mask - val keyboard_event_mask : event_mask - val mouse_event_mask : event_mask - val joystick_event_mask : event_mask - val all_events_mask : event_mask - type event_kind = | ACTIVE_EVENT | KEYDOWN_EVENT | KEYUP_EVENT | MOUSEMOTION_EVENT | MOUSEBUTTONDOWN_EVENT | MOUSEBUTTONUP_EVENT | JOYAXISMOTION_EVENT | JOYBALL_EVENT | JOYHAT_EVENT | JOYBUTTONDOWN_EVENT | JOYBUTTONUP_EVENT | QUIT_EVENT | SYSWM_EVENT | RESIZE_EVENT | EXPOSE_EVENT | USER_EVENT - val make_mask : event_kind list -> event_mask - val of_mask : event_mask -> event_kind list 7.2.4 Enabling/Disabling event collecting ----------------------------------------- - val enable_events : event_mask -> unit Specified events are collected and added to the event queue (when `pump' is called). - val disable_events : event_mask -> unit Specified events are not collected and won't appear in the event queue. - val get_enabled_events : unit -> event_mask The mask of currently reported events. - val get_state : event_kind -> bool Query the reporting state of an event type. - val set_state : bool -> event_kind -> unit Set the reporting state of one individual event type. 7.2.5 Handling events --------------------- - val pump : unit -> unit 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. - val wait_event : unit -> event Wait indefinitely for the next available event and return it. - val wait : unit -> unit Wait indefinitely for the next available event but leave it in the queue. - val poll : unit -> event option Poll for currently pending events and return one if available. - val has_event : unit -> bool Poll for currently pending events and return `false' if the queue is empty. - val peek : ?mask:event_mask -> int -> event list Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will not be removed from the queue. - val get : ?mask:event_mask -> int -> event list Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will be removed from the queue. - val add : event list -> unit Add events to the back of the event queue. 7.2.6 Old event-handling interface ---------------------------------- - module Old *Note Module Old: Sdlevent/Old. Deprecated. this interface was used in version of ocamlsdl < 0.6 Callback-based event handling.  File: ocamlsdl.info, Node: Sdlevent/Old, Up: Sdlevent 7.3 Module `Sdlevent.Old' ========================= 7.3.1 Description ----------------- Deprecated. this interface was used in version of ocamlsdl < 0.6 Callback-based event handling. 7.3.2 Interface --------------- 7.3.2.1 Definition of the event callbacks ......................................... - type keyboard_event_func = Sdlkey.t -> Sdlevent.switch_state -> int -> int -> unit Keyboard event called with the activated key, its state and the coordinates of the mouse pointer - type mouse_event_func = Sdlmouse.button -> Sdlevent.switch_state -> int -> int -> unit Mouse button event called with the activated button, its state and the coordinates of the mouse pointer - type mousemotion_event_func = int -> int -> unit Mouse motion event called with the coordinates of the mouse pointer - type idle_event_func = unit -> unit - type resize_event_func = int -> int -> unit 7.3.2.2 Functions for setting the current event callbacks ......................................................... - val set_keyboard_event_func : keyboard_event_func -> unit - val set_mouse_event_func : mouse_event_func -> unit - val set_mousemotion_event_func : mousemotion_event_func -> unit - val set_idle_event_func : idle_event_func -> unit - val set_resize_event_func : resize_event_func -> unit 7.3.2.3 Event loop .................. - val start_event_loop : unit -> unit - val exit_event_loop : unit -> unit  File: ocamlsdl.info, Node: Sdlvideo, Next: Sdlwm, Prev: Sdlevent, Up: Top 8 Module `Sdlvideo' ******************* 8.1 Description =============== Module for video manipulations 8.2 Interface ============= - exception Video_exn of string 8.2.1 Rectangles ---------------- - type rect = { r_x : int ; r_y : int ; r_w : int ; r_h : int ; } rectangular area (x, y, w, h) - val rect : x:int -> y:int -> w:int -> h:int -> rect - val copy_rect : rect -> rect *Returns* a copy of the rectangle 8.2.2 Video mode informations ----------------------------- - type pixel_format_info = { palette : bool ; bits_pp : int ; (* bits per pixel *) bytes_pp : int ; (* bytes per pixel *) rmask : int32 ; (* red mask value *) gmask : int32 ; (* green mask value *) bmask : int32 ; (* blue mask value *) amask : int32 ; (* alpha mask value *) rshift : int ; gshift : int ; bshift : int ; ashift : int ; rloss : int ; gloss : int ; bloss : int ; aloss : int ; colorkey : int32 ; (* RGB color key information *) alpha : int ; (* Alpha value information (per-surface alpha) *) } Structure describing how color are encoded as pixels - type video_info = { hw_available : bool ; (* Hardware surfaces? *) wm_available : bool ; (* Window manager present? *) blit_hw : bool ; (* Accelerated blits HW -> HW *) blit_hw_color_key : bool ; (* Accelerated blits with color key *) blit_hw_alpha : bool ; (* Accelerated blits with alpha *) blit_sw : bool ; (* Accelerated blits SW -> HW *) blit_sw_color_key : bool ; (* Accelerated blits with color key *) blit_sw_alpha : bool ; (* Accelerated blits with alpha *) blit_fill : bool ; (* Accelerated color fill *) video_mem : int ; (* Total amount of video memory (Ko) *) } Information on either the 'best' available mode (if called before `set_video_mode') or the current video mode. - val get_video_info : unit -> video_info - val get_video_info_format : unit -> pixel_format_info *Returns* information about the pixel format - val driver_name : unit -> string *Returns* the name of the video driver - type video_flag = [ `ANYFORMAT | `ASYNCBLIT | `DOUBLEBUF | `FULLSCREEN | `HWPALETTE | `HWSURFACE | `NOFRAME | `OPENGL | `OPENGLBLIT | `RESIZABLE | `SWSURFACE ] - type modes = | NOMODE (* no dimensions available for the requested format *) | ANY (* any dimension okay *) | DIM of (int * int) list - val list_modes : ?bpp:int -> video_flag list -> modes *Returns* a list of available screen dimensions for the given format and video flags, sorted largest to smallest or NOMODE or ANY - val video_mode_ok : w:int -> h:int -> bpp:int -> video_flag list -> int Check to see if a particular video mode is supported. *Returns* 0 if the requested mode is not supported 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, set_video_mode will succeed, but will emulate the requested bits-per-pixel with a shadow surface. 8.2.3 Surfaces -------------- - type surface Graphical surface datatype - type surface_flags = [ `ANYFORMAT | `ASYNCBLIT | `DOUBLEBUF | `FULLSCREEN | `HWACCEL | `HWPALETTE | `HWSURFACE | `NOFRAME | `OPENGL | `OPENGLBLIT | `PREALLOC | `RESIZABLE | `RLEACCEL | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] - type surface_info = { flags : Sdlvideo.surface_flags list ; w : int ; (* width *) h : int ; (* height *) pitch : int ; (* pitch *) clip_rect : Sdlvideo.rect ; (* clipping information *) refcount : int ; (* reference count *) } - val surface_info : surface -> surface_info *Returns* information for the given `surface' - val surface_format : surface -> pixel_format_info *Returns* pixel format information for the given `surface' - val surface_dims : surface -> int * int * int *Returns* width, height and pitch of the given `surface' - val surface_flags : surface -> surface_flags list *Returns* flag list for the given `surface' - val surface_bpp : surface -> int *Returns* bits-per-pixel for the given `surface' 8.2.4 Video modes-related functions ----------------------------------- - val get_video_surface : unit -> surface *Returns* the current display `surface' - val set_video_mode : w:int -> h:int -> ?bpp:int -> video_flag list -> surface Set up a video mode with the specified `width', `height' and `bits-per-pixel'. *Parameters* bpp: if omited, it is treated as the current display bits per pixel *Returns* the current display `surface' - val update_rect : ?rect:rect -> surface -> unit *Parameters* rect: makes sure the given area is updated on the given screen. The rectangle must be confined within the screen boundaries (no clipping is done). Updates the entire screen if omitted - val update_rects : rect list -> surface -> unit Makes sure the given list of rectangles is updated on the given screen. The rectangles must all be confined within the screen boundaries (no clipping is done). This function should not be called while screen is locked. - val flip : surface -> unit Swaps screen buffers. On hardware that supports double-buffering (``DOUBLEBUF'), 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 `update_rect' 8.2.5 Color manipulation ------------------------ - val set_gamma : r:float -> g:float -> b:float -> unit 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. - type color = int * int * int Format independent color description `(r,g,b)' are 8 bits unsigned integers - val black : color - val white : color - val red : color - val green : color - val blue : color - val yellow : color - val cyan : color - val magenta : color 8.2.5.1 Palettes ................ - val use_palette : surface -> bool *Returns* `true' if surface use indexed colors - val palette_ncolors : surface -> int Number of colors in the surface's palette - val get_palette_color : surface -> int -> color Retrieve a color by its index in a surface's palette - type palette_flag = | LOGPAL (* set logical palette, which controls how blits are mapped to/from the surface *) | PHYSPAL (* set physical palette, which controls how pixels look on the screen *) | LOGPHYSPAL - val set_palette : surface -> ?flag:palette_flag -> ?firstcolor:int -> color array -> unit Sets a portion of the palette for a given 8-bit `surface'. *Parameters* flag: defaults to LOGPHYSPAL *Parameters* firstcolor: where to blit the color array given as argument (defaults to 0) 8.2.5.2 Conversions ................... - val map_RGB : surface -> ?alpha:int -> color -> int32 Maps an RGB triple or an RGBA quadruple to a pixel value for a given pixel format - val get_RGB : surface -> int32 -> color Maps a pixel value into the RGB components for a given pixel format *Returns* RGB color - val get_RGBA : surface -> int32 -> color * int Maps a pixel value into the RGBA components for a given pixel format * *Returns* RGB color and alpha value 8.2.6 Creating RGB surface -------------------------- - val create_RGB_surface : [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list -> w:int -> h:int -> bpp:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface Creates a RGB surface. 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 given masks. *Returns* the new surface - val create_RGB_surface_format : surface -> [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list -> w:int -> h:int -> surface Creates a RGB surface with the same pixel format as the first parameter. - val create_RGB_surface_from_32 : (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface - val create_RGB_surface_from_24 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface - val create_RGB_surface_from_16 : (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface - val create_RGB_surface_from_8 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> w:int -> h:int -> pitch:int -> rmask:int -> gmask:int -> bmask:int -> amask:int -> surface 8.2.7 Locking/Unlocking surface ------------------------------- - val must_lock : surface -> bool *Returns* `true' if the surface should be locked before accessing its pixels - val lock : surface -> unit Sets up a surface for directly accessing the pixels. - val unlock : surface -> unit Releases the lock on the given `surface' 8.2.8 Accessing surface pixels ------------------------------ - val pixel_data : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - val pixel_data_8 : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - val pixel_data_16 : surface -> (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - val pixel_data_24 : surface -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - val pixel_data_32 : surface -> (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t - val get_pixel : surface -> x:int -> y:int -> int32 - val get_pixel_color : surface -> x:int -> y:int -> color Access an individual pixel on a surface and returns is as a `color'. The surface may have to be locked before access. - val put_pixel : surface -> x:int -> y:int -> int32 -> unit - val put_pixel_color : surface -> x:int -> y:int -> color -> unit Sets an individual pixel on a surface. The surface may have to be locked before access. 8.2.9 Reading/writing in BMP files ---------------------------------- - val load_BMP : string -> surface Loads a surface from a named Windows BMP file. - val load_BMP_from_mem : string -> surface Loads a BMP image from a memory buffer. - val save_BMP : surface -> string -> unit Saves the `surface' as a Windows BMP file named file. 8.2.10 Colorkey and alpha stuff ------------------------------- - val unset_color_key : surface -> unit - val set_color_key : surface -> ?rle:bool -> int32 -> unit Sets the color key (transparent pixel) in a blittable `surface'. - val get_color_key : surface -> int32 *Returns* the color key of the given `surface' - val unset_alpha : surface -> unit - val set_alpha : surface -> ?rle:bool -> int -> unit sets the alpha value for the entire `surface', as opposed to using the alpha component of each pixel. - val get_alpha : surface -> int *Returns* the alpha value of the given `surface' 8.2.11 Clipping --------------- - val unset_clip_rect : surface -> unit disable clipping for the given `surface' - val set_clip_rect : surface -> rect -> unit Sets the clipping rectangle for the destination `surface' in a blit. - val get_clip_rect : surface -> rect *Returns* the clipping rectangle for the destination `surface' in a blit. 8.2.12 Blitting --------------- - val blit_surface : src:surface -> ?src_rect:rect -> dst:surface -> ?dst_rect:rect -> unit -> unit Performs a fast blit from the source `surface' to the destination `surface'. *Parameters* src_rect: the width and height determine the size of the copied rectangle. If omitted, the entire surface is copied. *Parameters* dst_rect: only the position is used (the width and height are ignored). If omitted, the detination position (upper left corner) is (0, 0). The final blit rectangles are saved in `src_rect' and `dst_rect' after all clipping is performed. The blit function should not be called on a locked surface. - val fill_rect : ?rect:rect -> surface -> int32 -> unit performs a fast fill of the given rectangle with 'color' - val display_format : ?alpha:bool -> surface -> surface 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. *Parameters* alpha: if `true', include an alpha channel in the new surface  File: ocamlsdl.info, Node: Sdlwm, Next: Sdlttf, Prev: Sdlvideo, Up: Top 9 Module `Sdlwm' **************** 9.1 Description =============== Window Manager interaction 9.2 Interface ============= - val set_caption : title:string -> icon:string -> unit Sets the title and icon text of the display window - val get_caption : unit -> string * string Gets the title and icon text of the display window - val set_icon : Sdlvideo.surface -> unit Sets the icon for the display window. This function must be called before the first call to Sdlvideo.set_video_mode. - val iconify : unit -> bool This function iconifies the window, and returns `true' if it succeeded. If the function succeeds, it generates an Sdlevent.active_event loss event. This function is a noop and returns `false' in non-windowed environments. - val toggle_fullscreen : unit -> bool Toggle fullscreen mode without changing the contents of the screen. If this function was able to toggle fullscreen mode (change from running in a window to fullscreen, or vice-versa), it will return `true'. If it is not implemented, or fails, it returns `false'. - val grab_input : bool -> unit Set the input grab state of the application. 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. - val query_grab : unit -> bool  File: ocamlsdl.info, Node: Sdlttf, Next: Sdlloader, Prev: Sdlwm, Up: Top 10 Module `Sdlttf' ****************** 10.1 Description ================ This module provides TTF (TrueType Font) support 10.2 Interface ============== - exception SDLttf_exception of string Exception for reporting errors - val init : unit -> unit Initialise SDL_tff and freetype - val quit : unit -> unit Quits the system 10.2.1 General operations on font datatype ------------------------------------------ - type font abstract font datatype - val open_font : string -> ?index:int -> int -> font open a font file and create a font of the specified point size *Returns* font datatype Set and retrieve the font style This font style is implemented by modifying the font glyphs, and doesn't reflect any inherent properties of the truetype font file. - type font_style = | NORMAL | BOLD | ITALIC | UNDERLINE - val get_font_style : font -> font_style list Retrieve the font style : either `NORMAL' or a combination of `BOLD', `ITALIC' and `UNDERLINE' - val set_font_style : font -> font_style list -> unit 10.2.2 Font information ----------------------- - val font_height : font -> int *Returns* the total height(int) of the font (usually equal to point size) - val font_ascent : font -> int *Returns* the offset(int) from the baseline to the top of the font this is a positive value, relative to the baseline - val font_descent : font -> int *Returns* the offset from the baseline to the bottom of the font this is a negative value, relative to the baseline - val font_lineskip : font -> int Get the recommended spacing between lines of text for this font - val font_faces : font -> int Get the number of faces of the font Get some font face attributes, if any - val is_fixed_width : font -> bool - val family_name : font -> string - val style_name : font -> string 10.2.3 Text rendering functions ------------------------------- - val size_text : font -> string -> int * int Get the dimensions of a rendered string of text - val size_utf8 : font -> string -> int * int - val glyph_metrics : font -> char -> int * int * int * int *Returns* the metrics (minx,maxx,miny,maxy) of a glyph - type render_kind = | SOLID of Sdlvideo.color | SHADED of (Sdlvideo.color * Sdlvideo.color) | BLENDED of Sdlvideo.color Variant type for the generic rendering functions 10.2.3.1 Text rendering functions ................................. - val render_text_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_text_shaded : font -> string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface - val render_text_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_utf8_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_utf8_shaded : font -> string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface - val render_utf8_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_text : font -> render_kind -> string -> Sdlvideo.surface 10.2.3.2 Glyph rendering functions .................................. - val render_glyph_solid : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_glyph_shaded : font -> char -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface - val render_glyph_blended : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface - val render_glyph : font -> render_kind -> char -> Sdlvideo.surface  File: ocamlsdl.info, Node: Sdlloader, Next: Sdlmixer, Prev: Sdlttf, Up: Top 11 Module `Sdlloader' ********************* 11.1 Description ================ Image loader module 11.2 Interface ============== - exception SDLloader_exception of string Exception to report errors - val load_image : string -> Sdlvideo.surface load an image as a surface - val load_image_from_mem : string -> Sdlvideo.surface - val read_XPM_from_array : string array -> Sdlvideo.surface creates a surface from an array of strings (in the source code)  File: ocamlsdl.info, Node: Sdlmixer, Next: Sdlgfx, Prev: Sdlloader, Up: Top 12 Module `Sdlmixer' ******************** 12.1 Description ================ Simple multi-channel audio mixer 12.2 Interface ============== - exception SDLmixer_exception of string Exception used to report errors 12.2.1 General API ------------------ - val version : unit -> Sdl.version Get the version of the dynamically linked SDL_mixer library - type format = | AUDIO_FORMAT_U8 (* Unsigned 8-bit samples *) | AUDIO_FORMAT_S8 (* Signed 8-bit samples *) | AUDIO_FORMAT_U16LSB (* Unsigned 16-bit samples *) | AUDIO_FORMAT_S16LSB (* Signed 16-bit samples *) | AUDIO_FORMAT_U16MSB (* As above, but big-endian byte order *) | AUDIO_FORMAT_S16MSB (* As above, but big-endian byte order *) | AUDIO_FORMAT_U16SYS (* Unsigned, native audio byte ordering *) | AUDIO_FORMAT_S16SYS (* Signed, native audio byte ordering *) Audio format flags - type channels = | MONO | STEREO - val open_audio : ?freq:int -> ?format:format -> ?chunksize:int -> ?channels:channels -> unit -> unit `open_audio frequency format chunksize channels ()' opens the mixer with a certain audio format. * frequency could be 8000 11025 22050 44100 ; defaults to 22050 * format defaults to AUDIO_FORMAT_S16SYS * chunksize defaults to 4096 * channels defaults to STEREO - val close_audio : unit -> unit Close the mixer, halting all playing audio - type specs = { frequency : int ; format : Sdlmixer.format ; channels : Sdlmixer.channels ; } - val query_specs : unit -> specs Find out what the actual audio device parameters are. *Raises* `SDLmixer_exception' if the audio has not been opened 12.2.2 Samples -------------- - type chunk - val loadWAV : string -> chunk Load a wave file - val loadWAV_from_mem : string -> chunk - val load_string : string -> chunk Load a wave file of the mixer format from a memory buffer - val load_string_raw : string -> chunk Load raw audio data of the mixer format from a memory buffer - val volume_chunk : chunk -> float - val setvolume_chunk : chunk -> float -> unit - val free_chunk : chunk -> unit Free an audio chunk previously loaded 12.2.3 Channels --------------- - type channel = int - val all_channels : channel A special value for representing all channels (-1 actually). - val num_channels : unit -> int *Returns* the number of channels currently allocated - val allocate_channels : int -> int Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped. *Returns* the new number of allocated channels - val play_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> unit `play_channel channel loops ticks chunk ' Play an audio chunk. *Parameters* channel: channel to play on. If not specified, play on the first free channel. *Parameters* loops: number of times to play the chunk. If `-1', loop infinitely (~65000 times). *Parameters* ticks: if specified, play for at most 'ticks' seconds. - val play_sound : chunk -> unit Play an audio chunk. Same as above, without the optional parameters - val fadein_channel : ?channel:channel -> ?loops:int -> ?ticks:float -> chunk -> float -> unit `fadein_channel channel loops ticks chunck ms' : same as `play_channel' but fades in a over `ms' seconds. - val volume_channel : channel -> float Returns the original volume of a specific channel, chunk or music *Returns* float between 0 and 1. - val setvolume_channel : channel -> float -> unit Sets the volume for specified channel or chunk. Volume is a float between 0 and 1. If lower than 0, nothing is done. If greater than 1, volume is set to 1 - val pause_channel : channel -> unit - val resume_channel : channel -> unit - val halt_channel : channel -> unit - val expire_channel : channel -> float option -> unit `expire_channel channel ticks' Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' seconds have elapsed, or remove the expiration if 'ticks' is `None' - val fadeout_channel : channel -> float -> unit `fadeout_channel channel ticks' Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. - val playing_channel : channel -> bool - val num_playing_channel : unit -> int - val paused_channel : channel -> bool - val num_paused_channel : unit -> int - type fade_status = | NO_FADING | FADING_OUT | FADING_IN The different fading types supported - val fading_channel : channel -> fade_status Query the fading status of a channel 12.2.4 Groups ------------- - type group = int - val default_group : group The group tag used to represent the group of all the channels. Used to remove a group tag - val reserve_channels : int -> int Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if no channel is specified (see Sdlmixer.play_channel). *Returns* the number of reserved channels - val group_channel : channel -> group -> unit Attach a group tag to a channel. A group tag can be assigned to several mixer channels, to form groups of channels. If group is `default_group', the tag is removed. - val group_channels : from_c:channel -> to_c:channel -> group -> unit Same as above but for a range of channels. - val group_count : group -> int Returns the number of channels in a group. This is also a subtle way to get the total number of channels when `group' is `default_group'. - val group_available : group -> channel Finds the first available `channel' in a `group' of channels *Raises* `Not_found' if none are available. - val group_oldest : group -> channel Finds the "oldest" sample playing in a `group' of channels - val group_newer : group -> channel Finds the "most recent" (i.e. last) sample playing in a `group' of channels - val fadeout_group : group -> float -> unit `fadeout_group group ticks' Halt a group of channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take. - val halt_group : group -> unit 12.2.5 Music ------------ - type music - type music_kind = | NONE | CMD | WAV | MOD | MID | OGG | MP3 The different music types supported - val load_music : string -> music Load a music file (.mod .s3m .it .xm .ogg) - val free_music : music -> unit Free music previously loaded - val play_music : ?loops:int -> music -> unit Play a music chunk. *Parameters* loops: number of times to play through the music - val fadein_music : ?loops:int -> music -> float -> unit `fadein_music chunck loops music ms' : fade in music over `ms' seconds, same semantics as the `play_music' function - val volume_music : unit -> float - val setvolume_music : float -> unit - val pause_music : unit -> unit - val resume_music : unit -> unit - val rewind_music : unit -> unit - val set_music_cmd : string -> unit Stop music and set external music playback command - val unset_music_cmd : unit -> unit Turn off using an external command for music, returning to the internal music playing functionality - val halt_music : unit -> unit - val fadeout_music : float -> unit `fadeout_music ticks' Halt the music, fading it out progressively till it's silent. The ms parameter indicates the number of seconds the fading will take. - val music_type : music option -> music_kind Find out the music format of a mixer music, or the currently playing music, if parameter is `None'. - val playing_music : unit -> bool - val paused_music : unit -> bool - val fading_music : unit -> fade_status Query the fading status of a music  File: ocamlsdl.info, Node: Sdlgfx, Next: Types index, Prev: Sdlmixer, Up: Top 13 Module `Sdlgfx' ****************** 13.1 Interface ============== - val pixelColor : Sdlvideo.surface -> int -> int -> int32 -> bool - val pixelRGBA : Sdlvideo.surface -> int -> int -> Sdlvideo.color -> int -> bool - val rectangleColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val rectangleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val boxColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val boxRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val lineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val lineRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val aalineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val aalineRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val circleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool - val circleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool - val aacircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool - val aacircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool - val filledCircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool - val filledCircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool - val ellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val ellipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val aaellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val aaellipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val filledEllipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool - val filledEllipseRGBA : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool - val characterColor : Sdlvideo.surface -> Sdlvideo.rect -> char -> int32 -> bool - val characterRGBA : Sdlvideo.surface -> Sdlvideo.rect -> char -> Sdlvideo.color -> int -> bool - val stringColor : Sdlvideo.surface -> Sdlvideo.rect -> string -> int32 -> bool - val stringRGBA : Sdlvideo.surface -> Sdlvideo.rect -> string -> Sdlvideo.color -> int -> bool - val gfxPrimitivesSetFont : string -> int -> int -> unit - val rotozoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface - val rotozoomSurfaceXY : Sdlvideo.surface -> float -> float -> float -> bool -> Sdlvideo.surface - val zoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface  File: ocamlsdl.info, Node: Types index, Next: Exceptions index, Prev: Sdlgfx, Up: Top Types index *********** [index] * Menu: * active_event: Sdlevent. (line 58) * active_state: Sdlevent. (line 37) * button: Sdlmouse. (line 27) * cdrom_drive: Sdlcdrom. (line 29) * cdrom_drive_status: Sdlcdrom. (line 42) * cdrom_info: Sdlcdrom. (line 69) * channel: Sdlmixer. (line 137) * channels: Sdlmixer. (line 53) * chunk: Sdlmixer. (line 95) * color: Sdlvideo. (line 291) * cursor: Sdlmouse. (line 47) * cursor_data: Sdlmouse. (line 65) * event: Sdlevent. (line 202) * event_kind: Sdlevent. (line 317) * event_mask: Sdlevent. (line 216) * fade_status: Sdlmixer. (line 248) * font: Sdlttf. (line 36) * font_style: Sdlttf. (line 55) * format: Sdlmixer. (line 46) * group: Sdlmixer. (line 262) * hat_value: Sdljoystick. (line 110) * idle_event_func: Sdlevent/Old. (line 38) * joyaxis_event: Sdlevent. (line 124) * joyball_event: Sdlevent. (line 138) * joybutton_event: Sdlevent. (line 165) * joyhat_event: Sdlevent. (line 153) * keyboard_event: Sdlevent. (line 80) * keyboard_event_func: Sdlevent/Old. (line 21) * mod_state: Sdlkey. (line 355) * modes: Sdlvideo. (line 137) * mouse_event_func: Sdlevent/Old. (line 27) * mousebutton_event: Sdlevent. (line 112) * mousemotion_event: Sdlevent. (line 97) * mousemotion_event_func: Sdlevent/Old. (line 33) * music: Sdlmixer. (line 337) * music_kind: Sdlmixer. (line 347) * palette_flag: Sdlvideo. (line 357) * pixel_format_info: Sdlvideo. (line 71) * rect: Sdlvideo. (line 27) * render_kind: Sdlttf. (line 140) * resize_event_func: Sdlevent/Old. (line 41) * specs: Sdlmixer. (line 82) * subsystem: Sdl. (line 24) * surface: Sdlvideo. (line 161) * surface_flags: Sdlvideo. (line 181) * surface_info: Sdlvideo. (line 196) * switch_state: Sdlevent. (line 65) * t <1>: Sdlkey. (line 266) * t: Sdljoystick. (line 24) * track: Sdlcdrom. (line 61) * track_type: Sdlcdrom. (line 51) * version: Sdl. (line 77) * video_flag: Sdlvideo. (line 129) * video_info: Sdlvideo. (line 97)  File: ocamlsdl.info, Node: Exceptions index, Next: Values index, Prev: Types index, Up: Top Exceptions index **************** [index] * Menu: * Event_exn: Sdlevent. (line 23) * SDL_init_exception: Sdl. (line 16) * SDLcdrom_exception: Sdlcdrom. (line 16) * SDLjoystick_exception: Sdljoystick. (line 19) * SDLloader_exception: Sdlloader. (line 16) * SDLmixer_exception: Sdlmixer. (line 16) * SDLttf_exception: Sdlttf. (line 16) * Trayempty: Sdlcdrom. (line 21) * Video_exn: Sdlvideo. (line 16)  File: ocamlsdl.info, Node: Values index, Next: Modules index, Prev: Exceptions index, Up: Top Values index ************ [index] * Menu: * aacircleColor: Sdlgfx. (line 64) * aacircleRGBA: Sdlgfx. (line 68) * aaellipseColor: Sdlgfx. (line 89) * aaellipseRGBA: Sdlgfx. (line 94) * aalineColor: Sdlgfx. (line 47) * aalineRGBA: Sdlgfx. (line 52) * active_mask: Sdlevent. (line 222) * add: Sdlevent. (line 417) * all_channels: Sdlmixer. (line 141) * all_events_mask: Sdlevent. (line 298) * allocate_channels: Sdlmixer. (line 153) * black: Sdlvideo. (line 298) * blit_surface: Sdlvideo. (line 610) * blue: Sdlvideo. (line 314) * boxColor: Sdlgfx. (line 29) * boxRGBA: Sdlgfx. (line 34) * cd_close: Sdlcdrom. (line 100) * cd_eject: Sdlcdrom. (line 168) * cd_info: Sdlcdrom. (line 112) * cd_open: Sdlcdrom. (line 94) * cd_pause: Sdlcdrom. (line 150) * cd_play_track: Sdlcdrom. (line 144) * cd_play_tracks: Sdlcdrom. (line 132) * cd_resume: Sdlcdrom. (line 156) * cd_status: Sdlcdrom. (line 106) * cd_stop: Sdlcdrom. (line 162) * char_of_key: Sdlkey. (line 285) * characterColor: Sdlgfx. (line 107) * characterRGBA: Sdlgfx. (line 111) * circleColor: Sdlgfx. (line 56) * circleRGBA: Sdlgfx. (line 60) * close: Sdljoystick. (line 166) * close_audio: Sdlmixer. (line 73) * convert_to_cursor: Sdlmouse. (line 130) * copy_rect: Sdlvideo. (line 37) * create_RGB_surface: Sdlvideo. (line 404) * create_RGB_surface_format: Sdlvideo. (line 415) * create_RGB_surface_from_16: Sdlvideo. (line 442) * create_RGB_surface_from_24: Sdlvideo. (line 434) * create_RGB_surface_from_32: Sdlvideo. (line 426) * create_RGB_surface_from_8: Sdlvideo. (line 450) * cursor_data: Sdlmouse. (line 117) * cursor_visible: Sdlmouse. (line 105) * cyan: Sdlvideo. (line 322) * default_group: Sdlmixer. (line 266) * delay: Sdltimer. (line 17) * disable_events: Sdlevent. (line 339) * disable_key_repeat: Sdlkey. (line 323) * display_format: Sdlvideo. (line 633) * drive_name: Sdlcdrom. (line 83) * driver_name: Sdlvideo. (line 114) * ellipseColor: Sdlgfx. (line 80) * ellipseRGBA: Sdlgfx. (line 85) * enable_events: Sdlevent. (line 332) * enable_key_repeat: Sdlkey. (line 329) * enable_unicode: Sdlkey. (line 313) * exit_event_loop: Sdlevent/Old. (line 75) * expire_channel: Sdlmixer. (line 214) * fadein_channel: Sdlmixer. (line 180) * fadein_music: Sdlmixer. (line 372) * fadeout_channel: Sdlmixer. (line 222) * fadeout_group: Sdlmixer. (line 323) * fadeout_music: Sdlmixer. (line 416) * fading_channel: Sdlmixer. (line 254) * fading_music: Sdlmixer. (line 439) * family_name: Sdlttf. (line 111) * fill_rect: Sdlvideo. (line 627) * filledCircleColor: Sdlgfx. (line 72) * filledCircleRGBA: Sdlgfx. (line 76) * filledEllipseColor: Sdlgfx. (line 98) * filledEllipseRGBA: Sdlgfx. (line 103) * flip: Sdlvideo. (line 266) * font_ascent: Sdlttf. (line 80) * font_descent: Sdlttf. (line 87) * font_faces: Sdlttf. (line 100) * font_height: Sdlttf. (line 73) * font_lineskip: Sdlttf. (line 94) * frames_of_msf: Sdlcdrom. (line 126) * free_chunk: Sdlmixer. (line 129) * free_cursor: Sdlmouse. (line 85) * free_music: Sdlmixer. (line 359) * get: Sdlevent. (line 409) * get_alpha: Sdlvideo. (line 577) * get_app_state: Sdlevent. (line 43) * get_axis: Sdljoystick. (line 150) * get_ball: Sdljoystick. (line 158) * get_button: Sdljoystick. (line 162) * get_caption: Sdlwm. (line 23) * get_clip_rect: Sdlvideo. (line 598) * get_color_key: Sdlvideo. (line 560) * get_cursor: Sdlmouse. (line 99) * get_enabled_events: Sdlevent. (line 346) * get_event_state: Sdljoystick. (line 107) * get_font_style: Sdlttf. (line 59) * get_hat: Sdljoystick. (line 154) * get_key_state: Sdlkey. (line 339) * get_mod_state: Sdlkey. (line 424) * get_num_drives: Sdlcdrom. (line 77) * get_palette_color: Sdlvideo. (line 345) * get_pixel: Sdlvideo. (line 504) * get_pixel_color: Sdlvideo. (line 508) * get_RGB: Sdlvideo. (line 382) * get_RGBA: Sdlvideo. (line 389) * get_state <1>: Sdlevent. (line 352) * get_state: Sdlmouse. (line 31) * get_ticks: Sdltimer. (line 23) * get_video_info: Sdlvideo. (line 104) * get_video_info_format: Sdlvideo. (line 108) * get_video_surface: Sdlvideo. (line 233) * getenv: Sdl. (line 94) * gfxPrimitivesSetFont: Sdlgfx. (line 123) * glyph_metrics: Sdlttf. (line 132) * grab_input: Sdlwm. (line 54) * green: Sdlvideo. (line 310) * group_available: Sdlmixer. (line 303) * group_channel: Sdlmixer. (line 282) * group_channels: Sdlmixer. (line 290) * group_count: Sdlmixer. (line 296) * group_newer: Sdlmixer. (line 316) * group_oldest: Sdlmixer. (line 310) * halt_channel: Sdlmixer. (line 210) * halt_group: Sdlmixer. (line 331) * halt_music: Sdlmixer. (line 412) * has_event: Sdlevent. (line 394) * hat_centered: Sdljoystick. (line 114) * hat_down: Sdljoystick. (line 126) * hat_left: Sdljoystick. (line 130) * hat_leftdown: Sdljoystick. (line 146) * hat_leftup: Sdljoystick. (line 142) * hat_right: Sdljoystick. (line 122) * hat_rightdown: Sdljoystick. (line 138) * hat_rightup: Sdljoystick. (line 134) * hat_up: Sdljoystick. (line 118) * iconify: Sdlwm. (line 36) * index: Sdljoystick. (line 58) * init <1>: Sdlttf. (line 22) * init: Sdl. (line 39) * init_subsystem: Sdl. (line 52) * int_of_key: Sdlkey. (line 272) * is_fixed_width: Sdlttf. (line 107) * is_key_pressed: Sdlkey. (line 347) * joyaxismotion_mask: Sdlevent. (line 246) * joyballmotion_mask: Sdlevent. (line 250) * joybuttondown_mask: Sdlevent. (line 258) * joybuttonup_mask: Sdlevent. (line 262) * joyhatmotion_mask: Sdlevent. (line 254) * joystick_event_mask: Sdlevent. (line 294) * key_of_int: Sdlkey. (line 278) * keyboard_event_mask: Sdlevent. (line 286) * keydown_mask: Sdlevent. (line 226) * keyup_mask: Sdlevent. (line 230) * kmod_alt: Sdlkey. (line 416) * kmod_caps: Sdlkey. (line 400) * kmod_ctrl: Sdlkey. (line 408) * kmod_lalt: Sdlkey. (line 380) * kmod_lctrl: Sdlkey. (line 372) * kmod_lmeta: Sdlkey. (line 388) * kmod_lshift: Sdlkey. (line 364) * kmod_meta: Sdlkey. (line 420) * kmod_mode: Sdlkey. (line 404) * kmod_none: Sdlkey. (line 360) * kmod_num: Sdlkey. (line 396) * kmod_ralt: Sdlkey. (line 384) * kmod_rctrl: Sdlkey. (line 376) * kmod_rmeta: Sdlkey. (line 392) * kmod_rshift: Sdlkey. (line 368) * kmod_shift: Sdlkey. (line 412) * lineColor: Sdlgfx. (line 38) * lineRGBA: Sdlgfx. (line 43) * list_modes: Sdlvideo. (line 141) * load_BMP: Sdlvideo. (line 529) * load_BMP_from_mem: Sdlvideo. (line 535) * load_image: Sdlloader. (line 22) * load_image_from_mem: Sdlloader. (line 28) * load_music: Sdlmixer. (line 353) * load_string: Sdlmixer. (line 109) * load_string_raw: Sdlmixer. (line 115) * loadWAV: Sdlmixer. (line 99) * loadWAV_from_mem: Sdlmixer. (line 105) * lock: Sdlvideo. (line 464) * magenta: Sdlvideo. (line 326) * make_cursor: Sdlmouse. (line 71) * make_mask: Sdlevent. (line 321) * map_RGB: Sdlvideo. (line 375) * max_code: Sdlkey. (line 298) * mouse_event_mask: Sdlevent. (line 290) * mousebuttondown_mask: Sdlevent. (line 238) * mousebuttonup_mask: Sdlevent. (line 242) * mousemotion_mask: Sdlevent. (line 234) * msf_of_frames: Sdlcdrom. (line 122) * music_type: Sdlmixer. (line 424) * must_lock: Sdlvideo. (line 457) * name <1>: Sdlkey. (line 304) * name: Sdljoystick. (line 36) * num_axes: Sdljoystick. (line 64) * num_balls: Sdljoystick. (line 70) * num_buttons: Sdljoystick. (line 84) * num_channels: Sdlmixer. (line 147) * num_hats: Sdljoystick. (line 78) * num_joysticks: Sdljoystick. (line 30) * num_keys: Sdlkey. (line 292) * num_paused_channel: Sdlmixer. (line 242) * num_playing_channel: Sdlmixer. (line 234) * of_mask: Sdlevent. (line 325) * open_audio: Sdlmixer. (line 59) * open_font: Sdlttf. (line 42) * open_joystick: Sdljoystick. (line 43) * opened: Sdljoystick. (line 52) * palette_ncolors: Sdlvideo. (line 339) * pause_channel: Sdlmixer. (line 202) * pause_music: Sdlmixer. (line 387) * paused_channel: Sdlmixer. (line 238) * paused_music: Sdlmixer. (line 435) * peek: Sdlevent. (line 401) * pixel_data: Sdlvideo. (line 480) * pixel_data_16: Sdlvideo. (line 490) * pixel_data_24: Sdlvideo. (line 495) * pixel_data_32: Sdlvideo. (line 500) * pixel_data_8: Sdlvideo. (line 485) * pixelColor: Sdlgfx. (line 12) * pixelRGBA: Sdlgfx. (line 16) * play_channel: Sdlmixer. (line 162) * play_music: Sdlmixer. (line 365) * play_sound: Sdlmixer. (line 173) * playing_channel: Sdlmixer. (line 230) * playing_music: Sdlmixer. (line 431) * poll: Sdlevent. (line 388) * pprint_cursor: Sdlmouse. (line 123) * pump: Sdlevent. (line 367) * put_pixel: Sdlvideo. (line 515) * put_pixel_color: Sdlvideo. (line 519) * putenv: Sdl. (line 98) * query_grab: Sdlwm. (line 63) * query_specs: Sdlmixer. (line 86) * query_unicode: Sdlkey. (line 319) * quit <1>: Sdlttf. (line 28) * quit: Sdl. (line 60) * quit_mask: Sdlevent. (line 266) * quit_subsystem: Sdl. (line 67) * read_XPM_from_array: Sdlloader. (line 32) * rect: Sdlvideo. (line 33) * rectangleColor: Sdlgfx. (line 20) * rectangleRGBA: Sdlgfx. (line 25) * red: Sdlvideo. (line 306) * render_glyph: Sdlttf. (line 195) * render_glyph_blended: Sdlttf. (line 191) * render_glyph_shaded: Sdlttf. (line 187) * render_glyph_solid: Sdlttf. (line 182) * render_text: Sdlttf. (line 175) * render_text_blended: Sdlttf. (line 158) * render_text_shaded: Sdlttf. (line 154) * render_text_solid: Sdlttf. (line 149) * render_utf8_blended: Sdlttf. (line 171) * render_utf8_shaded: Sdlttf. (line 167) * render_utf8_solid: Sdlttf. (line 162) * reserve_channels: Sdlmixer. (line 273) * resume_channel: Sdlmixer. (line 206) * resume_music: Sdlmixer. (line 391) * rewind_music: Sdlmixer. (line 395) * rotozoomSurface: Sdlgfx. (line 127) * rotozoomSurfaceXY: Sdlgfx. (line 131) * save_BMP: Sdlvideo. (line 541) * set_alpha: Sdlvideo. (line 570) * set_caption: Sdlwm. (line 17) * set_clip_rect: Sdlvideo. (line 592) * set_color_key: Sdlvideo. (line 554) * set_cursor: Sdlmouse. (line 91) * set_event_state: Sdljoystick. (line 103) * set_font_style: Sdlttf. (line 66) * set_gamma: Sdlvideo. (line 283) * set_icon: Sdlwm. (line 29) * set_idle_event_func: Sdlevent/Old. (line 60) * set_keyboard_event_func: Sdlevent/Old. (line 48) * set_mod_state: Sdlkey. (line 430) * set_mouse_event_func: Sdlevent/Old. (line 52) * set_mousemotion_event_func: Sdlevent/Old. (line 56) * set_music_cmd: Sdlmixer. (line 399) * set_palette: Sdlvideo. (line 363) * set_resize_event_func: Sdlevent/Old. (line 64) * set_state: Sdlevent. (line 358) * set_video_mode: Sdlvideo. (line 239) * setvolume_channel: Sdlmixer. (line 194) * setvolume_chunk: Sdlmixer. (line 125) * setvolume_music: Sdlmixer. (line 383) * show_cursor: Sdlmouse. (line 111) * size_text: Sdlttf. (line 122) * size_utf8: Sdlttf. (line 128) * start_event_loop: Sdlevent/Old. (line 71) * string_of_event: Sdlevent. (line 208) * string_of_version: Sdl. (line 87) * stringColor: Sdlgfx. (line 115) * stringRGBA: Sdlgfx. (line 119) * style_name: Sdlttf. (line 115) * surface_bpp: Sdlvideo. (line 224) * surface_dims: Sdlvideo. (line 212) * surface_flags: Sdlvideo. (line 218) * surface_format: Sdlvideo. (line 206) * surface_info: Sdlvideo. (line 200) * syswmevent_mask: Sdlevent. (line 270) * toggle_fullscreen: Sdlwm. (line 45) * unlock: Sdlvideo. (line 470) * unset_alpha: Sdlvideo. (line 566) * unset_clip_rect: Sdlvideo. (line 586) * unset_color_key: Sdlvideo. (line 550) * unset_music_cmd: Sdlmixer. (line 405) * update: Sdljoystick. (line 93) * update_rect: Sdlvideo. (line 249) * update_rects: Sdlvideo. (line 257) * use_palette: Sdlvideo. (line 333) * userevent_mask: Sdlevent. (line 282) * version <1>: Sdlmixer. (line 25) * version: Sdl. (line 81) * video_mode_ok: Sdlvideo. (line 148) * videoexpose_mask: Sdlevent. (line 278) * videoresize_mask: Sdlevent. (line 274) * volume_channel: Sdlmixer. (line 187) * volume_chunk: Sdlmixer. (line 121) * volume_music: Sdlmixer. (line 379) * wait: Sdlevent. (line 381) * wait_event: Sdlevent. (line 375) * warp: Sdlmouse. (line 39) * was_init: Sdl. (line 56) * white: Sdlvideo. (line 302) * yellow: Sdlvideo. (line 318) * zoomSurface: Sdlgfx. (line 135)  File: ocamlsdl.info, Node: Modules index, Prev: Values index, Up: Top Modules index ************* [index] * Menu: * Old: Sdlevent/Old. (line 6) * Sdl: Sdl. (line 6) * Sdlcdrom: Sdlcdrom. (line 6) * Sdlevent: Sdlevent. (line 6) * Sdlgfx: Sdlgfx. (line 6) * Sdljoystick: Sdljoystick. (line 6) * Sdlkey: Sdlkey. (line 6) * Sdlloader: Sdlloader. (line 6) * Sdlmixer: Sdlmixer. (line 6) * Sdlmouse: Sdlmouse. (line 6) * Sdltimer: Sdltimer. (line 6) * Sdlttf: Sdlttf. (line 6) * Sdlvideo: Sdlvideo. (line 6) * Sdlwm: Sdlwm. (line 6)  Tag Table: Node: Top257 Node: Sdl1008 Node: Sdlcdrom2767 Node: Sdltimer5883 Node: Sdljoystick6306 Node: Sdlkey9225 Node: Sdlmouse16016 Node: Sdlevent18863 Node: Sdlevent/Old27376 Node: Sdlvideo28951 Node: Sdlwm42715 Node: Sdlttf44232 Node: Sdlloader48051 Node: Sdlmixer48636 Node: Sdlgfx57145 Node: Types index60391 Node: Exceptions index64473 Node: Values index65286 Node: Modules index89161  End Tag Table ocamlsdl-0.9.1/doc/ocamlsdl-mingw.txt0000664000076400007640000000405510101151135016250 0ustar olivoliv HOWTO use ocamlsdl with the Mingw port of OCaml and the Cygwin environment 1. Get Cygwin/Mingw. Get the development packages, namely gcc and gcc-mingw. I couldn't get gcc 3.2 to work so I used the package gcc-2. 2. Get OCaml 3.06 from INRIA and build it. Instructions are in the file README.win32. Follow the instructions for "Mingw port" (smthg like that). The "make opt.opt" step kept crashing my Windows so I skipped it. Install ocaml somewhere. 3. Get SDL, compile and install. There are some additional instructions here : http://www.libsdl.org/extras/win32/gcc.html like where to get nasm.exe. 4. Now get and unpack ocamlsdl-0.6.1 5. Make sure the ocaml compilers are in your PATH (try ocamlc -v). Make sure sdl-config is in your PATH. Make sure the SDL.dll is in your PATH. Run ./configure -- it should work ; if not, check what's wrong in config.log . make -- builds the libraries (no toplevel). cd samples && make testalpha.test testalpha.opt -- try to run them, they should work. What it does: The file mlsdl_main.c is a near copy of SDL_main.c. It defines a WinMain entry point that overrides the usual entry point of the caml program. It does a few initialisation stuff and then calls "caml_main" to start the caml program (whereas the SDL_main.c supplied by SDL calls a regular C "main" entry point). This mlsdl_main.c file is compiled as a liblsdl_main.a library and -lmlsdl_main is added to the link options of sdl.cma (in replacement of -lSDL_main). Some various gotchas: - this produces windowed apps, not console apps, so they will not pop up a console when starting. OTOH, there's no standard or error output. In particular, uncaught exceptions do not produce an error message. - ocaml compilers do not like cygwin-style paths. You can use the cygpath tool to convert them. Instead of : -I ~/ocamlsdl-0.6/src try : -I $(cygpath -w ~/ocamlsdl-0.6/src) -- Olivier Andrieu ocamlsdl-0.9.1/doc/html/0000775000076400007640000000000011760735641013560 5ustar olivolivocamlsdl-0.9.1/doc/html/Sdlcdrom.html0000664000076400007640000002752011774643040016217 0ustar olivoliv OCamlSDL 0.9.1 : Sdlcdrom

Module Sdlcdrom


module Sdlcdrom: sig .. end
This module provides CD-ROM handling

exception SDLcdrom_exception of string
Exception used to report errors
exception Trayempty
Exception to report that thre's no cd in the drive

Types


type cdrom_drive 
abstract type for handling cdrom

type cdrom_drive_status =
| CD_TRAYEMPTY (*cdrom drive is empty*)
| CD_STOPPED (*cdrom drive is stopped*)
| CD_PLAYING (*cdrom drive is playing*)
| CD_PAUSED (*cdrom drive is paused*)
enumeration of different status cdrom drive

type track_type =
| TRACK_AUDIO (*audio track type*)
| TRACK_DATA (*data track type*)
the types of CD-ROM track possible

type track = {
   id : int;
   kind : track_type;
   length : int;
   offset : int;
}
type cdrom_info = {
   num_tracks : int;
   curr_track : int;
   curr_frame : int;
   tracks : track array;
}

General API



An SDLcdrom_exception is raised on errors
val get_num_drives : unit -> int
get_num_drives returns the number of CD-ROM drives on the system
val drive_name : int -> string
drive_name drive 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 get_num_drives()-1.

CD-ROM drive handling


val cd_open : int -> cdrom_drive
cd_open drive open a CD-ROM drive for access
val cd_close : cdrom_drive -> unit
Closes the handle for the cdrom_drive
val cd_status : cdrom_drive -> cdrom_drive_status
Returns the current status of the given drive.
val cd_info : cdrom_drive -> cdrom_info
Raises Trayempty if there's no cd in the drive
Returns the table of contents of the CD and current play position

Playing audio tracks


val msf_of_frames : int -> int * int * int
val frames_of_msf : int * int * int -> int
val cd_play_tracks : cdrom_drive ->
start_track:int ->
start_frame:int -> num_tracks:int -> num_frames:int -> unit
cd_play_tracks cdrom_drive start_track start_frame num_tracks num_frames play the given CD with these parameters
Raises Trayempty if there's no cd in the drive
start_track : the starting track
start_frame : the starting frame
num_tracks : the number of tracks to play
num_frames : the number of frames to play
val cd_play_track : cdrom_drive -> track -> unit
Play the track n on the given cdrom_drive
val cd_pause : cdrom_drive -> unit
Pause play
val cd_resume : cdrom_drive -> unit
Resume play
val cd_stop : cdrom_drive -> unit
Stop play
val cd_eject : cdrom_drive -> unit
Eject CD-ROM
ocamlsdl-0.9.1/doc/html/type_Sdlttf.html0000664000076400007640000002502611774643041016751 0ustar olivoliv OCamlSDL 0.9.1 : Sdlttf sig
  exception SDLttf_exception of string
  val init : unit -> unit
  val quit : unit -> unit
  type font
  val open_font : string -> ?index:int -> int -> Sdlttf.font
  type font_style = NORMAL | BOLD | ITALIC | UNDERLINE
  val get_font_style : Sdlttf.font -> Sdlttf.font_style list
  val set_font_style : Sdlttf.font -> Sdlttf.font_style list -> unit
  val font_height : Sdlttf.font -> int
  val font_ascent : Sdlttf.font -> int
  val font_descent : Sdlttf.font -> int
  val font_lineskip : Sdlttf.font -> int
  val font_faces : Sdlttf.font -> int
  val is_fixed_width : Sdlttf.font -> bool
  val family_name : Sdlttf.font -> string
  val style_name : Sdlttf.font -> string
  val size_text : Sdlttf.font -> string -> int * int
  val size_utf8 : Sdlttf.font -> string -> int * int
  val glyph_metrics : Sdlttf.font -> char -> int * int * int * int
  type render_kind =
      SOLID of Sdlvideo.color
    | SHADED of Sdlvideo.color * Sdlvideo.color
    | BLENDED of Sdlvideo.color
  val render_text_solid :
    Sdlttf.font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_text_shaded :
    Sdlttf.font ->
    string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
  val render_text_blended :
    Sdlttf.font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_utf8_solid :
    Sdlttf.font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_utf8_shaded :
    Sdlttf.font ->
    string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
  val render_utf8_blended :
    Sdlttf.font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_text :
    Sdlttf.font -> Sdlttf.render_kind -> string -> Sdlvideo.surface
  val render_glyph_solid :
    Sdlttf.font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_glyph_shaded :
    Sdlttf.font ->
    char -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
  val render_glyph_blended :
    Sdlttf.font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface
  val render_glyph :
    Sdlttf.font -> Sdlttf.render_kind -> char -> Sdlvideo.surface
end
ocamlsdl-0.9.1/doc/html/Sdlevent.html0000664000076400007640000011762411774643041016242 0ustar olivoliv OCamlSDL 0.9.1 : Sdlevent

Module Sdlevent


module Sdlevent: sig .. end
SDL event handling

exception Event_exn of string
The exception used for reporting events-related errors.

Application focus



type active_state =
| MOUSEFOCUS (*The app has mouse coverage*)
| INPUTFOCUS (*The app has input focus*)
| APPACTIVE (*The application is active*)
The available application states
val get_app_state : unit -> active_state list
This function returns the current state of the application. If ACTIVE is set, then the user is able to see your application, otherwise it has been iconified or disabled.

Events datatypes



type active_event = {
   gain : bool; (*Whether given states were gained or lost*)
   ae_state : active_state list; (*A list of the focus states*)
}
Application visibility event record

type switch_state =
| RELEASED
| PRESSED

type keyboard_event = {
   ke_which : int; (*The keyboard device index*)
   ke_state : switch_state; (*PRESSED or RELEASED*)
   keysym : Sdlkey.t; (*SDL virtual keysym*)
   keymod : Sdlkey.mod_state; (*current key modifiers*)
   keycode : char; (*translated character*)
   unicode : int;
}
Keyboard event record

type mousemotion_event = {
   mme_which : int; (*The mouse device index*)
   mme_state : Sdlmouse.button list; (*The current button state*)
   mme_x : int; (*The X/Y coordinates of the mouse*)
   mme_y : int;
   mme_xrel : int; (*The relative motion in the X direction*)
   mme_yrel : int; (*The relative motion in the Y direction*)
}
Mouse motion event record

type mousebutton_event = {
   mbe_which : int; (*The mouse device index*)
   mbe_button : Sdlmouse.button; (*The mouse button index*)
   mbe_state : switch_state; (*PRESSED or RELEASED*)
   mbe_x : int; (*The X/Y coordinates of the mouse at press time*)
   mbe_y : int;
}
Mouse button event record

type joyaxis_event = {
   jae_which : int; (*The joystick device index*)
   jae_axis : int; (*The joystick axis index*)
   jae_value : int; (*The axis value (range: -32768 to 32767)*)
}
Joystick axis motion event record

type joyball_event = {
   jle_which : int; (*The joystick device index*)
   jle_ball : int; (*The joystick trackball index*)
   jle_xrel : int; (*The relative motion in the X direction*)
   jle_yrel : int; (*The relative motion in the Y direction*)
}
Joystick axis motion event record

type joyhat_event = {
   jhe_which : int; (*The joystick device index*)
   jhe_hat : int; (*The joystick hat index*)
   jhe_value : int; (*The hat position value:
                          8   1   2
                          7   0   3
                          6   5   4
Note that zero means the POV is centered.
*)
}
Joystick hat position change event record

type joybutton_event = {
   jbe_which : int; (*The joystick device index*)
   jbe_button : int; (*The joystick button index*)
   jbe_state : switch_state; (*PRESSED or RELEASED*)
}
Joystick button event record

type event =
| ACTIVE of active_event (*Application loses/gains visibility*)
| KEYDOWN of keyboard_event (*Keys pressed*)
| KEYUP of keyboard_event (*Keys released*)
| MOUSEMOTION of mousemotion_event (*Mouse moved*)
| MOUSEBUTTONDOWN of mousebutton_event (*Mouse button pressed*)
| MOUSEBUTTONUP of mousebutton_event (*Mouse button released*)
| JOYAXISMOTION of joyaxis_event (*Joystick axis motion*)
| JOYBALLMOTION of joyball_event (*Joystick trackball motion*)
| JOYHATMOTION of joyhat_event (*Joystick hat position change*)
| JOYBUTTONDOWN of joybutton_event (*Joystick button pressed*)
| JOYBUTTONUP of joybutton_event (*Joystick button released*)
| QUIT (*User-requested quit*)
| SYSWM (*System specific event*)
| VIDEORESIZE of int * int (*User resized video mode*)
| VIDEOEXPOSE (*Screen needs to be redrawn*)
| USER of int (*for your use !*)
The main event type
val string_of_event : event -> string
Returns a short string descriptive of the event type, for debugging

Event masks


type event_mask = int 

Event masks values are ints and should be manipulated with lor, land, etc.
val active_mask : event_mask
val keydown_mask : event_mask
val keyup_mask : event_mask
val mousemotion_mask : event_mask
val mousebuttondown_mask : event_mask
val mousebuttonup_mask : event_mask
val joyaxismotion_mask : event_mask
val joyballmotion_mask : event_mask
val joyhatmotion_mask : event_mask
val joybuttondown_mask : event_mask
val joybuttonup_mask : event_mask
val quit_mask : event_mask
val syswmevent_mask : event_mask
val videoresize_mask : event_mask
val videoexpose_mask : event_mask
val userevent_mask : event_mask
val keyboard_event_mask : event_mask
val mouse_event_mask : event_mask
val joystick_event_mask : event_mask
val all_events_mask : event_mask

type event_kind =
| ACTIVE_EVENT
| KEYDOWN_EVENT
| KEYUP_EVENT
| MOUSEMOTION_EVENT
| MOUSEBUTTONDOWN_EVENT
| MOUSEBUTTONUP_EVENT
| JOYAXISMOTION_EVENT
| JOYBALL_EVENT
| JOYHAT_EVENT
| JOYBUTTONDOWN_EVENT
| JOYBUTTONUP_EVENT
| QUIT_EVENT
| SYSWM_EVENT
| RESIZE_EVENT
| EXPOSE_EVENT
| USER_EVENT
val make_mask : event_kind list -> event_mask
val of_mask : event_mask -> event_kind list

Enabling/Disabling event collecting


val enable_events : event_mask -> unit
Specified events are collected and added to the event queue (when pump is called).
val disable_events : event_mask -> unit
Specified events are not collected and won't appear in the event queue.
val get_enabled_events : unit -> event_mask
The mask of currently reported events.
val get_state : event_kind -> bool
Query the reporting state of an event type.
val set_state : bool -> event_kind -> unit
Set the reporting state of one individual event type.

Handling events


val pump : unit -> unit
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.
val wait_event : unit -> event
Wait indefinitely for the next available event and return it.
val wait : unit -> unit
Wait indefinitely for the next available event but leave it in the queue.
val poll : unit -> event option
Poll for currently pending events and return one if available.
val has_event : unit -> bool
Poll for currently pending events and return false if the queue is empty.
val peek : ?mask:event_mask -> int -> event list
Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will not be removed from the queue.
val get : ?mask:event_mask -> int -> event list
Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will be removed from the queue.
val add : event list -> unit
Add events to the back of the event queue.

Old event-handling interface


module Old: sig .. end
Callback-based event handling.
ocamlsdl-0.9.1/doc/html/Sdlgfx.html0000664000076400007640000002463211774643041015701 0ustar olivoliv OCamlSDL 0.9.1 : Sdlgfx

Module Sdlgfx


module Sdlgfx: sig .. end

val pixelColor : Sdlvideo.surface -> int -> int -> int32 -> bool
val pixelRGBA : Sdlvideo.surface -> int -> int -> Sdlvideo.color -> int -> bool
val rectangleColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val rectangleRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val boxColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val boxRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val lineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val lineRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val aalineColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val aalineRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val circleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
val circleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
val aacircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
val aacircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
val filledCircleColor : Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
val filledCircleRGBA : Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
val ellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val ellipseRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val aaellipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val aaellipseRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val filledEllipseColor : Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
val filledEllipseRGBA : Sdlvideo.surface ->
Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
val characterColor : Sdlvideo.surface -> Sdlvideo.rect -> char -> int32 -> bool
val characterRGBA : Sdlvideo.surface -> Sdlvideo.rect -> char -> Sdlvideo.color -> int -> bool
val stringColor : Sdlvideo.surface -> Sdlvideo.rect -> string -> int32 -> bool
val stringRGBA : Sdlvideo.surface -> Sdlvideo.rect -> string -> Sdlvideo.color -> int -> bool
val gfxPrimitivesSetFont : string -> int -> int -> unit
val rotozoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface
val rotozoomSurfaceXY : Sdlvideo.surface -> float -> float -> float -> bool -> Sdlvideo.surface
val zoomSurface : Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface
ocamlsdl-0.9.1/doc/html/type_Sdlcdrom.html0000664000076400007640000001374611774643040017265 0ustar olivoliv OCamlSDL 0.9.1 : Sdlcdrom sig
  exception SDLcdrom_exception of string
  exception Trayempty
  type cdrom_drive
  type cdrom_drive_status =
      CD_TRAYEMPTY
    | CD_STOPPED
    | CD_PLAYING
    | CD_PAUSED
  type track_type = TRACK_AUDIO | TRACK_DATA
  type track = {
    id : int;
    kind : Sdlcdrom.track_type;
    length : int;
    offset : int;
  }
  type cdrom_info = {
    num_tracks : int;
    curr_track : int;
    curr_frame : int;
    tracks : Sdlcdrom.track array;
  }
  val get_num_drives : unit -> int
  val drive_name : int -> string
  val cd_open : int -> Sdlcdrom.cdrom_drive
  val cd_close : Sdlcdrom.cdrom_drive -> unit
  val cd_status : Sdlcdrom.cdrom_drive -> Sdlcdrom.cdrom_drive_status
  val cd_info : Sdlcdrom.cdrom_drive -> Sdlcdrom.cdrom_info
  val msf_of_frames : int -> int * int * int
  val frames_of_msf : int * int * int -> int
  val cd_play_tracks :
    Sdlcdrom.cdrom_drive ->
    start_track:int ->
    start_frame:int -> num_tracks:int -> num_frames:int -> unit
  val cd_play_track : Sdlcdrom.cdrom_drive -> Sdlcdrom.track -> unit
  val cd_pause : Sdlcdrom.cdrom_drive -> unit
  val cd_resume : Sdlcdrom.cdrom_drive -> unit
  val cd_stop : Sdlcdrom.cdrom_drive -> unit
  val cd_eject : Sdlcdrom.cdrom_drive -> unit
end
ocamlsdl-0.9.1/doc/html/index_values.html0000664000076400007640000015516411774643042017146 0ustar olivoliv OCamlSDL 0.9.1 : Index of values

Index of values


A
aacircleColor [Sdlgfx]
aacircleRGBA [Sdlgfx]
aaellipseColor [Sdlgfx]
aaellipseRGBA [Sdlgfx]
aalineColor [Sdlgfx]
aalineRGBA [Sdlgfx]
active_mask [Sdlevent]
add [Sdlevent]
Add events to the back of the event queue.
all_channels [Sdlmixer]
A special value for representing all channels (-1 actually).
all_events_mask [Sdlevent]
allocate_channels [Sdlmixer]
Dynamically change the number of channels managed by the mixer.

B
black [Sdlvideo]
blit_surface [Sdlvideo]
Performs a fast blit from the source surface to the destination surface.
blue [Sdlvideo]
boxColor [Sdlgfx]
boxRGBA [Sdlgfx]

C
cd_close [Sdlcdrom]
Closes the handle for the cdrom_drive
cd_eject [Sdlcdrom]
Eject CD-ROM
cd_info [Sdlcdrom]
cd_open [Sdlcdrom]
cd_open drive open a CD-ROM drive for access
cd_pause [Sdlcdrom]
Pause play
cd_play_track [Sdlcdrom]
Play the track n on the given cdrom_drive
cd_play_tracks [Sdlcdrom]
cd_play_tracks cdrom_drive start_track start_frame num_tracks num_frames play the given CD with these parameters
cd_resume [Sdlcdrom]
Resume play
cd_status [Sdlcdrom]
cd_stop [Sdlcdrom]
Stop play
char_of_key [Sdlkey]
Returns a (iso-8859-1) character corresponding to a key
characterColor [Sdlgfx]
characterRGBA [Sdlgfx]
circleColor [Sdlgfx]
circleRGBA [Sdlgfx]
close [Sdljoystick]
Close a joystick previously opened with Sdljoystick.open_joystick
close_audio [Sdlmixer]
Close the mixer, halting all playing audio
convert_to_cursor [Sdlmouse]
copy_rect [Sdlvideo]
create_RGB_surface [Sdlvideo]
Creates a RGB surface.
create_RGB_surface_format [Sdlvideo]
Creates a RGB surface with the same pixel format as the first parameter.
create_RGB_surface_from_16 [Sdlvideo]
create_RGB_surface_from_24 [Sdlvideo]
create_RGB_surface_from_32 [Sdlvideo]
create_RGB_surface_from_8 [Sdlvideo]
cursor_data [Sdlmouse]
converts an abstract cursor value to concrete cursor data
cursor_visible [Sdlmouse]
Tests if cursor is shown on screen
cyan [Sdlvideo]

D
default_group [Sdlmixer]
The group tag used to represent the group of all the channels.
delay [Sdltimer]
Wait a specified number of milliseconds before returning
disable_events [Sdlevent]
Specified events are not collected and won't appear in the event queue.
disable_key_repeat [Sdlkey]
Disable keyboard repeat
display_format [Sdlvideo]
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.
drive_name [Sdlcdrom]
drive_name drive returns a human-readable, system-dependent identifier for the CD-ROM.
driver_name [Sdlvideo]

E
ellipseColor [Sdlgfx]
ellipseRGBA [Sdlgfx]
enable_events [Sdlevent]
Specified events are collected and added to the event queue (when pump is called).
enable_key_repeat [Sdlkey]
Enable keyboard repeat
enable_unicode [Sdlkey]
Enable unicode translation of keysyms for keyboard events
exit_event_loop [Sdlevent.Old]
expire_channel [Sdlmixer]
expire_channel channel ticks Change the expiration delay for a particular channel.

F
fadein_channel [Sdlmixer]
fadein_channel channel loops ticks chunck ms : same as play_channel but fades in a over ms seconds.
fadein_music [Sdlmixer]
fadein_music chunck loops music ms : fade in music over ms seconds, same semantics as the play_music function
fadeout_channel [Sdlmixer]
fadeout_channel channel ticks Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take.
fadeout_group [Sdlmixer]
fadeout_group group ticks Halt a group of channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take.
fadeout_music [Sdlmixer]
fadeout_music ticks Halt the music, fading it out progressively till it's silent.
fading_channel [Sdlmixer]
Query the fading status of a channel
fading_music [Sdlmixer]
Query the fading status of a music
family_name [Sdlttf]
fill_rect [Sdlvideo]
performs a fast fill of the given rectangle with 'color'
filledCircleColor [Sdlgfx]
filledCircleRGBA [Sdlgfx]
filledEllipseColor [Sdlgfx]
filledEllipseRGBA [Sdlgfx]
flip [Sdlvideo]
Swaps screen buffers.
font_ascent [Sdlttf]
font_descent [Sdlttf]
font_faces [Sdlttf]
Get the number of faces of the font
font_height [Sdlttf]
font_lineskip [Sdlttf]
Get the recommended spacing between lines of text for this font
frames_of_msf [Sdlcdrom]
free_chunk [Sdlmixer]
Free an audio chunk previously loaded
free_cursor [Sdlmouse]
Deallocates a cursor.
free_music [Sdlmixer]
Free music previously loaded

G
get [Sdlevent]
Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will be removed from the queue.
get_RGB [Sdlvideo]
Maps a pixel value into the RGB components for a given pixel format
get_RGBA [Sdlvideo]
Maps a pixel value into the RGBA components for a given pixel format *
get_alpha [Sdlvideo]
get_app_state [Sdlevent]
This function returns the current state of the application.
get_axis [Sdljoystick]
get_ball [Sdljoystick]
get_button [Sdljoystick]
get_caption [Sdlwm]
Gets the title and icon text of the display window
get_clip_rect [Sdlvideo]
get_color_key [Sdlvideo]
get_cursor [Sdlmouse]
Returns the currently active cursor.
get_enabled_events [Sdlevent]
The mask of currently reported events.
get_event_state [Sdljoystick]
get_font_style [Sdlttf]
Retrieve the font style : either NORMAL or a combination of BOLD, ITALIC and UNDERLINE
get_hat [Sdljoystick]
get_key_state [Sdlkey]
Get a snapshot of the current state of the keyboard.
get_mod_state [Sdlkey]
Get the current key modifier state
get_num_drives [Sdlcdrom]
get_num_drives returns the number of CD-ROM drives on the system
get_palette_color [Sdlvideo]
Retrieve a color by its index in a surface's palette
get_pixel [Sdlvideo]
get_pixel_color [Sdlvideo]
Access an individual pixel on a surface and returns is as a color.
get_state [Sdlevent]
Query the reporting state of an event type.
get_state [Sdlmouse]
Retrieve the current state of the mouse : current mouse position and list of pressed buttons
get_ticks [Sdltimer]
Get the number of milliseconds since the SDL library initialization.
get_video_info [Sdlvideo]
get_video_info_format [Sdlvideo]
get_video_surface [Sdlvideo]
getenv [Sdl]
gfxPrimitivesSetFont [Sdlgfx]
glyph_metrics [Sdlttf]
grab_input [Sdlwm]
Set the input grab state of the application.
green [Sdlvideo]
group_available [Sdlmixer]
Finds the first available channel in a group of channels
group_channel [Sdlmixer]
Attach a group tag to a channel.
group_channels [Sdlmixer]
Same as above but for a range of channels.
group_count [Sdlmixer]
Returns the number of channels in a group.
group_newer [Sdlmixer]
Finds the "most recent" (i.e.
group_oldest [Sdlmixer]
Finds the "oldest" sample playing in a group of channels

H
halt_channel [Sdlmixer]
halt_group [Sdlmixer]
halt_music [Sdlmixer]
has_event [Sdlevent]
Poll for currently pending events and return false if the queue is empty.
hat_centered [Sdljoystick]
hat_down [Sdljoystick]
hat_left [Sdljoystick]
hat_leftdown [Sdljoystick]
hat_leftup [Sdljoystick]
hat_right [Sdljoystick]
hat_rightdown [Sdljoystick]
hat_rightup [Sdljoystick]
hat_up [Sdljoystick]

I
iconify [Sdlwm]
This function iconifies the window, and returns true if it succeeded.
index [Sdljoystick]
Get the device index of an opened joystick
init [Sdlttf]
Initialise SDL_tff and freetype
init [Sdl]
Initialize the SDL library.
init_subsystem [Sdl]
int_of_key [Sdlkey]
get the SDL keysym of the key
is_fixed_width [Sdlttf]
is_key_pressed [Sdlkey]
Checks wether a key is currently pressed on the keyboard.

J
joyaxismotion_mask [Sdlevent]
joyballmotion_mask [Sdlevent]
joybuttondown_mask [Sdlevent]
joybuttonup_mask [Sdlevent]
joyhatmotion_mask [Sdlevent]
joystick_event_mask [Sdlevent]

K
key_of_int [Sdlkey]
get the key corresponding to a SDL keysym
keyboard_event_mask [Sdlevent]
keydown_mask [Sdlevent]
keyup_mask [Sdlevent]
kmod_alt [Sdlkey]
kmod_caps [Sdlkey]
kmod_ctrl [Sdlkey]
kmod_lalt [Sdlkey]
kmod_lctrl [Sdlkey]
kmod_lmeta [Sdlkey]
kmod_lshift [Sdlkey]
kmod_meta [Sdlkey]
kmod_mode [Sdlkey]
kmod_none [Sdlkey]
kmod_num [Sdlkey]
kmod_ralt [Sdlkey]
kmod_rctrl [Sdlkey]
kmod_rmeta [Sdlkey]
kmod_rshift [Sdlkey]
kmod_shift [Sdlkey]

L
lineColor [Sdlgfx]
lineRGBA [Sdlgfx]
list_modes [Sdlvideo]
loadWAV [Sdlmixer]
Load a wave file
loadWAV_from_mem [Sdlmixer]
load_BMP [Sdlvideo]
Loads a surface from a named Windows BMP file.
load_BMP_from_mem [Sdlvideo]
Loads a BMP image from a memory buffer.
load_image [Sdlloader]
load an image as a surface
load_image_from_mem [Sdlloader]
load_music [Sdlmixer]
Load a music file (.mod .s3m .it .xm .ogg)
load_string [Sdlmixer]
Load a wave file of the mixer format from a memory buffer
load_string_raw [Sdlmixer]
Load raw audio data of the mixer format from a memory buffer
lock [Sdlvideo]
Sets up a surface for directly accessing the pixels.

M
magenta [Sdlvideo]
make_cursor [Sdlmouse]
Create a cursor using the specified data and mask (in MSB format).
make_mask [Sdlevent]
map_RGB [Sdlvideo]
Maps an RGB triple or an RGBA quadruple to a pixel value for a given pixel format
max_code [Sdlkey]
highest SDL keysym : should be 322
mouse_event_mask [Sdlevent]
mousebuttondown_mask [Sdlevent]
mousebuttonup_mask [Sdlevent]
mousemotion_mask [Sdlevent]
msf_of_frames [Sdlcdrom]
music_type [Sdlmixer]
Find out the music format of a mixer music, or the currently playing music, if parameter is None.
must_lock [Sdlvideo]

N
name [Sdlkey]
name [Sdljoystick]
Get the implementation dependent name of a joystick.
num_axes [Sdljoystick]
Get the number of general axis controls on a joystick
num_balls [Sdljoystick]
Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled.
num_buttons [Sdljoystick]
Get the number of buttons on a joystick
num_channels [Sdlmixer]
num_hats [Sdljoystick]
Get the number of POV hats on a joystick
num_joysticks [Sdljoystick]
Count the number of joysticks attached to the system
num_keys [Sdlkey]
number of keys in the Sdlkey.t variant type : should be 232
num_paused_channel [Sdlmixer]
num_playing_channel [Sdlmixer]

O
of_mask [Sdlevent]
open_audio [Sdlmixer]
open_audio frequency format chunksize channels () opens the mixer with a certain audio format.
open_font [Sdlttf]
open a font file and create a font of the specified point size
open_joystick [Sdljoystick]
Open a joystick for use - the index passed as an argument refers to the N'th joystick on the system.
opened [Sdljoystick]

P
palette_ncolors [Sdlvideo]
Number of colors in the surface's palette
pause_channel [Sdlmixer]
pause_music [Sdlmixer]
paused_channel [Sdlmixer]
paused_music [Sdlmixer]
peek [Sdlevent]
Checks the event queue for messages : up to 'numevents' events at the front of the event queue, matching 'mask', will be returned and will not be removed from the queue.
pixelColor [Sdlgfx]
pixelRGBA [Sdlgfx]
pixel_data [Sdlvideo]
pixel_data_16 [Sdlvideo]
pixel_data_24 [Sdlvideo]
pixel_data_32 [Sdlvideo]
pixel_data_8 [Sdlvideo]
play_channel [Sdlmixer]
play_channel channel loops ticks chunk Play an audio chunk.
play_music [Sdlmixer]
Play a music chunk.
play_sound [Sdlmixer]
Play an audio chunk.
playing_channel [Sdlmixer]
playing_music [Sdlmixer]
poll [Sdlevent]
Poll for currently pending events and return one if available.
pprint_cursor [Sdlmouse]
for debugging : prints on stdout
pump [Sdlevent]
Pumps the event loop, gathering events from the input devices.
put_pixel [Sdlvideo]
put_pixel_color [Sdlvideo]
Sets an individual pixel on a surface.
putenv [Sdl]

Q
query_grab [Sdlwm]
query_specs [Sdlmixer]
Find out what the actual audio device parameters are.
query_unicode [Sdlkey]
quit [Sdlttf]
Quits the system
quit [Sdl]
quit shuts down all SDL subsystems and frees the resources allocated to them.
quit_mask [Sdlevent]
quit_subsystem [Sdl]

R
read_XPM_from_array [Sdlloader]
creates a surface from an array of strings (in the source code)
rect [Sdlvideo]
rectangleColor [Sdlgfx]
rectangleRGBA [Sdlgfx]
red [Sdlvideo]
render_glyph [Sdlttf]
render_glyph_blended [Sdlttf]
render_glyph_shaded [Sdlttf]
render_glyph_solid [Sdlttf]
render_text [Sdlttf]
render_text_blended [Sdlttf]
render_text_shaded [Sdlttf]
render_text_solid [Sdlttf]
render_utf8_blended [Sdlttf]
render_utf8_shaded [Sdlttf]
render_utf8_solid [Sdlttf]
reserve_channels [Sdlmixer]
Reserve the first channels (0 -> n-1) for the application, i.e.
resume_channel [Sdlmixer]
resume_music [Sdlmixer]
rewind_music [Sdlmixer]
rotozoomSurface [Sdlgfx]
rotozoomSurfaceXY [Sdlgfx]

S
save_BMP [Sdlvideo]
Saves the surface as a Windows BMP file named file.
set_alpha [Sdlvideo]
sets the alpha value for the entire surface, as opposed to using the alpha component of each pixel.
set_caption [Sdlwm]
Sets the title and icon text of the display window
set_clip_rect [Sdlvideo]
Sets the clipping rectangle for the destination surface in a blit.
set_color_key [Sdlvideo]
Sets the color key (transparent pixel) in a blittable surface.
set_cursor [Sdlmouse]
Set the currently active cursor to the specified one.
set_event_state [Sdljoystick]
set_font_style [Sdlttf]
set_gamma [Sdlvideo]
Set the gamma correction for each of the color channels.
set_icon [Sdlwm]
Sets the icon for the display window.
set_idle_event_func [Sdlevent.Old]
set_keyboard_event_func [Sdlevent.Old]
set_mod_state [Sdlkey]
Set the current key modifier state This does not change the keyboard state, only the key modifier flags.
set_mouse_event_func [Sdlevent.Old]
set_mousemotion_event_func [Sdlevent.Old]
set_music_cmd [Sdlmixer]
Stop music and set external music playback command
set_palette [Sdlvideo]
Sets a portion of the palette for a given 8-bit surface.
set_resize_event_func [Sdlevent.Old]
set_state [Sdlevent]
Set the reporting state of one individual event type.
set_video_mode [Sdlvideo]
Set up a video mode with the specified width, height and bits-per-pixel.
setvolume_channel [Sdlmixer]
Sets the volume for specified channel or chunk.
setvolume_chunk [Sdlmixer]
setvolume_music [Sdlmixer]
show_cursor [Sdlmouse]
Toggle cursor display
size_text [Sdlttf]
Get the dimensions of a rendered string of text
size_utf8 [Sdlttf]
start_event_loop [Sdlevent.Old]
stringColor [Sdlgfx]
stringRGBA [Sdlgfx]
string_of_event [Sdlevent]
Returns a short string descriptive of the event type, for debugging
string_of_version [Sdl]
style_name [Sdlttf]
surface_bpp [Sdlvideo]
surface_dims [Sdlvideo]
surface_flags [Sdlvideo]
surface_format [Sdlvideo]
surface_info [Sdlvideo]
syswmevent_mask [Sdlevent]

T
toggle_fullscreen [Sdlwm]
Toggle fullscreen mode without changing the contents of the screen.

U
unlock [Sdlvideo]
Releases the lock on the given surface
unset_alpha [Sdlvideo]
unset_clip_rect [Sdlvideo]
disable clipping for the given surface
unset_color_key [Sdlvideo]
unset_music_cmd [Sdlmixer]
Turn off using an external command for music, returning to the internal music playing functionality
update [Sdljoystick]
Update the current state of the open joysticks.
update_rect [Sdlvideo]
update_rects [Sdlvideo]
Makes sure the given list of rectangles is updated on the given screen.
use_palette [Sdlvideo]
userevent_mask [Sdlevent]

V
version [Sdlmixer]
Get the version of the dynamically linked SDL_mixer library
version [Sdl]
version of the SDL library
video_mode_ok [Sdlvideo]
Check to see if a particular video mode is supported.
videoexpose_mask [Sdlevent]
videoresize_mask [Sdlevent]
volume_channel [Sdlmixer]
Returns the original volume of a specific channel, chunk or music
volume_chunk [Sdlmixer]
volume_music [Sdlmixer]

W
wait [Sdlevent]
Wait indefinitely for the next available event but leave it in the queue.
wait_event [Sdlevent]
Wait indefinitely for the next available event and return it.
warp [Sdlmouse]
Set the position of the mouse cursor (generates a mouse motion event)
was_init [Sdl]
white [Sdlvideo]

Y
yellow [Sdlvideo]

Z
zoomSurface [Sdlgfx]

ocamlsdl-0.9.1/doc/html/Sdlmouse.html0000664000076400007640000002375411774643041016251 0ustar olivoliv OCamlSDL 0.9.1 : Sdlmouse

Module Sdlmouse


module Sdlmouse: sig .. end
Mouse event handling and cursors


Mouse state



type button =
| BUTTON_LEFT
| BUTTON_MIDDLE
| BUTTON_RIGHT
| BUTTON_WHEELUP
| BUTTON_WHEELDOWN
| BUTTON_X of int (*BUTTON_X is only seen in a Sdlevent.mousebutton_event, it is not returned by Sdlmouse.get_state*)
val get_state : ?relative:bool -> unit -> int * int * button list
Retrieve the current state of the mouse : current mouse position and list of pressed buttons
relative : if true returns mouse delta instead of position
val warp : int -> int -> unit
Set the position of the mouse cursor (generates a mouse motion event)

Cursors


type cursor 
abstract type for cursors

type cursor_data = {
   data : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t; (*B/W cursor data*)
   mask : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t; (*B/W cursor mask*)
   w : int; (*width in pixels*)
   h : int; (*height in pixels*)
   hot_x : int; (*the "tip" of the cursor*)
   hot_y : int; (*the "tip" of the cursor*)
}
val make_cursor : data:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ->
mask:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t ->
hot_x:int -> hot_y:int -> cursor
Create a cursor using the specified data and mask (in MSB format).

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 Sdlmouse.free_cursor.

val free_cursor : cursor -> unit
Deallocates a cursor.
val set_cursor : cursor -> unit
Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display.
val get_cursor : unit -> cursor
Returns the currently active cursor.
val cursor_visible : unit -> bool
Tests if cursor is shown on screen
val show_cursor : bool -> unit
Toggle cursor display
val cursor_data : cursor -> cursor_data
converts an abstract cursor value to concrete cursor data
val pprint_cursor : cursor -> unit
for debugging : prints on stdout
val convert_to_cursor : data:int array ->
mask:int array -> w:int -> h:int -> hot_x:int -> hot_y:int -> cursor
ocamlsdl-0.9.1/doc/html/type_Sdlevent.Old.html0000664000076400007640000001027711774643041020014 0ustar olivoliv OCamlSDL 0.9.1 : Sdlevent.Old sig
  type keyboard_event_func =
      Sdlkey.t -> Sdlevent.switch_state -> int -> int -> unit
  type mouse_event_func =
      Sdlmouse.button -> Sdlevent.switch_state -> int -> int -> unit
  type mousemotion_event_func = int -> int -> unit
  type idle_event_func = unit -> unit
  type resize_event_func = int -> int -> unit
  val set_keyboard_event_func : Sdlevent.Old.keyboard_event_func -> unit
  val set_mouse_event_func : Sdlevent.Old.mouse_event_func -> unit
  val set_mousemotion_event_func :
    Sdlevent.Old.mousemotion_event_func -> unit
  val set_idle_event_func : Sdlevent.Old.idle_event_func -> unit
  val set_resize_event_func : Sdlevent.Old.resize_event_func -> unit
  val start_event_loop : unit -> unit
  val exit_event_loop : unit -> unit
end
ocamlsdl-0.9.1/doc/html/type_Sdlgfx.html0000664000076400007640000004332211774643042016740 0ustar olivoliv OCamlSDL 0.9.1 : Sdlgfx sig
  external pixelColor : Sdlvideo.surface -> int -> int -> int32 -> bool
    = "ml_pixelColor"
  external pixelRGBA :
    Sdlvideo.surface -> int -> int -> Sdlvideo.color -> int -> bool
    = "ml_pixelRGBA"
  external rectangleColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_rectangleColor"
  external rectangleRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_rectangleRGBA"
  external boxColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_boxColor"
  external boxRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_boxRGBA"
  external lineColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_lineColor"
  external lineRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_lineRGBA"
  external aalineColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_aalineColor"
  external aalineRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_aalineRGBA"
  external circleColor :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
    = "ml_circleColor"
  external circleRGBA :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
    = "ml_circleRGBA"
  external aacircleColor :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
    = "ml_aacircleColor"
  external aacircleRGBA :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
    = "ml_aacircleRGBA"
  external filledCircleColor :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> int32 -> bool
    = "ml_filledCircleColor"
  external filledCircleRGBA :
    Sdlvideo.surface -> Sdlvideo.rect -> int -> Sdlvideo.color -> int -> bool
    = "ml_filledCircleRGBA"
  external ellipseColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_ellipseColor"
  external ellipseRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_ellipseRGBA"
  external aaellipseColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_aaellipseColor"
  external aaellipseRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_aaellipseRGBA"
  external filledEllipseColor :
    Sdlvideo.surface -> Sdlvideo.rect -> Sdlvideo.rect -> int32 -> bool
    = "ml_filledEllipseColor"
  external filledEllipseRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> Sdlvideo.rect -> Sdlvideo.color -> int -> bool
    = "ml_filledEllipseRGBA"
  external characterColor :
    Sdlvideo.surface -> Sdlvideo.rect -> char -> int32 -> bool
    = "ml_characterColor"
  external characterRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> char -> Sdlvideo.color -> int -> bool
    = "ml_characterRGBA"
  external stringColor :
    Sdlvideo.surface -> Sdlvideo.rect -> string -> int32 -> bool
    = "ml_stringColor"
  external stringRGBA :
    Sdlvideo.surface ->
    Sdlvideo.rect -> string -> Sdlvideo.color -> int -> bool
    = "ml_stringRGBA"
  external gfxPrimitivesSetFont : string -> int -> int -> unit
    = "ml_gfxPrimitivesSetFont"
  external rotozoomSurface :
    Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface
    = "ml_rotozoomSurface"
  external rotozoomSurfaceXY :
    Sdlvideo.surface -> float -> float -> float -> bool -> Sdlvideo.surface
    = "ml_rotozoomSurfaceXY"
  external zoomSurface :
    Sdlvideo.surface -> float -> float -> bool -> Sdlvideo.surface
    = "ml_zoomSurface"
end
ocamlsdl-0.9.1/doc/html/Sdl.html0000664000076400007640000001277411774643040015177 0ustar olivoliv OCamlSDL 0.9.1 : Sdl

Module Sdl


module Sdl: sig .. end
This module contains functions for initializing/quitting the library

exception SDL_init_exception of string
Exception for reporting errors during initialization

Main functions


type subsystem = [ `AUDIO | `CDROM | `JOYSTICK | `TIMER | `VIDEO ] 
Initialization flag type
val init : ?auto_clean:bool ->
[< `AUDIO
| `CDROM
| `EVENTTHREAD
| `EVERYTHING
| `JOYSTICK
| `NOPARACHUTE
| `TIMER
| `VIDEO ]
list -> unit
Initialize the SDL library. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize.
  • `NOPARACHUTE : Don't catch fatal signals
  • `EVENTTHREAD : Automatically pump events in a separate threads
  • `EVERYTHING : initialize all subsystems

val init_subsystem : subsystem list -> unit
val was_init : unit -> subsystem list
val quit : unit -> unit
quit shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit.
val quit_subsystem : subsystem list -> unit

Versioning information



type version = {
   major : int;
   minor : int;
   patch : int;
}
val version : unit -> version
version of the SDL library
val string_of_version : version -> string

Environment variables


val getenv : string -> string
val putenv : string -> string -> unit
ocamlsdl-0.9.1/doc/html/Sdlkey.html0000664000076400007640000015535411774643040015712 0ustar olivoliv OCamlSDL 0.9.1 : Sdlkey

Module Sdlkey


module Sdlkey: sig .. end
Keyboard handling and key symbols


Keysyms



type t =
| KEY_UNKNOWN
| KEY_BACKSPACE
| KEY_TAB
| KEY_CLEAR
| KEY_RETURN
| KEY_PAUSE
| KEY_ESCAPE
| KEY_SPACE
| KEY_EXCLAIM
| KEY_QUOTEDBL
| KEY_HASH
| KEY_DOLLAR
| KEY_AMPERSAND
| KEY_QUOTE
| KEY_LEFTPAREN
| KEY_RIGHTPAREN
| KEY_ASTERISK
| KEY_PLUS
| KEY_COMMA
| KEY_MINUS
| KEY_PERIOD
| KEY_SLASH
| KEY_0
| KEY_1
| KEY_2
| KEY_3
| KEY_4
| KEY_5
| KEY_6
| KEY_7
| KEY_8
| KEY_9
| KEY_COLON
| KEY_SEMICOLON
| KEY_LESS
| KEY_EQUALS
| KEY_GREATER
| KEY_QUESTION
| KEY_AT (*Skip uppercase letters*)
| KEY_LEFTBRACKET
| KEY_BACKSLASH
| KEY_RIGHTBRACKET
| KEY_CARET
| KEY_UNDERSCORE
| KEY_BACKQUOTE
| KEY_a
| KEY_b
| KEY_c
| KEY_d
| KEY_e
| KEY_f
| KEY_g
| KEY_h
| KEY_i
| KEY_j
| KEY_k
| KEY_l
| KEY_m
| KEY_n
| KEY_o
| KEY_p
| KEY_q
| KEY_r
| KEY_s
| KEY_t
| KEY_u
| KEY_v
| KEY_w
| KEY_x
| KEY_y
| KEY_z
| KEY_DELETE (*End of ASCII mapped keysyms*)
| KEY_WORLD_0 (*International keyboard syms*)
| KEY_WORLD_1
| KEY_WORLD_2
| KEY_WORLD_3
| KEY_WORLD_4
| KEY_WORLD_5
| KEY_WORLD_6
| KEY_WORLD_7
| KEY_WORLD_8
| KEY_WORLD_9
| KEY_WORLD_10
| KEY_WORLD_11
| KEY_WORLD_12
| KEY_WORLD_13
| KEY_WORLD_14
| KEY_WORLD_15
| KEY_WORLD_16
| KEY_WORLD_17
| KEY_WORLD_18
| KEY_WORLD_19
| KEY_WORLD_20
| KEY_WORLD_21
| KEY_WORLD_22
| KEY_WORLD_23
| KEY_WORLD_24
| KEY_WORLD_25
| KEY_WORLD_26
| KEY_WORLD_27
| KEY_WORLD_28
| KEY_WORLD_29
| KEY_WORLD_30
| KEY_WORLD_31
| KEY_WORLD_32
| KEY_WORLD_33
| KEY_WORLD_34
| KEY_WORLD_35
| KEY_WORLD_36
| KEY_WORLD_37
| KEY_WORLD_38
| KEY_WORLD_39
| KEY_WORLD_40
| KEY_WORLD_41
| KEY_WORLD_42
| KEY_WORLD_43
| KEY_WORLD_44
| KEY_WORLD_45
| KEY_WORLD_46
| KEY_WORLD_47
| KEY_WORLD_48
| KEY_WORLD_49
| KEY_WORLD_50
| KEY_WORLD_51
| KEY_WORLD_52
| KEY_WORLD_53
| KEY_WORLD_54
| KEY_WORLD_55
| KEY_WORLD_56
| KEY_WORLD_57
| KEY_WORLD_58
| KEY_WORLD_59
| KEY_WORLD_60
| KEY_WORLD_61
| KEY_WORLD_62
| KEY_WORLD_63
| KEY_WORLD_64
| KEY_WORLD_65
| KEY_WORLD_66
| KEY_WORLD_67
| KEY_WORLD_68
| KEY_WORLD_69
| KEY_WORLD_70
| KEY_WORLD_71
| KEY_WORLD_72
| KEY_WORLD_73
| KEY_WORLD_74
| KEY_WORLD_75
| KEY_WORLD_76
| KEY_WORLD_77
| KEY_WORLD_78
| KEY_WORLD_79
| KEY_WORLD_80
| KEY_WORLD_81
| KEY_WORLD_82
| KEY_WORLD_83
| KEY_WORLD_84
| KEY_WORLD_85
| KEY_WORLD_86
| KEY_WORLD_87
| KEY_WORLD_88
| KEY_WORLD_89
| KEY_WORLD_90
| KEY_WORLD_91
| KEY_WORLD_92
| KEY_WORLD_93
| KEY_WORLD_94
| KEY_WORLD_95
| KEY_KP0 (*Numeric keypad*)
| KEY_KP1
| KEY_KP2
| KEY_KP3
| KEY_KP4
| KEY_KP5
| KEY_KP6
| KEY_KP7
| KEY_KP8
| KEY_KP9
| KEY_KP_PERIOD
| KEY_KP_DIVIDE
| KEY_KP_MULTIPLY
| KEY_KP_MINUS
| KEY_KP_PLUS
| KEY_KP_ENTER
| KEY_KP_EQUALS
| KEY_UP (*Arrows + Home/End pad*)
| KEY_DOWN
| KEY_RIGHT
| KEY_LEFT
| KEY_INSERT
| KEY_HOME
| KEY_END
| KEY_PAGEUP
| KEY_PAGEDOWN
| KEY_F1 (*Function keys*)
| KEY_F2
| KEY_F3
| KEY_F4
| KEY_F5
| KEY_F6
| KEY_F7
| KEY_F8
| KEY_F9
| KEY_F10
| KEY_F11
| KEY_F12
| KEY_F13
| KEY_F14
| KEY_F15
| KEY_NUMLOCK (*Key state modifier keys*)
| KEY_CAPSLOCK
| KEY_SCROLLOCK
| KEY_RSHIFT
| KEY_LSHIFT
| KEY_RCTRL
| KEY_LCTRL
| KEY_RALT
| KEY_LALT
| KEY_RMETA
| KEY_LMETA
| KEY_LSUPER (*Left "Windows" key*)
| KEY_RSUPER (*Right "Windows" key*)
| KEY_MODE (*"Alt Gr" key*)
| KEY_COMPOSE (*Multi-key compose key*)
| KEY_HELP (*Miscellaneous function keys*)
| KEY_PRINT
| KEY_SYSREQ
| KEY_BREAK
| KEY_MENU
| KEY_POWER (*Power Macintosh power key*)
| KEY_EURO (*Some european keyboards*)
| KEY_UNDO (*Atari keyboard has Undo*)
Concrete type describing keyboard keys ("keysym")
val int_of_key : t -> int
get the SDL keysym of the key
val key_of_int : int -> t
get the key corresponding to a SDL keysym
Raises Invalid_arg if not a valid SDL keysym
val char_of_key : t -> char
Returns a (iso-8859-1) character corresponding to a key
Raises Invalid_arg if corresponding SDL keysym is > 255
val num_keys : int
number of keys in the Sdlkey.t variant type : should be 232
val max_code : int
highest SDL keysym : should be 322
val name : t -> string
Returns a short string describing the key

Keyboard handling


val enable_unicode : bool -> unit
Enable unicode translation of keysyms for keyboard events
val query_unicode : unit -> bool
val disable_key_repeat : unit -> unit
Disable keyboard repeat
val enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit
Enable keyboard repeat
delay : initial delay in ms between the time when a key is pressed, and keyboard repeat begins
interval : the time in ms between keyboard repeat events
val get_key_state : unit ->
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
Get a snapshot of the current state of the keyboard.
Returns an array of keystates, indexed by the SDL keysyms (cf Sdlkey.int_of_key)
val is_key_pressed : t -> bool
Checks wether a key is currently pressed on the keyboard.

Key modifiers


type mod_state = int 

The following values are flags. Use with land, lor, etc.
val kmod_none : mod_state
val kmod_lshift : mod_state
val kmod_rshift : mod_state
val kmod_lctrl : mod_state
val kmod_rctrl : mod_state
val kmod_lalt : mod_state
val kmod_ralt : mod_state
val kmod_lmeta : mod_state
val kmod_rmeta : mod_state
val kmod_num : mod_state
val kmod_caps : mod_state
val kmod_mode : mod_state
val kmod_ctrl : mod_state
val kmod_shift : mod_state
val kmod_alt : mod_state
val kmod_meta : mod_state
val get_mod_state : unit -> mod_state
Get the current key modifier state
val set_mod_state : mod_state -> unit
Set the current key modifier state This does not change the keyboard state, only the key modifier flags.
ocamlsdl-0.9.1/doc/html/Sdlwm.html0000664000076400007640000001021011774643041015523 0ustar olivoliv OCamlSDL 0.9.1 : Sdlwm

Module Sdlwm


module Sdlwm: sig .. end
Window Manager interaction

val set_caption : title:string -> icon:string -> unit
Sets the title and icon text of the display window
val get_caption : unit -> string * string
Gets the title and icon text of the display window
val set_icon : Sdlvideo.surface -> unit
Sets the icon for the display window. This function must be called before the first call to Sdlvideo.set_video_mode.
val iconify : unit -> bool
This function iconifies the window, and returns true if it succeeded. If the function succeeds, it generates an Sdlevent.active_event loss event. This function is a noop and returns false in non-windowed environments.
val toggle_fullscreen : unit -> bool
Toggle fullscreen mode without changing the contents of the screen. If this function was able to toggle fullscreen mode (change from running in a window to fullscreen, or vice-versa), it will return true. If it is not implemented, or fails, it returns false.
val grab_input : bool -> unit
Set the input grab state of the application. 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.
val query_grab : unit -> bool
ocamlsdl-0.9.1/doc/html/type_Sdljoystick.html0000664000076400007640000001345511774643040020015 0ustar olivoliv OCamlSDL 0.9.1 : Sdljoystick sig
  exception SDLjoystick_exception of string
  type t
  val num_joysticks : unit -> int
  val name : int -> string
  val open_joystick : int -> Sdljoystick.t
  val opened : int -> bool
  val index : Sdljoystick.t -> int
  val num_axes : Sdljoystick.t -> int
  val num_balls : Sdljoystick.t -> int
  val num_hats : Sdljoystick.t -> int
  val num_buttons : Sdljoystick.t -> int
  val update : Sdljoystick.t -> unit
  val set_event_state : bool -> unit
  val get_event_state : unit -> bool
  type hat_value = int
  val hat_centered : Sdljoystick.hat_value
  val hat_up : Sdljoystick.hat_value
  val hat_right : Sdljoystick.hat_value
  val hat_down : Sdljoystick.hat_value
  val hat_left : Sdljoystick.hat_value
  val hat_rightup : Sdljoystick.hat_value
  val hat_rightdown : Sdljoystick.hat_value
  val hat_leftup : Sdljoystick.hat_value
  val hat_leftdown : Sdljoystick.hat_value
  val get_axis : Sdljoystick.t -> int -> int
  val get_hat : Sdljoystick.t -> int -> Sdljoystick.hat_value
  val get_ball : Sdljoystick.t -> int -> int * int
  val get_button : Sdljoystick.t -> int -> bool
  val close : Sdljoystick.t -> unit
end
ocamlsdl-0.9.1/doc/html/type_Sdlmouse.html0000664000076400007640000001427511774643041017310 0ustar olivoliv OCamlSDL 0.9.1 : Sdlmouse sig
  type button =
      BUTTON_LEFT
    | BUTTON_MIDDLE
    | BUTTON_RIGHT
    | BUTTON_WHEELUP
    | BUTTON_WHEELDOWN
    | BUTTON_X of int
  val get_state : ?relative:bool -> unit -> int * int * Sdlmouse.button list
  val warp : int -> int -> unit
  type cursor
  type cursor_data = {
    data :
      (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t;
    mask :
      (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array2.t;
    w : int;
    h : int;
    hot_x : int;
    hot_y : int;
  }
  val make_cursor :
    data:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout)
         Bigarray.Array2.t ->
    mask:(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout)
         Bigarray.Array2.t ->
    hot_x:int -> hot_y:int -> Sdlmouse.cursor
  val free_cursor : Sdlmouse.cursor -> unit
  val set_cursor : Sdlmouse.cursor -> unit
  val get_cursor : unit -> Sdlmouse.cursor
  val cursor_visible : unit -> bool
  val show_cursor : bool -> unit
  val cursor_data : Sdlmouse.cursor -> Sdlmouse.cursor_data
  val pprint_cursor : Sdlmouse.cursor -> unit
  val convert_to_cursor :
    data:int array ->
    mask:int array ->
    w:int -> h:int -> hot_x:int -> hot_y:int -> Sdlmouse.cursor
end
ocamlsdl-0.9.1/doc/html/Sdlvideo.html0000664000076400007640000012337311774643041016225 0ustar olivoliv OCamlSDL 0.9.1 : Sdlvideo

Module Sdlvideo


module Sdlvideo: sig .. end
Module for video manipulations

exception Video_exn of string

Rectangles



type rect = {
   mutable r_x : int;
   mutable r_y : int;
   mutable r_w : int;
   mutable r_h : int;
}
rectangular area (x, y, w, h)
val rect : x:int -> y:int -> w:int -> h:int -> rect
val copy_rect : rect -> rect
Returns a copy of the rectangle

Video mode informations



type pixel_format_info = {
   palette : bool;
   bits_pp : int; (*bits per pixel*)
   bytes_pp : int; (*bytes per pixel*)
   rmask : int32; (*red mask value*)
   gmask : int32; (*green mask value*)
   bmask : int32; (*blue mask value*)
   amask : int32; (*alpha mask value*)
   rshift : int;
   gshift : int;
   bshift : int;
   ashift : int;
   rloss : int;
   gloss : int;
   bloss : int;
   aloss : int;
   colorkey : int32; (*RGB color key information*)
   alpha : int; (*Alpha value information (per-surface alpha)*)
}
Structure describing how color are encoded as pixels

type video_info = {
   hw_available : bool; (*Hardware surfaces?*)
   wm_available : bool; (*Window manager present?*)
   blit_hw : bool; (*Accelerated blits HW -> HW*)
   blit_hw_color_key : bool; (*Accelerated blits with color key*)
   blit_hw_alpha : bool; (*Accelerated blits with alpha*)
   blit_sw : bool; (*Accelerated blits SW -> HW*)
   blit_sw_color_key : bool; (*Accelerated blits with color key*)
   blit_sw_alpha : bool; (*Accelerated blits with alpha*)
   blit_fill : bool; (*Accelerated color fill*)
   video_mem : int; (*Total amount of video memory (Ko)*)
}
Information on either the 'best' available mode (if called before set_video_mode) or the current video mode.
val get_video_info : unit -> video_info
val get_video_info_format : unit -> pixel_format_info
Returns information about the pixel format
val driver_name : unit -> string
Returns the name of the video driver
type video_flag = [ `ANYFORMAT
| `ASYNCBLIT
| `DOUBLEBUF
| `FULLSCREEN
| `HWPALETTE
| `HWSURFACE
| `NOFRAME
| `OPENGL
| `OPENGLBLIT
| `RESIZABLE
| `SWSURFACE ]

type modes =
| NOMODE (*no dimensions available for the requested format*)
| ANY (*any dimension okay*)
| DIM of (int * int) list
val list_modes : ?bpp:int -> video_flag list -> modes
Returns a list of available screen dimensions for the given format and video flags, sorted largest to smallest or NOMODE or ANY
val video_mode_ok : w:int -> h:int -> bpp:int -> video_flag list -> int
Check to see if a particular video mode is supported.
Returns 0 if the requested mode is not supported 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, set_video_mode will succeed, but will emulate the requested bits-per-pixel with a shadow surface.

Surfaces


type surface 
Graphical surface datatype
type surface_flags = [ `ANYFORMAT
| `ASYNCBLIT
| `DOUBLEBUF
| `FULLSCREEN
| `HWACCEL
| `HWPALETTE
| `HWSURFACE
| `NOFRAME
| `OPENGL
| `OPENGLBLIT
| `PREALLOC
| `RESIZABLE
| `RLEACCEL
| `SRCALPHA
| `SRCCOLORKEY
| `SWSURFACE ]

type surface_info = {
   flags : surface_flags list;
   w : int; (*width*)
   h : int; (*height*)
   pitch : int; (*pitch*)
   clip_rect : rect; (*clipping information*)
   refcount : int; (*reference count*)
}
val surface_info : surface -> surface_info
Returns information for the given surface
val surface_format : surface -> pixel_format_info
Returns pixel format information for the given surface
val surface_dims : surface -> int * int * int
Returns width, height and pitch of the given surface
val surface_flags : surface -> surface_flags list
Returns flag list for the given surface
val surface_bpp : surface -> int
Returns bits-per-pixel for the given surface

Video modes-related functions


val get_video_surface : unit -> surface
Returns the current display surface
val set_video_mode : w:int -> h:int -> ?bpp:int -> video_flag list -> surface
Set up a video mode with the specified width, height and bits-per-pixel.
Returns the current display surface
bpp : if omited, it is treated as the current display bits per pixel
val update_rect : ?rect:rect -> surface -> unit
rect : makes sure the given area is updated on the given screen. The rectangle must be confined within the screen boundaries (no clipping is done). Updates the entire screen if omitted
val update_rects : rect list -> surface -> unit
Makes sure the given list of rectangles is updated on the given screen. The rectangles must all be confined within the screen boundaries (no clipping is done). This function should not be called while screen is locked.
val flip : surface -> unit
Swaps screen buffers.

On hardware that supports double-buffering (`DOUBLEBUF), 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 update_rect


Color manipulation


val set_gamma : r:float -> g:float -> b:float -> unit
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.
type color = int * int * int 
Format independent color description (r,g,b) are 8 bits unsigned integers
val black : color
val white : color
val red : color
val green : color
val blue : color
val yellow : color
val cyan : color
val magenta : color

Palettes


val use_palette : surface -> bool
Returns true if surface use indexed colors
val palette_ncolors : surface -> int
Number of colors in the surface's palette
val get_palette_color : surface -> int -> color
Retrieve a color by its index in a surface's palette

type palette_flag =
| LOGPAL (*set logical palette, which controls how blits are mapped to/from the surface*)
| PHYSPAL (*set physical palette, which controls how pixels look on the screen*)
| LOGPHYSPAL
val set_palette : surface ->
?flag:palette_flag ->
?firstcolor:int -> color array -> unit
Sets a portion of the palette for a given 8-bit surface.
flag : defaults to LOGPHYSPAL
firstcolor : where to blit the color array given as argument (defaults to 0)

Conversions


val map_RGB : surface -> ?alpha:int -> color -> int32
Maps an RGB triple or an RGBA quadruple to a pixel value for a given pixel format
val get_RGB : surface -> int32 -> color
Maps a pixel value into the RGB components for a given pixel format
Returns RGB color
val get_RGBA : surface -> int32 -> color * int
Maps a pixel value into the RGBA components for a given pixel format *
Returns RGB color and alpha value

Creating RGB surface


val create_RGB_surface : [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list ->
w:int ->
h:int ->
bpp:int ->
rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface
Creates a RGB surface. 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 given masks.
Returns the new surface
val create_RGB_surface_format : surface ->
[ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list ->
w:int -> h:int -> surface
Creates a RGB surface with the same pixel format as the first parameter.
val create_RGB_surface_from_32 : (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t ->
w:int ->
h:int ->
pitch:int ->
rmask:int32 -> gmask:int32 -> bmask:int32 -> amask:int32 -> surface
val create_RGB_surface_from_24 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
w:int ->
h:int ->
pitch:int ->
rmask:int -> gmask:int -> bmask:int -> amask:int -> surface
val create_RGB_surface_from_16 : (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
w:int ->
h:int ->
pitch:int ->
rmask:int -> gmask:int -> bmask:int -> amask:int -> surface
val create_RGB_surface_from_8 : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
w:int ->
h:int ->
pitch:int ->
rmask:int -> gmask:int -> bmask:int -> amask:int -> surface

Locking/Unlocking surface


val must_lock : surface -> bool
Returns true if the surface should be locked before accessing its pixels
val lock : surface -> unit
Sets up a surface for directly accessing the pixels.
val unlock : surface -> unit
Releases the lock on the given surface

Accessing surface pixels


val pixel_data : surface ->
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val pixel_data_8 : surface ->
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val pixel_data_16 : surface ->
(int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val pixel_data_24 : surface ->
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val pixel_data_32 : surface ->
(int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
val get_pixel : surface -> x:int -> y:int -> int32
val get_pixel_color : surface -> x:int -> y:int -> color
Access an individual pixel on a surface and returns is as a color. The surface may have to be locked before access.
val put_pixel : surface -> x:int -> y:int -> int32 -> unit
val put_pixel_color : surface -> x:int -> y:int -> color -> unit
Sets an individual pixel on a surface. The surface may have to be locked before access.

Reading/writing in BMP files


val load_BMP : string -> surface
Loads a surface from a named Windows BMP file.
val load_BMP_from_mem : string -> surface
Loads a BMP image from a memory buffer.
val save_BMP : surface -> string -> unit
Saves the surface as a Windows BMP file named file.

Colorkey and alpha stuff


val unset_color_key : surface -> unit
val set_color_key : surface -> ?rle:bool -> int32 -> unit
Sets the color key (transparent pixel) in a blittable surface.
val get_color_key : surface -> int32
Returns the color key of the given surface
val unset_alpha : surface -> unit
val set_alpha : surface -> ?rle:bool -> int -> unit
sets the alpha value for the entire surface, as opposed to using the alpha component of each pixel.
val get_alpha : surface -> int
Returns the alpha value of the given surface

Clipping


val unset_clip_rect : surface -> unit
disable clipping for the given surface
val set_clip_rect : surface -> rect -> unit
Sets the clipping rectangle for the destination surface in a blit.
val get_clip_rect : surface -> rect
Returns the clipping rectangle for the destination surface in a blit.

Blitting


val blit_surface : src:surface ->
?src_rect:rect ->
dst:surface -> ?dst_rect:rect -> unit -> unit
Performs a fast blit from the source surface to the destination surface.
src_rect : the width and height determine the size of the copied rectangle. If omitted, the entire surface is copied.
dst_rect : only the position is used (the width and height are ignored). If omitted, the detination position (upper left corner) is (0, 0).

The final blit rectangles are saved in src_rect and dst_rect after all clipping is performed.

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

val fill_rect : ?rect:rect -> surface -> int32 -> unit
performs a fast fill of the given rectangle with 'color'
val display_format : ?alpha:bool -> surface -> surface
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.
alpha : if true, include an alpha channel in the new surface
ocamlsdl-0.9.1/doc/html/type_Sdlvideo.html0000664000076400007640000007445511774643041017274 0ustar olivoliv OCamlSDL 0.9.1 : Sdlvideo sig
  exception Video_exn of string
  type rect = {
    mutable r_x : int;
    mutable r_y : int;
    mutable r_w : int;
    mutable r_h : int;
  }
  val rect : x:int -> y:int -> w:int -> h:int -> Sdlvideo.rect
  val copy_rect : Sdlvideo.rect -> Sdlvideo.rect
  type pixel_format_info = {
    palette : bool;
    bits_pp : int;
    bytes_pp : int;
    rmask : int32;
    gmask : int32;
    bmask : int32;
    amask : int32;
    rshift : int;
    gshift : int;
    bshift : int;
    ashift : int;
    rloss : int;
    gloss : int;
    bloss : int;
    aloss : int;
    colorkey : int32;
    alpha : int;
  }
  type video_info = {
    hw_available : bool;
    wm_available : bool;
    blit_hw : bool;
    blit_hw_color_key : bool;
    blit_hw_alpha : bool;
    blit_sw : bool;
    blit_sw_color_key : bool;
    blit_sw_alpha : bool;
    blit_fill : bool;
    video_mem : int;
  }
  val get_video_info : unit -> Sdlvideo.video_info
  val get_video_info_format : unit -> Sdlvideo.pixel_format_info
  val driver_name : unit -> string
  type video_flag =
      [ `ANYFORMAT
      | `ASYNCBLIT
      | `DOUBLEBUF
      | `FULLSCREEN
      | `HWPALETTE
      | `HWSURFACE
      | `NOFRAME
      | `OPENGL
      | `OPENGLBLIT
      | `RESIZABLE
      | `SWSURFACE ]
  type modes = NOMODE | ANY | DIM of (int * int) list
  val list_modes : ?bpp:int -> Sdlvideo.video_flag list -> Sdlvideo.modes
  val video_mode_ok :
    w:int -> h:int -> bpp:int -> Sdlvideo.video_flag list -> int
  type surface
  type surface_flags =
      [ `ANYFORMAT
      | `ASYNCBLIT
      | `DOUBLEBUF
      | `FULLSCREEN
      | `HWACCEL
      | `HWPALETTE
      | `HWSURFACE
      | `NOFRAME
      | `OPENGL
      | `OPENGLBLIT
      | `PREALLOC
      | `RESIZABLE
      | `RLEACCEL
      | `SRCALPHA
      | `SRCCOLORKEY
      | `SWSURFACE ]
  type surface_info = {
    flags : Sdlvideo.surface_flags list;
    w : int;
    h : int;
    pitch : int;
    clip_rect : Sdlvideo.rect;
    refcount : int;
  }
  val surface_info : Sdlvideo.surface -> Sdlvideo.surface_info
  val surface_format : Sdlvideo.surface -> Sdlvideo.pixel_format_info
  val surface_dims : Sdlvideo.surface -> int * int * int
  val surface_flags : Sdlvideo.surface -> Sdlvideo.surface_flags list
  val surface_bpp : Sdlvideo.surface -> int
  val get_video_surface : unit -> Sdlvideo.surface
  val set_video_mode :
    w:int ->
    h:int -> ?bpp:int -> Sdlvideo.video_flag list -> Sdlvideo.surface
  val update_rect : ?rect:Sdlvideo.rect -> Sdlvideo.surface -> unit
  val update_rects : Sdlvideo.rect list -> Sdlvideo.surface -> unit
  val flip : Sdlvideo.surface -> unit
  val set_gamma : r:float -> g:float -> b:float -> unit
  type color = int * int * int
  val black : Sdlvideo.color
  val white : Sdlvideo.color
  val red : Sdlvideo.color
  val green : Sdlvideo.color
  val blue : Sdlvideo.color
  val yellow : Sdlvideo.color
  val cyan : Sdlvideo.color
  val magenta : Sdlvideo.color
  val use_palette : Sdlvideo.surface -> bool
  val palette_ncolors : Sdlvideo.surface -> int
  val get_palette_color : Sdlvideo.surface -> int -> Sdlvideo.color
  type palette_flag = LOGPAL | PHYSPAL | LOGPHYSPAL
  val set_palette :
    Sdlvideo.surface ->
    ?flag:Sdlvideo.palette_flag ->
    ?firstcolor:int -> Sdlvideo.color array -> unit
  val map_RGB : Sdlvideo.surface -> ?alpha:int -> Sdlvideo.color -> int32
  val get_RGB : Sdlvideo.surface -> int32 -> Sdlvideo.color
  val get_RGBA : Sdlvideo.surface -> int32 -> Sdlvideo.color * int
  val create_RGB_surface :
    [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list ->
    w:int ->
    h:int ->
    bpp:int ->
    rmask:int32 ->
    gmask:int32 -> bmask:int32 -> amask:int32 -> Sdlvideo.surface
  val create_RGB_surface_format :
    Sdlvideo.surface ->
    [ `ASYNCBLIT | `HWSURFACE | `SRCALPHA | `SRCCOLORKEY | `SWSURFACE ] list ->
    w:int -> h:int -> Sdlvideo.surface
  val create_RGB_surface_from_32 :
    (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t ->
    w:int ->
    h:int ->
    pitch:int ->
    rmask:int32 ->
    gmask:int32 -> bmask:int32 -> amask:int32 -> Sdlvideo.surface
  val create_RGB_surface_from_24 :
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
    w:int ->
    h:int ->
    pitch:int ->
    rmask:int -> gmask:int -> bmask:int -> amask:int -> Sdlvideo.surface
  val create_RGB_surface_from_16 :
    (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
    w:int ->
    h:int ->
    pitch:int ->
    rmask:int -> gmask:int -> bmask:int -> amask:int -> Sdlvideo.surface
  val create_RGB_surface_from_8 :
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
    w:int ->
    h:int ->
    pitch:int ->
    rmask:int -> gmask:int -> bmask:int -> amask:int -> Sdlvideo.surface
  val must_lock : Sdlvideo.surface -> bool
  val lock : Sdlvideo.surface -> unit
  val unlock : Sdlvideo.surface -> unit
  val pixel_data :
    Sdlvideo.surface ->
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
  val pixel_data_8 :
    Sdlvideo.surface ->
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
  val pixel_data_16 :
    Sdlvideo.surface ->
    (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
  val pixel_data_24 :
    Sdlvideo.surface ->
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
  val pixel_data_32 :
    Sdlvideo.surface ->
    (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
  val get_pixel : Sdlvideo.surface -> x:int -> y:int -> int32
  val get_pixel_color : Sdlvideo.surface -> x:int -> y:int -> Sdlvideo.color
  val put_pixel : Sdlvideo.surface -> x:int -> y:int -> int32 -> unit
  val put_pixel_color :
    Sdlvideo.surface -> x:int -> y:int -> Sdlvideo.color -> unit
  val load_BMP : string -> Sdlvideo.surface
  val load_BMP_from_mem : string -> Sdlvideo.surface
  val save_BMP : Sdlvideo.surface -> string -> unit
  val unset_color_key : Sdlvideo.surface -> unit
  val set_color_key : Sdlvideo.surface -> ?rle:bool -> int32 -> unit
  val get_color_key : Sdlvideo.surface -> int32
  val unset_alpha : Sdlvideo.surface -> unit
  val set_alpha : Sdlvideo.surface -> ?rle:bool -> int -> unit
  val get_alpha : Sdlvideo.surface -> int
  val unset_clip_rect : Sdlvideo.surface -> unit
  val set_clip_rect : Sdlvideo.surface -> Sdlvideo.rect -> unit
  val get_clip_rect : Sdlvideo.surface -> Sdlvideo.rect
  val blit_surface :
    src:Sdlvideo.surface ->
    ?src_rect:Sdlvideo.rect ->
    dst:Sdlvideo.surface -> ?dst_rect:Sdlvideo.rect -> unit -> unit
  val fill_rect : ?rect:Sdlvideo.rect -> Sdlvideo.surface -> int32 -> unit
  val display_format : ?alpha:bool -> Sdlvideo.surface -> Sdlvideo.surface
end
ocamlsdl-0.9.1/doc/html/index_methods.html0000664000076400007640000000252611774643042017303 0ustar olivoliv OCamlSDL 0.9.1 : Index of class methods

Index of class methods


ocamlsdl-0.9.1/doc/html/index_class_types.html0000664000076400007640000000252211774643042020165 0ustar olivoliv OCamlSDL 0.9.1 : Index of class types

Index of class types


ocamlsdl-0.9.1/doc/html/type_Sdlwm.html0000664000076400007640000000463711774643041016604 0ustar olivoliv OCamlSDL 0.9.1 : Sdlwm sig
  val set_caption : title:string -> icon:string -> unit
  val get_caption : unit -> string * string
  val set_icon : Sdlvideo.surface -> unit
  val iconify : unit -> bool
  val toggle_fullscreen : unit -> bool
  val grab_input : bool -> unit
  val query_grab : unit -> bool
end
ocamlsdl-0.9.1/doc/html/Sdlevent.Old.html0000664000076400007640000001227111774643041016747 0ustar olivoliv OCamlSDL 0.9.1 : Sdlevent.Old

Module Sdlevent.Old


module Old: sig .. end
Deprecated.this interface was used in version of ocamlsdl < 0.6
Callback-based event handling.


Definition of the event callbacks


type keyboard_event_func = Sdlkey.t -> Sdlevent.switch_state -> int -> int -> unit 
Keyboard event called with the activated key, its state and the coordinates of the mouse pointer
type mouse_event_func = Sdlmouse.button -> Sdlevent.switch_state -> int -> int -> unit 
Mouse button event called with the activated button, its state and the coordinates of the mouse pointer
type mousemotion_event_func = int -> int -> unit 
Mouse motion event called with the coordinates of the mouse pointer
type idle_event_func = unit -> unit 
type resize_event_func = int -> int -> unit 

Functions for setting the current event callbacks


val set_keyboard_event_func : keyboard_event_func -> unit
val set_mouse_event_func : mouse_event_func -> unit
val set_mousemotion_event_func : mousemotion_event_func -> unit
val set_idle_event_func : idle_event_func -> unit
val set_resize_event_func : resize_event_func -> unit

Event loop


val start_event_loop : unit -> unit
val exit_event_loop : unit -> unit
ocamlsdl-0.9.1/doc/html/Sdlttf.html0000664000076400007640000003107111774643041015705 0ustar olivoliv OCamlSDL 0.9.1 : Sdlttf

Module Sdlttf


module Sdlttf: sig .. end
This module provides TTF (TrueType Font) support

exception SDLttf_exception of string
Exception for reporting errors
val init : unit -> unit
Initialise SDL_tff and freetype
val quit : unit -> unit
Quits the system

General operations on font datatype


type font 
abstract font datatype
val open_font : string -> ?index:int -> int -> font
open a font file and create a font of the specified point size
Returns font datatype

Set and retrieve the font style This font style is implemented by modifying the font glyphs, and doesn't reflect any inherent properties of the truetype font file.

type font_style =
| NORMAL
| BOLD
| ITALIC
| UNDERLINE
val get_font_style : font -> font_style list
Retrieve the font style : either NORMAL or a combination of BOLD, ITALIC and UNDERLINE
val set_font_style : font -> font_style list -> unit

Font information


val font_height : font -> int
Returns the total height(int) of the font (usually equal to point size)
val font_ascent : font -> int
Returns the offset(int) from the baseline to the top of the font this is a positive value, relative to the baseline
val font_descent : font -> int
Returns the offset from the baseline to the bottom of the font this is a negative value, relative to the baseline
val font_lineskip : font -> int
Get the recommended spacing between lines of text for this font
val font_faces : font -> int
Get the number of faces of the font

Get some font face attributes, if any
val is_fixed_width : font -> bool
val family_name : font -> string
val style_name : font -> string

Text rendering functions


val size_text : font -> string -> int * int
Get the dimensions of a rendered string of text
val size_utf8 : font -> string -> int * int
val glyph_metrics : font -> char -> int * int * int * int
Returns the metrics (minx,maxx,miny,maxy) of a glyph

type render_kind =
| SOLID of Sdlvideo.color
| SHADED of Sdlvideo.color * Sdlvideo.color
| BLENDED of Sdlvideo.color
Variant type for the generic rendering functions

Text rendering functions


val render_text_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_text_shaded : font ->
string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
val render_text_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_utf8_solid : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_utf8_shaded : font ->
string -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
val render_utf8_blended : font -> string -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_text : font -> render_kind -> string -> Sdlvideo.surface

Glyph rendering functions


val render_glyph_solid : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_glyph_shaded : font ->
char -> fg:Sdlvideo.color -> bg:Sdlvideo.color -> Sdlvideo.surface
val render_glyph_blended : font -> char -> fg:Sdlvideo.color -> Sdlvideo.surface
val render_glyph : font -> render_kind -> char -> Sdlvideo.surface
ocamlsdl-0.9.1/doc/html/Sdlloader.html0000664000076400007640000000544311774643041016362 0ustar olivoliv OCamlSDL 0.9.1 : Sdlloader

Module Sdlloader


module Sdlloader: sig .. end
Image loader module

exception SDLloader_exception of string
Exception to report errors
val load_image : string -> Sdlvideo.surface
load an image as a surface
val load_image_from_mem : string -> Sdlvideo.surface
val read_XPM_from_array : string array -> Sdlvideo.surface
creates a surface from an array of strings (in the source code)
ocamlsdl-0.9.1/doc/html/type_Sdlmixer.html0000664000076400007640000003646611774643041017312 0ustar olivoliv OCamlSDL 0.9.1 : Sdlmixer sig
  exception SDLmixer_exception of string
  val version : unit -> Sdl.version
  type format =
      AUDIO_FORMAT_U8
    | AUDIO_FORMAT_S8
    | AUDIO_FORMAT_U16LSB
    | AUDIO_FORMAT_S16LSB
    | AUDIO_FORMAT_U16MSB
    | AUDIO_FORMAT_S16MSB
    | AUDIO_FORMAT_U16SYS
    | AUDIO_FORMAT_S16SYS
  type channels = MONO | STEREO
  val open_audio :
    ?freq:int ->
    ?format:Sdlmixer.format ->
    ?chunksize:int -> ?channels:Sdlmixer.channels -> unit -> unit
  val close_audio : unit -> unit
  type specs = {
    frequency : int;
    format : Sdlmixer.format;
    channels : Sdlmixer.channels;
  }
  val query_specs : unit -> Sdlmixer.specs
  type chunk
  val loadWAV : string -> Sdlmixer.chunk
  val loadWAV_from_mem : string -> Sdlmixer.chunk
  val load_string : string -> Sdlmixer.chunk
  val load_string_raw : string -> Sdlmixer.chunk
  val volume_chunk : Sdlmixer.chunk -> float
  val setvolume_chunk : Sdlmixer.chunk -> float -> unit
  val free_chunk : Sdlmixer.chunk -> unit
  type channel = int
  val all_channels : Sdlmixer.channel
  val num_channels : unit -> int
  val allocate_channels : int -> int
  val play_channel :
    ?channel:Sdlmixer.channel ->
    ?loops:int -> ?ticks:float -> Sdlmixer.chunk -> unit
  val play_sound : Sdlmixer.chunk -> unit
  val fadein_channel :
    ?channel:Sdlmixer.channel ->
    ?loops:int -> ?ticks:float -> Sdlmixer.chunk -> float -> unit
  val volume_channel : Sdlmixer.channel -> float
  val setvolume_channel : Sdlmixer.channel -> float -> unit
  val pause_channel : Sdlmixer.channel -> unit
  val resume_channel : Sdlmixer.channel -> unit
  val halt_channel : Sdlmixer.channel -> unit
  val expire_channel : Sdlmixer.channel -> float option -> unit
  val fadeout_channel : Sdlmixer.channel -> float -> unit
  val playing_channel : Sdlmixer.channel -> bool
  val num_playing_channel : unit -> int
  val paused_channel : Sdlmixer.channel -> bool
  val num_paused_channel : unit -> int
  type fade_status = NO_FADING | FADING_OUT | FADING_IN
  val fading_channel : Sdlmixer.channel -> Sdlmixer.fade_status
  type group = int
  val default_group : Sdlmixer.group
  val reserve_channels : int -> int
  val group_channel : Sdlmixer.channel -> Sdlmixer.group -> unit
  val group_channels :
    from_c:Sdlmixer.channel ->
    to_c:Sdlmixer.channel -> Sdlmixer.group -> unit
  val group_count : Sdlmixer.group -> int
  val group_available : Sdlmixer.group -> Sdlmixer.channel
  val group_oldest : Sdlmixer.group -> Sdlmixer.channel
  val group_newer : Sdlmixer.group -> Sdlmixer.channel
  val fadeout_group : Sdlmixer.group -> float -> unit
  val halt_group : Sdlmixer.group -> unit
  type music
  type music_kind = NONE | CMD | WAV | MOD | MID | OGG | MP3
  val load_music : string -> Sdlmixer.music
  val free_music : Sdlmixer.music -> unit
  val play_music : ?loops:int -> Sdlmixer.music -> unit
  val fadein_music : ?loops:int -> Sdlmixer.music -> float -> unit
  val volume_music : unit -> float
  val setvolume_music : float -> unit
  val pause_music : unit -> unit
  val resume_music : unit -> unit
  val rewind_music : unit -> unit
  val set_music_cmd : string -> unit
  val unset_music_cmd : unit -> unit
  val halt_music : unit -> unit
  val fadeout_music : float -> unit
  val music_type : Sdlmixer.music option -> Sdlmixer.music_kind
  val playing_music : unit -> bool
  val paused_music : unit -> bool
  val fading_music : unit -> Sdlmixer.fade_status
end
ocamlsdl-0.9.1/doc/html/style.css0000664000076400007640000000437311760735640015440 0ustar olivoliva:visited {color : #416DFF; text-decoration : none; } a:link {color : #416DFF; text-decoration : none;} a:hover {color : Red; text-decoration : none; background-color: #5FFF88} a:active {color : Red; text-decoration : underline; } .keyword { font-weight : bold ; color : Red } .keywordsign { color : #C04600 } .superscript { font-size : 4 } .subscript { font-size : 4 } .comment { color : Green } .constructor { color : Blue } .type { color : #5C6585 } .string { color : Maroon } .warning { color : Red ; font-weight : bold } .info { margin-left : 3em; margin-right : 3em } .param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em } .code { color : #465F91 ; } h1 { font-size : 20pt ; text-align: center; } h2 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90BDFF ;padding: 2px; } h3 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90DDFF ;padding: 2px; } h4 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90EDFF ;padding: 2px; } h5 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90FDFF ;padding: 2px; } h6 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #C0FFFF ; padding: 2px; } div.h7 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #E0FFFF ; padding: 2px; } div.h8 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #F0FFFF ; padding: 2px; } div.h9 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #FFFFFF ; padding: 2px; } .typetable { border-style : hidden } .indextable { border-style : hidden } .paramstable { border-style : hidden ; padding: 5pt 5pt} body { background-color : White } tr { background-color : White } td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;} pre { margin-bottom: 4px } div.sig_block {margin-left: 2em} *:target { background: yellow; } ocamlsdl-0.9.1/doc/html/index_classes.html0000664000076400007640000000251211774643042017270 0ustar olivoliv OCamlSDL 0.9.1 : Index of classes

Index of classes


ocamlsdl-0.9.1/doc/html/index.html0000664000076400007640000000615011774643042015555 0ustar olivoliv OCamlSDL 0.9.1

OCamlSDL 0.9.1

Index of types
Index of exceptions
Index of values
Index of modules


Sdl
This module contains functions for initializing/quitting the library
Sdlcdrom
This module provides CD-ROM handling
Sdltimer
Time-related functions
Sdljoystick
Module for SDL joystick event handling
Sdlkey
Keyboard handling and key symbols
Sdlmouse
Mouse event handling and cursors
Sdlevent
SDL event handling
Sdlvideo
Module for video manipulations
Sdlwm
Window Manager interaction
Sdlttf
This module provides TTF (TrueType Font) support
Sdlloader
Image loader module
Sdlmixer
Simple multi-channel audio mixer
Sdlgfx
ocamlsdl-0.9.1/doc/html/index_module_types.html0000664000076400007640000000252411774643042020347 0ustar olivoliv OCamlSDL 0.9.1 : Index of module types

Index of module types


ocamlsdl-0.9.1/doc/html/type_Sdltimer.html0000664000076400007640000000312211774643040017264 0ustar olivoliv OCamlSDL 0.9.1 : Sdltimer sig val delay : int -> unit val get_ticks : unit -> int endocamlsdl-0.9.1/doc/html/type_Sdlevent.html0000664000076400007640000004574211774643041017304 0ustar olivoliv OCamlSDL 0.9.1 : Sdlevent sig
  exception Event_exn of string
  type active_state = MOUSEFOCUS | INPUTFOCUS | APPACTIVE
  val get_app_state : unit -> Sdlevent.active_state list
  type active_event = { gain : bool; ae_state : Sdlevent.active_state list; }
  type switch_state = RELEASED | PRESSED
  type keyboard_event = {
    ke_which : int;
    ke_state : Sdlevent.switch_state;
    keysym : Sdlkey.t;
    keymod : Sdlkey.mod_state;
    keycode : char;
    unicode : int;
  }
  type mousemotion_event = {
    mme_which : int;
    mme_state : Sdlmouse.button list;
    mme_x : int;
    mme_y : int;
    mme_xrel : int;
    mme_yrel : int;
  }
  type mousebutton_event = {
    mbe_which : int;
    mbe_button : Sdlmouse.button;
    mbe_state : Sdlevent.switch_state;
    mbe_x : int;
    mbe_y : int;
  }
  type joyaxis_event = { jae_which : int; jae_axis : int; jae_value : int; }
  type joyball_event = {
    jle_which : int;
    jle_ball : int;
    jle_xrel : int;
    jle_yrel : int;
  }
  type joyhat_event = { jhe_which : int; jhe_hat : int; jhe_value : int; }
  type joybutton_event = {
    jbe_which : int;
    jbe_button : int;
    jbe_state : Sdlevent.switch_state;
  }
  type event =
      ACTIVE of Sdlevent.active_event
    | KEYDOWN of Sdlevent.keyboard_event
    | KEYUP of Sdlevent.keyboard_event
    | MOUSEMOTION of Sdlevent.mousemotion_event
    | MOUSEBUTTONDOWN of Sdlevent.mousebutton_event
    | MOUSEBUTTONUP of Sdlevent.mousebutton_event
    | JOYAXISMOTION of Sdlevent.joyaxis_event
    | JOYBALLMOTION of Sdlevent.joyball_event
    | JOYHATMOTION of Sdlevent.joyhat_event
    | JOYBUTTONDOWN of Sdlevent.joybutton_event
    | JOYBUTTONUP of Sdlevent.joybutton_event
    | QUIT
    | SYSWM
    | VIDEORESIZE of int * int
    | VIDEOEXPOSE
    | USER of int
  val string_of_event : Sdlevent.event -> string
  type event_mask = int
  val active_mask : Sdlevent.event_mask
  val keydown_mask : Sdlevent.event_mask
  val keyup_mask : Sdlevent.event_mask
  val mousemotion_mask : Sdlevent.event_mask
  val mousebuttondown_mask : Sdlevent.event_mask
  val mousebuttonup_mask : Sdlevent.event_mask
  val joyaxismotion_mask : Sdlevent.event_mask
  val joyballmotion_mask : Sdlevent.event_mask
  val joyhatmotion_mask : Sdlevent.event_mask
  val joybuttondown_mask : Sdlevent.event_mask
  val joybuttonup_mask : Sdlevent.event_mask
  val quit_mask : Sdlevent.event_mask
  val syswmevent_mask : Sdlevent.event_mask
  val videoresize_mask : Sdlevent.event_mask
  val videoexpose_mask : Sdlevent.event_mask
  val userevent_mask : Sdlevent.event_mask
  val keyboard_event_mask : Sdlevent.event_mask
  val mouse_event_mask : Sdlevent.event_mask
  val joystick_event_mask : Sdlevent.event_mask
  val all_events_mask : Sdlevent.event_mask
  type event_kind =
      ACTIVE_EVENT
    | KEYDOWN_EVENT
    | KEYUP_EVENT
    | MOUSEMOTION_EVENT
    | MOUSEBUTTONDOWN_EVENT
    | MOUSEBUTTONUP_EVENT
    | JOYAXISMOTION_EVENT
    | JOYBALL_EVENT
    | JOYHAT_EVENT
    | JOYBUTTONDOWN_EVENT
    | JOYBUTTONUP_EVENT
    | QUIT_EVENT
    | SYSWM_EVENT
    | RESIZE_EVENT
    | EXPOSE_EVENT
    | USER_EVENT
  val make_mask : Sdlevent.event_kind list -> Sdlevent.event_mask
  val of_mask : Sdlevent.event_mask -> Sdlevent.event_kind list
  val enable_events : Sdlevent.event_mask -> unit
  val disable_events : Sdlevent.event_mask -> unit
  val get_enabled_events : unit -> Sdlevent.event_mask
  val get_state : Sdlevent.event_kind -> bool
  val set_state : bool -> Sdlevent.event_kind -> unit
  val pump : unit -> unit
  val wait_event : unit -> Sdlevent.event
  val wait : unit -> unit
  val poll : unit -> Sdlevent.event option
  val has_event : unit -> bool
  val peek : ?mask:Sdlevent.event_mask -> int -> Sdlevent.event list
  val get : ?mask:Sdlevent.event_mask -> int -> Sdlevent.event list
  val add : Sdlevent.event list -> unit
  module Old :
    sig
      type keyboard_event_func =
          Sdlkey.t -> Sdlevent.switch_state -> int -> int -> unit
      type mouse_event_func =
          Sdlmouse.button -> Sdlevent.switch_state -> int -> int -> unit
      type mousemotion_event_func = int -> int -> unit
      type idle_event_func = unit -> unit
      type resize_event_func = int -> int -> unit
      val set_keyboard_event_func : Sdlevent.Old.keyboard_event_func -> unit
      val set_mouse_event_func : Sdlevent.Old.mouse_event_func -> unit
      val set_mousemotion_event_func :
        Sdlevent.Old.mousemotion_event_func -> unit
      val set_idle_event_func : Sdlevent.Old.idle_event_func -> unit
      val set_resize_event_func : Sdlevent.Old.resize_event_func -> unit
      val start_event_loop : unit -> unit
      val exit_event_loop : unit -> unit
    end
  val link_me : unit
end
ocamlsdl-0.9.1/doc/html/index_exceptions.html0000664000076400007640000000625711774643042020026 0ustar olivoliv OCamlSDL 0.9.1 : Index of exceptions

Index of exceptions


E
Event_exn [Sdlevent]
The exception used for reporting events-related errors.

S
SDL_init_exception [Sdl]
Exception for reporting errors during initialization
SDLcdrom_exception [Sdlcdrom]
Exception used to report errors
SDLjoystick_exception [Sdljoystick]
exception for error reporting
SDLloader_exception [Sdlloader]
Exception to report errors
SDLmixer_exception [Sdlmixer]
Exception used to report errors
SDLttf_exception [Sdlttf]
Exception for reporting errors

T
Trayempty [Sdlcdrom]
Exception to report that thre's no cd in the drive

V
Video_exn [Sdlvideo]

ocamlsdl-0.9.1/doc/html/type_Sdlloader.html0000664000076400007640000000410411774643041017414 0ustar olivoliv OCamlSDL 0.9.1 : Sdlloader sig
  exception SDLloader_exception of string
  val load_image : string -> Sdlvideo.surface
  val load_image_from_mem : string -> Sdlvideo.surface
  val read_XPM_from_array : string array -> Sdlvideo.surface
end
ocamlsdl-0.9.1/doc/html/index_attributes.html0000664000076400007640000000253411774643042020025 0ustar olivoliv OCamlSDL 0.9.1 : Index of class attributes

Index of class attributes


ocamlsdl-0.9.1/doc/html/Sdljoystick.html0000664000076400007640000002077011774643040016752 0ustar olivoliv OCamlSDL 0.9.1 : Sdljoystick

Module Sdljoystick


module Sdljoystick: sig .. end
Module for SDL joystick event handling


In order to use these functions, Sdl.init must have been called with the `JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers.
exception SDLjoystick_exception of string
exception for error reporting
type t 
The joystick abstract type used to identify an SDL joystick
val num_joysticks : unit -> int
Count the number of joysticks attached to the system
val name : int -> string
Get the implementation dependent name of a joystick. This can be called before any joysticks are opened.
val open_joystick : int -> t
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.
Raises SDLjoystick_exception if an error occurred
val opened : int -> bool
Returns true if joystick has been opened
val index : t -> int
Get the device index of an opened joystick
val num_axes : t -> int
Get the number of general axis controls on a joystick
val num_balls : t -> int
Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled.
val num_hats : t -> int
Get the number of POV hats on a joystick
val num_buttons : t -> int
Get the number of buttons on a joystick

Joystick state


val update : t -> unit
Update the current state of the open joysticks. This is called automatically by the event loop if any joystick events are enabled.

Enable/disable joystick event polling. If joystick events are disabled, you must call Sdljoystick.update yourself and check the state of the joystick when you want joystick information.
val set_event_state : bool -> unit
val get_event_state : unit -> bool
type hat_value = int 
val hat_centered : hat_value
val hat_up : hat_value
val hat_right : hat_value
val hat_down : hat_value
val hat_left : hat_value
val hat_rightup : hat_value
val hat_rightdown : hat_value
val hat_leftup : hat_value
val hat_leftdown : hat_value
val get_axis : t -> int -> int
val get_hat : t -> int -> hat_value
val get_ball : t -> int -> int * int
val get_button : t -> int -> bool
val close : t -> unit
Close a joystick previously opened with Sdljoystick.open_joystick
ocamlsdl-0.9.1/doc/html/Sdlmixer.html0000664000076400007640000006314511774643041016243 0ustar olivoliv OCamlSDL 0.9.1 : Sdlmixer

Module Sdlmixer


module Sdlmixer: sig .. end
Simple multi-channel audio mixer

exception SDLmixer_exception of string
Exception used to report errors

General API


val version : unit -> Sdl.version
Get the version of the dynamically linked SDL_mixer library

type format =
| AUDIO_FORMAT_U8 (*Unsigned 8-bit samples*)
| AUDIO_FORMAT_S8 (*Signed 8-bit samples*)
| AUDIO_FORMAT_U16LSB (*Unsigned 16-bit samples*)
| AUDIO_FORMAT_S16LSB (*Signed 16-bit samples*)
| AUDIO_FORMAT_U16MSB (*As above, but big-endian byte order*)
| AUDIO_FORMAT_S16MSB (*As above, but big-endian byte order*)
| AUDIO_FORMAT_U16SYS (*Unsigned, native audio byte ordering*)
| AUDIO_FORMAT_S16SYS (*Signed, native audio byte ordering*)
Audio format flags

type channels =
| MONO
| STEREO
val open_audio : ?freq:int ->
?format:format ->
?chunksize:int -> ?channels:channels -> unit -> unit
open_audio frequency format chunksize channels () opens the mixer with a certain audio format.
  • frequency could be 8000 11025 22050 44100 ; defaults to 22050
  • format defaults to AUDIO_FORMAT_S16SYS
  • chunksize defaults to 4096
  • channels defaults to STEREO

val close_audio : unit -> unit
Close the mixer, halting all playing audio

type specs = {
   frequency : int;
   format : format;
   channels : channels;
}
val query_specs : unit -> specs
Find out what the actual audio device parameters are.
Raises SDLmixer_exception if the audio has not been opened

Samples


type chunk 
val loadWAV : string -> chunk
Load a wave file
val loadWAV_from_mem : string -> chunk
val load_string : string -> chunk
Load a wave file of the mixer format from a memory buffer
val load_string_raw : string -> chunk
Load raw audio data of the mixer format from a memory buffer
val volume_chunk : chunk -> float
val setvolume_chunk : chunk -> float -> unit
val free_chunk : chunk -> unit
Free an audio chunk previously loaded

Channels


type channel = int 
val all_channels : channel
A special value for representing all channels (-1 actually).
val num_channels : unit -> int
Returns the number of channels currently allocated
val allocate_channels : int -> int
Dynamically change the number of channels managed by the mixer. If decreasing the number of channels, the upper channels are stopped.
Returns the new number of allocated channels
val play_channel : ?channel:channel ->
?loops:int -> ?ticks:float -> chunk -> unit
play_channel channel loops ticks chunk Play an audio chunk.
channel : channel to play on. If not specified, play on the first free channel.
loops : number of times to play the chunk. If -1, loop infinitely (~65000 times).
ticks : if specified, play for at most 'ticks' seconds.
val play_sound : chunk -> unit
Play an audio chunk. Same as above, without the optional parameters
val fadein_channel : ?channel:channel ->
?loops:int -> ?ticks:float -> chunk -> float -> unit
fadein_channel channel loops ticks chunck ms : same as play_channel but fades in a over ms seconds.
val volume_channel : channel -> float
Returns the original volume of a specific channel, chunk or music
Returns float between 0 and 1.
val setvolume_channel : channel -> float -> unit
Sets the volume for specified channel or chunk. Volume is a float between 0 and 1. If lower than 0, nothing is done. If greater than 1, volume is set to 1
val pause_channel : channel -> unit
val resume_channel : channel -> unit
val halt_channel : channel -> unit
val expire_channel : channel -> float option -> unit
expire_channel channel ticks Change the expiration delay for a particular channel. The sample will stop playing after the 'ticks' seconds have elapsed, or remove the expiration if 'ticks' is None
val fadeout_channel : channel -> float -> unit
fadeout_channel channel ticks Halt a channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take.
val playing_channel : channel -> bool
val num_playing_channel : unit -> int
val paused_channel : channel -> bool
val num_paused_channel : unit -> int

type fade_status =
| NO_FADING
| FADING_OUT
| FADING_IN
The different fading types supported
val fading_channel : channel -> fade_status
Query the fading status of a channel

Groups


type group = int 
val default_group : group
The group tag used to represent the group of all the channels. Used to remove a group tag
val reserve_channels : int -> int
Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate them dynamically to the next sample if no channel is specified (see Sdlmixer.play_channel).
Returns the number of reserved channels
val group_channel : channel -> group -> unit
Attach a group tag to a channel. A group tag can be assigned to several mixer channels, to form groups of channels. If group is default_group, the tag is removed.
val group_channels : from_c:channel -> to_c:channel -> group -> unit
Same as above but for a range of channels.
val group_count : group -> int
Returns the number of channels in a group. This is also a subtle way to get the total number of channels when group is default_group.
val group_available : group -> channel
Finds the first available channel in a group of channels
Raises Not_found if none are available.
val group_oldest : group -> channel
Finds the "oldest" sample playing in a group of channels
val group_newer : group -> channel
Finds the "most recent" (i.e. last) sample playing in a group of channels
val fadeout_group : group -> float -> unit
fadeout_group group ticks Halt a group of channel, fading it out progressively till it's silent The ms parameter indicates the number of seconds the fading will take.
val halt_group : group -> unit

Music


type music 

type music_kind =
| NONE
| CMD
| WAV
| MOD
| MID
| OGG
| MP3
The different music types supported
val load_music : string -> music
Load a music file (.mod .s3m .it .xm .ogg)
val free_music : music -> unit
Free music previously loaded
val play_music : ?loops:int -> music -> unit
Play a music chunk.
loops : number of times to play through the music
val fadein_music : ?loops:int -> music -> float -> unit
fadein_music chunck loops music ms : fade in music over ms seconds, same semantics as the play_music function
val volume_music : unit -> float
val setvolume_music : float -> unit
val pause_music : unit -> unit
val resume_music : unit -> unit
val rewind_music : unit -> unit
val set_music_cmd : string -> unit
Stop music and set external music playback command
val unset_music_cmd : unit -> unit
Turn off using an external command for music, returning to the internal music playing functionality
val halt_music : unit -> unit
val fadeout_music : float -> unit
fadeout_music ticks Halt the music, fading it out progressively till it's silent. The ms parameter indicates the number of seconds the fading will take.
val music_type : music option -> music_kind
Find out the music format of a mixer music, or the currently playing music, if parameter is None.
val playing_music : unit -> bool
val paused_music : unit -> bool
val fading_music : unit -> fade_status
Query the fading status of a music
ocamlsdl-0.9.1/doc/html/type_Sdlkey.html0000664000076400007640000007636411774643041016757 0ustar olivoliv OCamlSDL 0.9.1 : Sdlkey sig
  type t =
      KEY_UNKNOWN
    | KEY_BACKSPACE
    | KEY_TAB
    | KEY_CLEAR
    | KEY_RETURN
    | KEY_PAUSE
    | KEY_ESCAPE
    | KEY_SPACE
    | KEY_EXCLAIM
    | KEY_QUOTEDBL
    | KEY_HASH
    | KEY_DOLLAR
    | KEY_AMPERSAND
    | KEY_QUOTE
    | KEY_LEFTPAREN
    | KEY_RIGHTPAREN
    | KEY_ASTERISK
    | KEY_PLUS
    | KEY_COMMA
    | KEY_MINUS
    | KEY_PERIOD
    | KEY_SLASH
    | KEY_0
    | KEY_1
    | KEY_2
    | KEY_3
    | KEY_4
    | KEY_5
    | KEY_6
    | KEY_7
    | KEY_8
    | KEY_9
    | KEY_COLON
    | KEY_SEMICOLON
    | KEY_LESS
    | KEY_EQUALS
    | KEY_GREATER
    | KEY_QUESTION
    | KEY_AT
    | KEY_LEFTBRACKET
    | KEY_BACKSLASH
    | KEY_RIGHTBRACKET
    | KEY_CARET
    | KEY_UNDERSCORE
    | KEY_BACKQUOTE
    | KEY_a
    | KEY_b
    | KEY_c
    | KEY_d
    | KEY_e
    | KEY_f
    | KEY_g
    | KEY_h
    | KEY_i
    | KEY_j
    | KEY_k
    | KEY_l
    | KEY_m
    | KEY_n
    | KEY_o
    | KEY_p
    | KEY_q
    | KEY_r
    | KEY_s
    | KEY_t
    | KEY_u
    | KEY_v
    | KEY_w
    | KEY_x
    | KEY_y
    | KEY_z
    | KEY_DELETE
    | KEY_WORLD_0
    | KEY_WORLD_1
    | KEY_WORLD_2
    | KEY_WORLD_3
    | KEY_WORLD_4
    | KEY_WORLD_5
    | KEY_WORLD_6
    | KEY_WORLD_7
    | KEY_WORLD_8
    | KEY_WORLD_9
    | KEY_WORLD_10
    | KEY_WORLD_11
    | KEY_WORLD_12
    | KEY_WORLD_13
    | KEY_WORLD_14
    | KEY_WORLD_15
    | KEY_WORLD_16
    | KEY_WORLD_17
    | KEY_WORLD_18
    | KEY_WORLD_19
    | KEY_WORLD_20
    | KEY_WORLD_21
    | KEY_WORLD_22
    | KEY_WORLD_23
    | KEY_WORLD_24
    | KEY_WORLD_25
    | KEY_WORLD_26
    | KEY_WORLD_27
    | KEY_WORLD_28
    | KEY_WORLD_29
    | KEY_WORLD_30
    | KEY_WORLD_31
    | KEY_WORLD_32
    | KEY_WORLD_33
    | KEY_WORLD_34
    | KEY_WORLD_35
    | KEY_WORLD_36
    | KEY_WORLD_37
    | KEY_WORLD_38
    | KEY_WORLD_39
    | KEY_WORLD_40
    | KEY_WORLD_41
    | KEY_WORLD_42
    | KEY_WORLD_43
    | KEY_WORLD_44
    | KEY_WORLD_45
    | KEY_WORLD_46
    | KEY_WORLD_47
    | KEY_WORLD_48
    | KEY_WORLD_49
    | KEY_WORLD_50
    | KEY_WORLD_51
    | KEY_WORLD_52
    | KEY_WORLD_53
    | KEY_WORLD_54
    | KEY_WORLD_55
    | KEY_WORLD_56
    | KEY_WORLD_57
    | KEY_WORLD_58
    | KEY_WORLD_59
    | KEY_WORLD_60
    | KEY_WORLD_61
    | KEY_WORLD_62
    | KEY_WORLD_63
    | KEY_WORLD_64
    | KEY_WORLD_65
    | KEY_WORLD_66
    | KEY_WORLD_67
    | KEY_WORLD_68
    | KEY_WORLD_69
    | KEY_WORLD_70
    | KEY_WORLD_71
    | KEY_WORLD_72
    | KEY_WORLD_73
    | KEY_WORLD_74
    | KEY_WORLD_75
    | KEY_WORLD_76
    | KEY_WORLD_77
    | KEY_WORLD_78
    | KEY_WORLD_79
    | KEY_WORLD_80
    | KEY_WORLD_81
    | KEY_WORLD_82
    | KEY_WORLD_83
    | KEY_WORLD_84
    | KEY_WORLD_85
    | KEY_WORLD_86
    | KEY_WORLD_87
    | KEY_WORLD_88
    | KEY_WORLD_89
    | KEY_WORLD_90
    | KEY_WORLD_91
    | KEY_WORLD_92
    | KEY_WORLD_93
    | KEY_WORLD_94
    | KEY_WORLD_95
    | KEY_KP0
    | KEY_KP1
    | KEY_KP2
    | KEY_KP3
    | KEY_KP4
    | KEY_KP5
    | KEY_KP6
    | KEY_KP7
    | KEY_KP8
    | KEY_KP9
    | KEY_KP_PERIOD
    | KEY_KP_DIVIDE
    | KEY_KP_MULTIPLY
    | KEY_KP_MINUS
    | KEY_KP_PLUS
    | KEY_KP_ENTER
    | KEY_KP_EQUALS
    | KEY_UP
    | KEY_DOWN
    | KEY_RIGHT
    | KEY_LEFT
    | KEY_INSERT
    | KEY_HOME
    | KEY_END
    | KEY_PAGEUP
    | KEY_PAGEDOWN
    | KEY_F1
    | KEY_F2
    | KEY_F3
    | KEY_F4
    | KEY_F5
    | KEY_F6
    | KEY_F7
    | KEY_F8
    | KEY_F9
    | KEY_F10
    | KEY_F11
    | KEY_F12
    | KEY_F13
    | KEY_F14
    | KEY_F15
    | KEY_NUMLOCK
    | KEY_CAPSLOCK
    | KEY_SCROLLOCK
    | KEY_RSHIFT
    | KEY_LSHIFT
    | KEY_RCTRL
    | KEY_LCTRL
    | KEY_RALT
    | KEY_LALT
    | KEY_RMETA
    | KEY_LMETA
    | KEY_LSUPER
    | KEY_RSUPER
    | KEY_MODE
    | KEY_COMPOSE
    | KEY_HELP
    | KEY_PRINT
    | KEY_SYSREQ
    | KEY_BREAK
    | KEY_MENU
    | KEY_POWER
    | KEY_EURO
    | KEY_UNDO
  val int_of_key : Sdlkey.t -> int
  val key_of_int : int -> Sdlkey.t
  val char_of_key : Sdlkey.t -> char
  val num_keys : int
  val max_code : int
  val name : Sdlkey.t -> string
  val enable_unicode : bool -> unit
  val query_unicode : unit -> bool
  val disable_key_repeat : unit -> unit
  val enable_key_repeat : ?delay:int -> ?interval:int -> unit -> unit
  val get_key_state :
    unit ->
    (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
  val is_key_pressed : Sdlkey.t -> bool
  type mod_state = int
  val kmod_none : Sdlkey.mod_state
  val kmod_lshift : Sdlkey.mod_state
  val kmod_rshift : Sdlkey.mod_state
  val kmod_lctrl : Sdlkey.mod_state
  val kmod_rctrl : Sdlkey.mod_state
  val kmod_lalt : Sdlkey.mod_state
  val kmod_ralt : Sdlkey.mod_state
  val kmod_lmeta : Sdlkey.mod_state
  val kmod_rmeta : Sdlkey.mod_state
  val kmod_num : Sdlkey.mod_state
  val kmod_caps : Sdlkey.mod_state
  val kmod_mode : Sdlkey.mod_state
  val kmod_ctrl : Sdlkey.mod_state
  val kmod_shift : Sdlkey.mod_state
  val kmod_alt : Sdlkey.mod_state
  val kmod_meta : Sdlkey.mod_state
  val get_mod_state : unit -> Sdlkey.mod_state
  val set_mod_state : Sdlkey.mod_state -> unit
  val link_me : unit
end
ocamlsdl-0.9.1/doc/html/Sdltimer.html0000664000076400007640000000437611774643040016237 0ustar olivoliv OCamlSDL 0.9.1 : Sdltimer

Module Sdltimer


module Sdltimer: sig .. end
Time-related functions

val delay : int -> unit
Wait a specified number of milliseconds before returning
val get_ticks : unit -> int
Get the number of milliseconds since the SDL library initialization.
ocamlsdl-0.9.1/doc/html/index_types.html0000664000076400007640000002463511774643042017011 0ustar olivoliv OCamlSDL 0.9.1 : Index of types

Index of types


A
active_event [Sdlevent]
Application visibility event record
active_state [Sdlevent]
The available application states

B
button [Sdlmouse]

C
cdrom_drive [Sdlcdrom]
abstract type for handling cdrom
cdrom_drive_status [Sdlcdrom]
enumeration of different status cdrom drive
cdrom_info [Sdlcdrom]
channel [Sdlmixer]
channels [Sdlmixer]
chunk [Sdlmixer]
color [Sdlvideo]
Format independent color description (r,g,b) are 8 bits unsigned integers
cursor [Sdlmouse]
abstract type for cursors
cursor_data [Sdlmouse]

E
event [Sdlevent]
The main event type
event_kind [Sdlevent]
event_mask [Sdlevent]

F
fade_status [Sdlmixer]
The different fading types supported
font [Sdlttf]
abstract font datatype
font_style [Sdlttf]
format [Sdlmixer]
Audio format flags

G
group [Sdlmixer]

H
hat_value [Sdljoystick]

I
idle_event_func [Sdlevent.Old]

J
joyaxis_event [Sdlevent]
Joystick axis motion event record
joyball_event [Sdlevent]
Joystick axis motion event record
joybutton_event [Sdlevent]
Joystick button event record
joyhat_event [Sdlevent]
Joystick hat position change event record

K
keyboard_event [Sdlevent]
Keyboard event record
keyboard_event_func [Sdlevent.Old]
Keyboard event called with the activated key, its state and the coordinates of the mouse pointer

M
mod_state [Sdlkey]
modes [Sdlvideo]
mouse_event_func [Sdlevent.Old]
Mouse button event called with the activated button, its state and the coordinates of the mouse pointer
mousebutton_event [Sdlevent]
Mouse button event record
mousemotion_event [Sdlevent]
Mouse motion event record
mousemotion_event_func [Sdlevent.Old]
Mouse motion event called with the coordinates of the mouse pointer
music [Sdlmixer]
music_kind [Sdlmixer]
The different music types supported

P
palette_flag [Sdlvideo]
pixel_format_info [Sdlvideo]
Structure describing how color are encoded as pixels

R
rect [Sdlvideo]
rectangular area (x, y, w, h)
render_kind [Sdlttf]
Variant type for the generic rendering functions
resize_event_func [Sdlevent.Old]

S
specs [Sdlmixer]
subsystem [Sdl]
Initialization flag type
surface [Sdlvideo]
Graphical surface datatype
surface_flags [Sdlvideo]
surface_info [Sdlvideo]
switch_state [Sdlevent]

T
t [Sdlkey]
Concrete type describing keyboard keys ("keysym")
t [Sdljoystick]
The joystick abstract type used to identify an SDL joystick
track [Sdlcdrom]
track_type [Sdlcdrom]
the types of CD-ROM track possible

V
version [Sdl]
video_flag [Sdlvideo]
video_info [Sdlvideo]
Information on either the 'best' available mode (if called before set_video_mode) or the current video mode.

ocamlsdl-0.9.1/doc/html/index_modules.html0000664000076400007640000000615511774643042017312 0ustar olivoliv OCamlSDL 0.9.1 : Index of modules

Index of modules


O
Old [Sdlevent]
Callback-based event handling.

S
Sdl
This module contains functions for initializing/quitting the library
Sdlcdrom
This module provides CD-ROM handling
Sdlevent
SDL event handling
Sdlgfx
Sdljoystick
Module for SDL joystick event handling
Sdlkey
Keyboard handling and key symbols
Sdlloader
Image loader module
Sdlmixer
Simple multi-channel audio mixer
Sdlmouse
Mouse event handling and cursors
Sdltimer
Time-related functions
Sdlttf
This module provides TTF (TrueType Font) support
Sdlvideo
Module for video manipulations
Sdlwm
Window Manager interaction

ocamlsdl-0.9.1/doc/html/type_Sdl.html0000664000076400007640000001267011774643040016233 0ustar olivoliv OCamlSDL 0.9.1 : Sdl sig
  exception SDL_init_exception of string
  type subsystem = [ `AUDIO | `CDROM | `JOYSTICK | `TIMER | `VIDEO ]
  val init :
    ?auto_clean:bool ->
    [< `AUDIO
     | `CDROM
     | `EVENTTHREAD
     | `EVERYTHING
     | `JOYSTICK
     | `NOPARACHUTE
     | `TIMER
     | `VIDEO ]
    list -> unit
  val init_subsystem : Sdl.subsystem list -> unit
  val was_init : unit -> Sdl.subsystem list
  val quit : unit -> unit
  val quit_subsystem : Sdl.subsystem list -> unit
  type version = { major : int; minor : int; patch : int; }
  val version : unit -> Sdl.version
  val string_of_version : Sdl.version -> string
  val getenv : string -> string
  val putenv : string -> string -> unit
  type rwops_in
  val rwops_from_mem : string -> Sdl.rwops_in
  val rwops_in_close : Sdl.rwops_in -> unit
end
ocamlsdl-0.9.1/xpm_to_ml0000775000076400007640000000051610101532740013754 0ustar olivoliv#! /bin/awk -f # This small program reads an XPM file and converts it in a .ml file # that can be used with Sdlloader.read_XPM_from_array /^static/ { match ($0, /(\w+)\[\]/, arr); print "let " arr[1] " = [|" } / *};/ { FINISH=1 } /^ *\"/ { sub (/(,|\};) *$/, " ;"); print " " $0 } FINISH { print "|]" ; FINISH=0 }