xmakemol-5.16/0000777000175000017500000000000010665601065010274 500000000000000xmakemol-5.16/examples/0000755000175000017500000000000010665601065012106 500000000000000xmakemol-5.16/examples/water.xyz0000644000175000017500000000033307726420434013726 000000000000003 O 0.00000000 0.00000000 0.00000000 atom_vector 1 0 0 atom_vector 0 1 0 atom_vector 0 0 1 H 0.76923955 0.00000000 -0.59357141 H -0.76923955 0.00000000 -0.59357141 xmakemol-5.16/examples/C60.xyz0000644000175000017500000000457107751224311013136 0000000000000060 Buckminster Fullerene C 1.22650000 0.00000000 3.31450000 C 0.37900000 1.16640000 3.31450000 C -0.99220000 0.72090000 3.31450000 C -0.99220000 -0.72090000 3.31450000 C 0.37900000 -1.16640000 3.31450000 C 3.40840000 0.72090000 0.59480000 C 2.79510000 1.16640000 1.82130000 C 2.41610000 0.00000000 2.57930000 C 2.79510000 -1.16640000 1.82130000 C 3.40840000 -0.72090000 0.59480000 C 0.36760000 3.46430000 0.59480000 C -0.24560000 3.01880000 1.82130000 C 0.74660000 2.29790000 2.57930000 C 1.97310000 2.29790000 1.82130000 C 1.73890000 3.01880000 0.59480000 C -3.18120000 1.42020000 0.59480000 C -2.94690000 0.69930000 1.82130000 C -1.95470000 1.42020000 2.57930000 C -1.57570000 2.58660000 1.82130000 C -2.33370000 2.58660000 0.59480000 C -2.33370000 -2.58660000 0.59480000 C -1.57570000 -2.58660000 1.82130000 C -1.95470000 -1.42020000 2.57930000 C -2.94690000 -0.69930000 1.82130000 C -3.18120000 -1.42020000 0.59480000 C 1.73890000 -3.01880000 0.59480000 C 1.97310000 -2.29790000 1.82130000 C 0.74660000 -2.29790000 2.57930000 C -0.24560000 -3.01880000 1.82130000 C 0.36760000 -3.46430000 0.59480000 C 0.99220000 0.72090000 -3.31450000 C -0.37900000 1.16640000 -3.31450000 C -1.22650000 0.00000000 -3.31450000 C -0.37900000 -1.16640000 -3.31450000 C 0.99220000 -0.72090000 -3.31450000 C 2.33370000 2.58660000 -0.59480000 C 1.57570000 2.58660000 -1.82130000 C 1.95470000 1.42020000 -2.57930000 C 2.94690000 0.69930000 -1.82130000 C 3.18120000 1.42020000 -0.59480000 C -1.73890000 3.01880000 -0.59480000 C -1.97310000 2.29790000 -1.82130000 C -0.74660000 2.29790000 -2.57930000 C 0.24560000 3.01880000 -1.82130000 C -0.36760000 3.46430000 -0.59480000 C -3.40840000 -0.72090000 -0.59480000 C -2.79510000 -1.16640000 -1.82130000 C -2.41610000 0.00000000 -2.57930000 C -2.79510000 1.16640000 -1.82130000 C -3.40840000 0.72090000 -0.59480000 C -0.36760000 -3.46430000 -0.59480000 C 0.24560000 -3.01880000 -1.82130000 C -0.74660000 -2.29790000 -2.57930000 C -1.97310000 -2.29790000 -1.82130000 C -1.73890000 -3.01880000 -0.59480000 C 3.18120000 -1.42020000 -0.59480000 C 2.94690000 -0.69930000 -1.82130000 C 1.95470000 -1.42020000 -2.57930000 C 1.57570000 -2.58660000 -1.82130000 C 2.33370000 -2.58660000 -0.59480000 xmakemol-5.16/examples/caffeine.xyz0000644000175000017500000000304607752501443014347 00000000000000 24 Caffeine C 0.8423320060 -0.3654865620 0.0000000000 C -0.2841017540 -1.1961236000 0.0000000000 N 2.0294818880 -1.1042264700 0.0000000000 N 0.0774743850 -2.5357317920 0.0000000000 N -1.6472646000 -0.6177952290 0.0000000000 C 1.4531962870 -2.3678913120 0.0000000000 C 0.6373131870 1.1735112670 0.0000000000 C -1.7812691930 0.7688916330 0.0000000000 N -0.6771444680 1.6306355000 0.0000000000 O 1.6106752160 1.9349693060 0.0000000000 O -2.9202890400 1.2510058880 0.0000000000 C -0.9202462430 3.1094501020 0.0000000000 C -2.8623938560 -1.4824503660 0.0000000000 C 3.4552156930 -0.6811094280 0.0000000000 H 2.0878150460 -3.2451913360 0.0000000000 H -1.4989252090 3.4222116470 -0.8897886280 H -1.4989252090 3.4222116470 0.8897886280 H 0.0071905670 3.7148499490 0.0000000000 H -3.4903070930 -1.2888938190 -0.8907763360 H -3.4903070930 -1.2888938190 0.8907763360 H -2.6289534570 -2.5638654230 0.0000000000 H 4.1360211370 -1.5529079440 0.0000000000 H 3.6817059520 -0.0685850980 0.8931597470 H 3.6817059520 -0.0685850980 -0.8931597470 xmakemol-5.16/README0000644000175000017500000000102707733065077011101 00000000000000This directory contains a version 5 release of XMakemol. Report bugs/bug-fixes/suggestions to xmakemol-bugs@nongnu.org. For installation instructions, see the file INSTALL. If output of XMakemol is used in publications and you wish to cite it, use something like:- M. P. Hodges, XMakemol:a program for visualizing atomic and molecular systems, version 5 (2001). Optionally, the URL of the XMakemol homepage can be included:- http://www.nongnu.org/xmakemol/ XMakemol is free software. See the file COPYING for copying conditions. xmakemol-5.16/stamp-h.in0000644000175000017500000000001210665601065012102 00000000000000timestamp xmakemol-5.16/AUTHORS0000644000175000017500000000030610505171522011250 00000000000000Written by: Matt Hodges with contributions from: Adam Oline OpenGL, miscellaneous fixes Toni Ronkko Autoconf, miscellaneous fixes Chi Zhang Autoconf xmakemol-5.16/COPYING0000644000175000017500000004311007731607535011252 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xmakemol-5.16/INSTALL0000644000175000017500000003076207366267765011274 00000000000000 -*- text -*- Time-stamp: XMakemol has successfully been compiled on DEC (Compaq), FreeBSD, GNU/Linux, HP/UX, SGI and SUN platforms. If you are using something different then there may be problems with include files and libraries. If you port XMakemol to another platform you might like to inform me of the changes that you have made so that they can be incorporated into the distribution. Basic Installation ================== These are generic installation instructions. Instructions specific to XMakemol can be found at the end of this document. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. Motif ===== XMakemol uses the Motif widget set. If the Motif libraries are not available from your vendor, then the GNU freeware ones (LessTif) work well. The file lesstif.README at your local GNU mirror site should contain up-to-date information. The canonical GNU site is: ftp://ftp.gnu.org/pub/gnu. If the configure script is not able to locate your Motif libraries automatically, try supplying switches `--with-motif-includes=DIR' and `--with-motif-libraries=DIR'. Picture File Formats ==================== XMakemol can generate picture files of the molecules shown on the screen. There are two picture file formats available; the pictures can be saved as either Encapsulated PostScript (EPS) or as X Pixel Map Image File format (XPM). Use of XPM file format is essential in generating animated gifs. The support for the XPM file format is provided via the libXpm library. You can get libXpm from ftp://ftp.x.org/contrib/libraries. When configuring XMakemol, the configure script tries to locate the libXpm library for you. If that fails and you still want to include support for the XPM file format then try supplying switches `--with-xpm-includes=DIR' and ``--with-xpm-libraries=DIR'. OpenGL and Stereo Graphics ========================== Depending on platform, XMakemol can be made to work with either OpenGL or Mesa graphics libraries. Both libraries provide XMakemol with enhanced three-dimensional graphics with lights and true three-dimensional graphics primitives. Use of the libraries is however optional and XMakemol is fully functional without either of the libraries. XMakemol displays three-dimensional graphics using a Motif widget which must be installed in order to use the OpenGL or Mesa libraries. The configure script tries to locate the widget for you automatically. If you have installed the widget to a non-standard directory, you should invoke the configure script with the `--with-glw=DIR' option. The directory specified with the switch should refer to widget's root directory from where both the include files and libraries are found. XMakemol supports both red/blue and SGI TOP stereo modes. Both stereo modes work with OpenGL or Mesa graphics only. Furthermore, the SGI stereo mode is only available on Silicon Graphics workstations such as O2 and it requires some extra hardware. The red/blue stereo mode is available at all times whereas the SGI stereo mode (TOP) has to be enabled separately. To enable the SGI stereo mode, issue `export CFLAGS=-DSGI_STEREO' for Bourne style shells or `setenv CFLAGS -DSGI_STEREO' for C-Shells before invoking the configure script. Compiling XMakemol on SGI ========================= Apparently there is a bug in automake 1.5 which makes XMakemol re-compile itself each time SGI make is invoked. If possible, use GNU make for compiling XMakemol on SGI so that the software is not compiled many times over. Alternatively, invoke `make install' right after the configure script so that XMakemol is both compiled and installed once and for all. Installing and Compiling XMakemol by Editing Makefiles ====================================================== XMakemol tries to adapt itself to your operating system and to your hardware automatically. This is rather new in XMakemol and it is not guaranteed to work on all environments. In case the automatic configuration process fails, here are some instructions for compiling XMakemol by editing Makefiles: (1) Copy Makefile.orig to Makefile. (2) Edit the Makefile, specifically looking for 'Configure'. These are at points where changes are likely to be needed. The location of the external file 'elements' must be specified; if gif support is required, then various binaries must be available and their locations specified, too. The compiler options come next, so uncomment according to platform. It is recommended that you compile XMakemol with GCC, if available. (3) See if anything needs defining or undefining in config.h, according to whether or not certain functions are available. (4) Type make, which if there are no problems will create a binary called xmakemol. (5) Set the XM_ELEMENTS environment variable to point to the elements file (or the directory containing it) if you do not want to use the default file. If the default file is not found, then the program also checks the current working directory before giving up. xmakemol-5.16/Makefile.am0000644000175000017500000000422410664010461012237 00000000000000# Copyright (C) 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges # This file is part of XMakemol. # XMakemol is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # XMakemol is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with XMakemol; see the file COPYING. If not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA DATA_DIR=${prefix}/share/xmakemol ELEM_FILE=$(DATA_DIR)/elements CFLAGS = @CFLAGS@ -DELEMENTS=\"${ELEM_FILE}\" # List of non-source files that are included in the distribution package # created by the `make dist'. Note that there is no more `VERSION' file # as the `configure.in' already contains the current version number. EXTRA_DIST = \ elements \ PROBLEMS \ Makefile.orig \ ToDo.txt \ xmake_anim.pl \ xmakemol.1 \ xmake_anim.pl.1 \ xmakemol.html \ xmakemol.txt \ examples/water.xyz \ examples/C60.xyz \ examples/caffeine.xyz # Executables installed to `bin' directory. bin_PROGRAMS = xmakemol bin_SCRIPTS = xmake_anim.pl # Sources making up the `xmakemol' executable. EXTRA_xmakemol_SOURCES = \ bbox.h \ config.h \ draw.h \ globals.h \ view.h \ bonds.h \ defs.h \ gl_funcs.h \ vectors.h \ xm_logo.h \ gl2ps.h xmakemol_SOURCES = \ animate.c \ basename.c \ bbox.c \ canvas.c \ control.c \ crystal.c \ draw.c \ edit.c \ fig.c \ file.c \ frames.c \ gl_funcs.c \ help.c \ menus.c \ region.c \ rotate.c \ sort.c \ store.c \ track.c \ translate.c \ utils.c \ vectors.c \ view.c \ xmakemol.c \ gl2ps.c xmakemol_LDADD= @GL_LIBS@ @XM_LIBS@ @XT_LIBS@ @XPM_LIBS@ @XEXT_LIBS@ @XI_LIBS@ @X11_LIBS@ # List of files installed to data directory. elemdir = $(DATA_DIR) elem_DATA = elements # List of manual pages installed. man_MANS = xmakemol.1 xmakemol-5.16/Makefile.in0000644000175000017500000004115510665601065012263 00000000000000# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Copyright (C) 2001, 2002, 2003, 2004 Matthew P. Hodges # This file is part of XMakemol. # XMakemol is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # XMakemol is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with XMakemol; see the file COPYING. If not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ CC = @CC@ GL_LIBS = @GL_LIBS@ HAVE_LIB = @HAVE_LIB@ LIB = @LIB@ LTLIB = @LTLIB@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ X11_LIBS = @X11_LIBS@ XEXT_LIBS = @XEXT_LIBS@ XI_LIBS = @XI_LIBS@ XM_LIBS = @XM_LIBS@ XPM_LIBS = @XPM_LIBS@ XT_LIBS = @XT_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ DATA_DIR = ${prefix}/share/xmakemol ELEM_FILE = $(DATA_DIR)/elements CFLAGS = @CFLAGS@ -DELEMENTS=\"${ELEM_FILE}\" # List of non-source files that are included in the distribution package # created by the `make dist'. Note that there is no more `VERSION' file # as the `configure.in' already contains the current version number. EXTRA_DIST = elements PROBLEMS Makefile.orig ToDo.txt xmake_anim.pl xmakemol.1 xmake_anim.pl.1 xmakemol.html xmakemol.txt examples/water.xyz examples/C60.xyz examples/caffeine.xyz # Executables installed to `bin' directory. bin_PROGRAMS = xmakemol bin_SCRIPTS = xmake_anim.pl # Sources making up the `xmakemol' executable. EXTRA_xmakemol_SOURCES = bbox.h config.h draw.h globals.h view.h bonds.h defs.h gl_funcs.h vectors.h xm_logo.h gl2ps.h xmakemol_SOURCES = animate.c basename.c bbox.c canvas.c control.c crystal.c draw.c edit.c fig.c file.c frames.c gl_funcs.c help.c menus.c region.c rotate.c sort.c store.c track.c translate.c utils.c vectors.c view.c xmakemol.c gl2ps.c xmakemol_LDADD = @GL_LIBS@ @XM_LIBS@ @XT_LIBS@ @XPM_LIBS@ @XEXT_LIBS@ @XI_LIBS@ @X11_LIBS@ # List of files installed to data directory. elemdir = $(DATA_DIR) elem_DATA = elements # List of manual pages installed. man_MANS = xmakemol.1 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ xmakemol_OBJECTS = animate.o basename.o bbox.o canvas.o control.o \ crystal.o draw.o edit.o fig.o file.o frames.o gl_funcs.o help.o menus.o \ region.o rotate.o sort.o store.o track.o translate.o utils.o vectors.o \ view.o xmakemol.o gl2ps.o xmakemol_DEPENDENCIES = xmakemol_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff DATA = $(elem_DATA) DIST_COMMON = README ./stamp-h.in AUTHORS COPYING INSTALL Makefile.am \ Makefile.in NEWS acconfig.h acinclude.m4 aclocal.m4 config.guess \ config.h.in config.sub configure configure.in install-sh missing \ mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best DEP_FILES = .deps/animate.P .deps/basename.P .deps/bbox.P \ .deps/canvas.P .deps/control.P .deps/crystal.P .deps/draw.P \ .deps/edit.P .deps/fig.P .deps/file.P .deps/frames.P .deps/gl2ps.P \ .deps/gl_funcs.P .deps/help.P .deps/menus.P .deps/region.P \ .deps/rotate.P .deps/sort.P .deps/store.P .deps/track.P \ .deps/translate.P .deps/utils.P .deps/vectors.P .deps/view.P \ .deps/xmakemol.P SOURCES = $(xmakemol_SOURCES) $(EXTRA_xmakemol_SOURCES) OBJECTS = $(xmakemol_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) config.h: stamp-h @if test ! -f $@; then \ rm -f stamp-h; \ $(MAKE) stamp-h; \ else :; fi stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h 2> /dev/null $(srcdir)/config.h.in: $(srcdir)/stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \ else :; fi $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f config.h maintainer-clean-hdr: mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: xmakemol: $(xmakemol_OBJECTS) $(xmakemol_DEPENDENCIES) @rm -f xmakemol $(LINK) $(xmakemol_LDFLAGS) $(xmakemol_OBJECTS) $(xmakemol_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else :; fi; fi; \ done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) list='$(bin_SCRIPTS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ done install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 install-elemDATA: $(elem_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(elemdir) @list='$(elem_DATA)'; for p in $$list; do \ if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(elemdir)/$$p"; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(elemdir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(elemdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(elemdir)/$$p; \ fi; fi; \ done uninstall-elemDATA: @$(NORMAL_UNINSTALL) list='$(elem_DATA)'; for p in $$list; do \ rm -f $(DESTDIR)$(elemdir)/$$p; \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP)) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(distdir) && pwd`; \ distdir=`cd $(distdir) && pwd`; \ cd $(top_srcdir) \ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile $(mkinstalldirs) $(distdir)/examples @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) -include $(DEP_FILES) mostlyclean-depend: clean-depend: distclean-depend: -rm -rf .deps maintainer-clean-depend: %.o: %.c @echo '$(COMPILE) -c $<'; \ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< @-cp .deps/$(*F).pp .deps/$(*F).P; \ tr ' ' '\012' < .deps/$(*F).pp \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ >> .deps/$(*F).P; \ rm .deps/$(*F).pp %.lo: %.c @echo '$(LTCOMPILE) -c $<'; \ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ < .deps/$(*F).pp > .deps/$(*F).P; \ tr ' ' '\012' < .deps/$(*F).pp \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ >> .deps/$(*F).P; \ rm -f .deps/$(*F).pp info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive install-exec-am: install-binPROGRAMS install-binSCRIPTS install-exec: install-exec-am install-data-am: install-man install-elemDATA install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-man \ uninstall-elemDATA uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) config.h all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(elemdir) mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ mostlyclean-compile mostlyclean-tags mostlyclean-depend \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ clean-depend clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ distclean-tags distclean-depend distclean-generic \ clean-am distclean: distclean-am -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-depend maintainer-clean-generic \ distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am -rm -f config.status .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS \ install-man1 uninstall-man1 install-man uninstall-man \ uninstall-elemDATA install-elemDATA tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir \ mostlyclean-depend distclean-depend clean-depend \ maintainer-clean-depend info-am info dvi-am dvi check check-am \ installcheck-am installcheck all-recursive-am install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmakemol-5.16/NEWS0000644000175000017500000000335210664006442010707 00000000000000-*- outline -*- * New in XMakemol 5.16 ** GL2PS updated to version 1.3.2. ** Export SVG files. ** Fix build problem. * New in XMakemol 5.15 ** GL2PS updated to version 1.2.3. ** Try to place dialogs such that they don't obscure the main window. * New in XMakemol 5.14 ** Exporting XPM files. Fixed problem with absolute filenames (CVE Reference: CAN-2004-0914). ** Stereo pair rendering. In addition to the red/blue stereo rendering, eyes-crossed stereo pair rendering for OpenGL mode is now available. ** GL2PS updated to version 1.2.1. * New in XMakemol 5.13 ** Customizable bounding box. Bounding box parameters can now be specified in input files using the BBOX_XYZ keyword to give the minimum and maximum bounding box coordinates. ** Allow system to be split into molecules. The start of a new molecule is signified by the keyword MOLECULE on any atom's input line. Bond and H-bond factors are now split into independent intermolecular and intramolecular values. * New in XMakemol 5.12 ** Added dialog for scaling coordinates. * New in XMakemol 5.11 ** GL2PS updated to version 1.1.2. ** Increased maximum atom size; allows space-filling like rendering. * New in XMakemol 5.10 ** Render different groups of atoms with different rendering modes. ** GL2PS updated to version 1.0.0. Allows export of OpenGL scenes to EPS and PDF formats. ** Atom numbers and symbols rendered in OpenGL mode (using GLUT). * New in XMakemol 5.09 ** Updated documentation URL and bug report address. * New in XMakemol 5.08 ** Default rendering mode is now OpenGL without lighting. This is true when OpenGL support has been built in. non-OpenGL rendering can be selected from the command line using the -G option. ** Vectors and H-bonds are enabled by default. xmakemol-5.16/acconfig.h0000644000175000017500000001733007366022632012137 00000000000000#undef HAVE_MOTIF #undef XPM #undef VERSION #undef GL /* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE #undef _ALL_SOURCE #endif /* Define if using alloca.c. */ #undef C_ALLOCA /* Define if type char is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ #undef __CHAR_UNSIGNED__ #endif /* Define if the closedir function returns void instead of int. */ #undef CLOSEDIR_VOID /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define for DGUX with . */ #undef DGUX /* Define if you have . */ #undef DIRENT /* Define to the type of elements in the array set by `getgroups'. Usually this is either `int' or `gid_t'. */ #undef GETGROUPS_T /* Define if the `getloadavg' function needs to be run setuid or setgid. */ #undef GETLOADAVG_PRIVILEGED /* Define if the `getpgrp' function takes no argument. */ #undef GETPGRP_VOID /* Define to `int' if doesn't define. */ #undef gid_t /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if your system has a working fnmatch function. */ #undef HAVE_FNMATCH /* Define if your system has its own `getloadavg' function. */ #undef HAVE_GETLOADAVG /* Define if you have the getmntent function. */ #undef HAVE_GETMNTENT /* Define if the `long double' type works. */ #undef HAVE_LONG_DOUBLE /* Define if you support file names longer than 14 characters. */ #undef HAVE_LONG_FILE_NAMES /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if system calls automatically restart after interruption by a signal. */ #undef HAVE_RESTARTABLE_SYSCALLS /* Define if your struct stat has st_blksize. */ #undef HAVE_ST_BLKSIZE /* Define if your struct stat has st_blocks. */ #undef HAVE_ST_BLOCKS /* Define if you have the strcoll function and it is properly defined. */ #undef HAVE_STRCOLL /* Define if your struct stat has st_rdev. */ #undef HAVE_ST_RDEV /* Define if you have the strftime function. */ #undef HAVE_STRFTIME /* Define if you have the ANSI # stringizing operator in cpp. */ #undef HAVE_STRINGIZE /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if your struct tm has tm_zone. */ #undef HAVE_TM_ZONE /* Define if you don't have tm_zone but do have the external array tzname. */ #undef HAVE_TZNAME /* Define if you have . */ #undef HAVE_UNISTD_H /* Define if utime(file, NULL) sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL /* Define if you have . */ #undef HAVE_VFORK_H /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define if you have the wait3 system call. */ #undef HAVE_WAIT3 /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define if int is 16 bits instead of 32. */ #undef INT_16_BITS /* Define if long int is 64 bits. */ #undef LONG_64_BITS /* Define if major, minor, and makedev are declared in . */ #undef MAJOR_IN_MKDEV /* Define if major, minor, and makedev are declared in . */ #undef MAJOR_IN_SYSMACROS /* Define if on MINIX. */ #undef _MINIX /* Define to `int' if doesn't define. */ #undef mode_t /* Define if you don't have , but have . */ #undef NDIR /* Define if you have , and doesn't declare the mem* functions. */ #undef NEED_MEMORY_H /* Define if your struct nlist has an n_un member. */ #undef NLIST_NAME_UNION /* Define if you have . */ #undef NLIST_STRUCT /* Define if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define if your Fortran 77 compiler doesn't accept -c and -o together. */ #undef F77_NO_MINUS_C_MINUS_O /* Define to `long' if doesn't define. */ #undef off_t /* Define to `int' if doesn't define. */ #undef pid_t /* Define if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define to the type of arg1 for select(). */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for select(). */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg5 for select(). */ #undef SELECT_TYPE_ARG5 /* Define if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID /* Define if the setvbuf function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ #undef SETVBUF_REVERSED /* Define to `unsigned' if doesn't define. */ #undef size_t /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define on System V Release 4. */ #undef SVR4 /* Define if you don't have , but have . */ #undef SYSDIR /* Define if you don't have , but have . */ #undef SYSNDIR /* Define if `sys_siglist' is declared by . */ #undef SYS_SIGLIST_DECLARED /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define to `int' if doesn't define. */ #undef uid_t /* Define for Encore UMAX. */ #undef UMAX /* Define for Encore UMAX 4.3 that has instead of . */ #undef UMAX4_3 /* Define if you do not have , index, bzero, etc.. */ #undef USG /* Define vfork as fork if vfork does not work. */ #undef vfork /* Define if the closedir function returns void instead of int. */ #undef VOID_CLOSEDIR /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define if lex declares yytext as a char * by default, not a char[]. */ #undef YYTEXT_POINTER /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */ xmakemol-5.16/acinclude.m40000644000175000017500000006766107733304173012423 00000000000000dnl @(#)$Mu: mgv/acinclude.m4 1.5 1998/08/25 21:34:32 $ dnl dnl acinclude.m4 dnl local automake/autoconf/m4 fun for mgv. dnl dnl Copyright (C) 1998 Eric A. Howe dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl Authors: Eric A. Howe (mu@trends.net) dnl dnl dnl ICE_FIND_XPM dnl --------------- dnl dnl Find Xpm libraries and headers. dnl Put Xpm include directory in xpm_includes, dnl put Xpm library directory in xpm_libraries, dnl and add appropriate flags to X_CFLAGS and X_LIBS. dnl dnl Set @XPM_LIBS@ to -lXpm if appropriate. dnl dnl Borrowed from DDD. dnl AC_DEFUN(ICE_FIND_XPM, [ AC_REQUIRE([AC_PATH_XTRA]) xpm_includes= xpm_libraries= AC_ARG_WITH(xpm, [ --without-xpm do not use the Xpm library], with_xpm=no) dnl Treat --without-xpm like dnl --without-xpm-includes --without-xpm-libraries. if test "$with_xpm" = "no" then xpm_includes=no xpm_libraries=no fi AC_ARG_WITH(xpm-includes, [ --with-xpm-includes=DIR Xpm include files are in DIR], xpm_includes="$withval") AC_ARG_WITH(xpm-libraries, [ --with-xpm-libraries=DIR Xpm libraries are in DIR], xpm_libraries="$withval") AC_MSG_CHECKING(for Xpm) # # # Search the include files. Note that XPM can come in (as # in X11R6) or in if installed locally. # if test "$xpm_includes" = ""; then AC_CACHE_VAL(ice_cv_xpm_includes, [ ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # AC_TRY_COMPILE([ #include ],[int a;], [ # X11/xpm.h is in the standard search path. ice_cv_xpm_includes= ], [ # X11/xpm.h is not in the standard search path. # Locate it and put its directory in `xpm_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Xaw). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xaw). # Other directories are just guesses. ice_cv_xpm_includes=no for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/X11/xpm.h" || test -f "$dir/xpm.h"; then ice_cv_xpm_includes="$dir" echo "found xpm.h from $dir" 1>&5 break fi done ]) # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" ]) xpm_includes="$ice_cv_xpm_includes" fi # # # Now for the libraries. # if test "$xpm_libraries" = ""; then AC_CACHE_VAL(ice_cv_xpm_libraries, [ ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. AC_TRY_LINK([ #include #include ],[XtToolkitInitialize();], [ # libxpm.a is in the standard search path. ice_cv_xpm_libraries= ], [ # libXpm.a is not in the standard search path. # Locate it and put its directory in `xpm_libraries' # # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Xpm). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xpm). # Other directories are just guesses. ice_cv_xpm_libraries=no for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \ /usr/lib/Motif1.1 /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 \ /usr/lib/X11 /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXpm.* 2> /dev/null`" != ""; then ice_cv_xpm_libraries="$dir" echo "found libXpm from $dir" 1>&5 break fi done ]) # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" ]) # xpm_libraries="$ice_cv_xpm_libraries" fi # # Define XPM in config.h or disable XPM completely of either the header # or the library was not found. # if test "$xpm_libraries" != "no" && test "$xpm_includes" != "no"; then AC_DEFINE(XPM,1) else xpm_libraries=no xpm_includes=no fi # # Add Xpm definitions to X flags # if test "$xpm_includes" != "" && test "$xpm_includes" != "$x_includes" && test "$xpm_includes" != "no" then X_CFLAGS="-I$xpm_includes $X_CFLAGS" fi if test "$xpm_libraries" != "" && test "$xpm_libraries" != "$x_libraries" && test "$xpm_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$xpm_libraries -R $xpm_libraries $X_LIBS";; *-R*) X_LIBS="-L$xpm_libraries -R$xpm_libraries $X_LIBS";; *) X_LIBS="-L$xpm_libraries $X_LIBS";; esac fi # # xpm_libraries_result="$xpm_libraries" xpm_includes_result="$xpm_includes" test "$xpm_libraries_result" = "" && xpm_libraries_result="in default path" test "$xpm_includes_result" = "" && xpm_includes_result="in default path" test "$xpm_libraries_result" = "no" && xpm_libraries_result="(none)" test "$xpm_includes_result" = "no" && xpm_includes_result="(none)" AC_MSG_RESULT( [libraries $xpm_libraries_result, headers $xpm_includes_result]) # # Export @XPM_LIBS@ to Makefile.am # if test "$xpm_libraries" != "no"; then XPM_LIBS="-lXpm" else XPM_LIBS="" fi AC_SUBST(XPM_LIBS) ])dnl dnl dnl ICE_FIND_MOTIF dnl -------------- dnl dnl Find Motif libraries and headers dnl Put Motif include directory in motif_includes, dnl put Motif library directory in motif_libraries, dnl and add appropriate flags to X_CFLAGS and X_LIBS. dnl dnl Borrowed from DDD. dnl AC_DEFUN(ICE_FIND_MOTIF, [ AC_REQUIRE([AC_PATH_XTRA]) motif_includes= motif_libraries= AC_ARG_WITH(motif-includes, [ --with-motif-includes=DIR Motif include files are in DIR], motif_includes="$withval") AC_ARG_WITH(motif-libraries, [ --with-motif-libraries=DIR Motif libraries are in DIR], motif_libraries="$withval") AC_MSG_CHECKING(for Motif) # # # Search the include files. # if test "$motif_includes" = ""; then AC_CACHE_VAL(ice_cv_motif_includes, [ ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # AC_TRY_COMPILE([#include ],[int a;], [ # Xm/Xm.h is in the standard search path. ice_cv_motif_includes= ], [ # Xm/Xm.h is not in the standard search path. # Locate it and put its directory in `motif_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/Xm/Xm.h"; then ice_cv_motif_includes="$dir" break fi done if test "$ice_cv_motif_includes" = ""; then ice_cv_motif_includes=no fi ]) # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" ]) motif_includes="$ice_cv_motif_includes" fi # # # Now for the libraries. # if test "$motif_libraries" = ""; then AC_CACHE_VAL(ice_cv_motif_libraries, [ ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. AC_TRY_LINK([ #include #include ],[XtToolkitInitialize();], [ # libXm.a is in the standard search path. ice_cv_motif_libraries= ], [ # libXm.a is not in the standard search path. # Locate it and put its directory in `motif_libraries' # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/lesstif is used on Linux (Lesstif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ /usr/lesstif*/lib /usr/lib/Lesstif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then ice_cv_motif_libraries="$dir" break fi done if test "$ice_cv_motif_libraries" = ""; then ice_cv_motif_libraries=no fi ]) # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" ]) # motif_libraries="$ice_cv_motif_libraries" fi # Add Motif definitions to X flags # if test "$motif_includes" != "" && test "$motif_includes" != "$x_includes" && test "$motif_includes" != "no" then X_CFLAGS="-I$motif_includes $X_CFLAGS" fi if test "$motif_libraries" != "" && test "$motif_libraries" != "$x_libraries" && test "$motif_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$motif_libraries -R $motif_libraries $X_LIBS";; *-R*) X_LIBS="-L$motif_libraries -R$motif_libraries $X_LIBS";; *) X_LIBS="-L$motif_libraries $X_LIBS";; esac fi # # motif_libraries_result="$motif_libraries" motif_includes_result="$motif_includes" test "$motif_libraries_result" = "" && motif_libraries_result="in default path" test "$motif_includes_result" = "" && motif_includes_result="in default path" test "$motif_libraries_result" = "no" && motif_libraries_result="(none)" test "$motif_includes_result" = "no" && motif_includes_result="(none)" AC_MSG_RESULT( [libraries $motif_libraries_result, headers $motif_includes_result]) ])dnl ############################################################################ # Usage: # SIM_AC_CHECK_PTHREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find the PTHREAD development system. If it is found, these # shell variables are set: # # $sim_ac_pthread_cppflags (extra flags the compiler needs for pthread) # $sim_ac_pthread_ldflags (extra flags the linker needs for pthread) # $sim_ac_pthread_libs (link libraries the linker needs for pthread) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_pthread_avail is set to "yes" if the # pthread development system is found. # # # Author: Morten Eriksen, . AC_DEFUN([SIM_AC_CHECK_PTHREAD], [ AC_ARG_WITH( [pthread], [ --with-pthread pthread installation directory], [],[with_pthread=yes]) sim_ac_pthread_avail=no if test x"$with_pthread" != xno; then if test x"$with_pthread" != xyes; then sim_ac_pthread_cppflags="-I${with_pthread}/include" sim_ac_pthread_ldflags="-L${with_pthread}/lib" fi sim_ac_pthread_libs_first="-lpthread" sim_ac_pthread_libs_second="-pthread" sim_ac_pthread_libs_third="-lc_r" sim_ac_pthread_libs="" # FreeBSD 4.x use "-pthread" or "-lc_r" sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS AC_CACHE_CHECK( [whether the pthread development system is available], sim_cv_lib_pthread_avail, [ for sim_pthread_libs in $sim_ac_pthread_libs_first \ $sim_ac_pthread_libs_second $sim_ac_pthread_libs_third ; do if test x"$sim_cv_lib_pthread_avail" != x"yes" ; then CPPFLAGS="$CPPFLAGS $sim_ac_pthread_cppflags" LDFLAGS="$LDFLAGS $sim_ac_pthread_ldflags" LIBS="$sim_pthread_libs $LIBS" AC_TRY_LINK([#include ], [(void)pthread_create(0L, 0L, 0L, 0L);], [sim_cv_lib_pthread_avail=yes sim_ac_pthread_libs="$sim_pthread_libs" ], [sim_cv_lib_pthread_avail=no]) fi if test x"$sim_cv_lib_pthread_avail" != x"yes"; then CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs fi done ] ) if test x"$sim_cv_lib_pthread_avail" = xyes; then sim_ac_pthread_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) ############################################################################ # Usage: # SIM_AC_CHECK_OPENGL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find an OpenGL development system, either a native # implementation or the OpenGL-compatible Mesa library. If # it is found, these shell variables are set: # # $sim_ac_gl_cppflags (extra flags the compiler needs for OpenGL/Mesa) # $sim_ac_gl_ldflags (extra flags the linker needs for OpenGL/Mesa) # $sim_ac_gl_libs (link libraries the linker needs for OpenGL/Mesa) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_gl_avail is set to "yes" if an # OpenGL-compatible development system is found. # # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_CHECK_OPENGL, [ unset sim_ac_gl_cppflags unset sim_ac_gl_ldflags unset sim_ac_gl_libs sim_ac_gl_avail=no AC_ARG_WITH( [mesa], [ --with-mesa prefer MesaGL (if found) over OpenGL [[default=yes]]], [],[with_mesa=yes]) # It's usually libGL.so on UNIX systems and opengl32.lib on MSWindows. sim_ac_gl_glnames="-lGL -lopengl32" sim_ac_gl_mesaglnames=-lMesaGL GL_LIBS="" if test "x$with_mesa" = "xyes"; then sim_ac_gl_first=$sim_ac_gl_mesaglnames sim_ac_gl_second=$sim_ac_gl_glnames else sim_ac_gl_first=$sim_ac_gl_glnames sim_ac_gl_second=$sim_ac_gl_mesaglnames fi AC_ARG_WITH( [opengl], [ --with-opengl OpenGL/Mesa installation directory],[],[with_opengl=yes]) if test x"$with_opengl" != xno; then if test x"$with_opengl" != xyes; then sim_ac_gl_cppflags="-I${with_opengl}/include" sim_ac_gl_ldflags="-L${with_opengl}/lib" else # This is a common location for the OpenGL library on HPUX. sim_ac_gl_hpux=/opt/graphics/OpenGL if test -d $sim_ac_gl_hpux; then sim_ac_gl_cppflags=-I$sim_ac_gl_hpux/include sim_ac_gl_ldflags=-L$sim_ac_gl_hpux/lib fi fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_gl_cppflags" LDFLAGS="$LDFLAGS $sim_ac_gl_ldflags" AC_CACHE_CHECK( [whether OpenGL library is available], sim_cv_lib_gl, [sim_cv_lib_gl=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_save_libs -lm" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include ], [glPointSize(1.0f);], [sim_cv_lib_gl="$sim_ac_gl_libcheck"], ) fi done ]) LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_gl" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl" else AC_MSG_WARN([couldn't compile or link with OpenGL library -- trying with pthread library in place...]) SIM_AC_CHECK_PTHREAD([ sim_ac_gl_cppflags="$sim_ac_gl_cppflags $sim_ac_pthread_cppflags" sim_ac_gl_ldflags="$sim_ac_gl_ldflags $sim_ac_pthread_ldflags"], [AC_MSG_WARN([couldn't compile or link with pthread library])]) if test "x$sim_ac_pthread_avail" = "xyes"; then AC_CACHE_CHECK( [whether OpenGL library can be linked with pthread library], sim_cv_lib_gl_pthread, [sim_cv_lib_gl_pthread=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl_pthread" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_pthread_libs $sim_ac_save_libs" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include ], [ glPointSize(1.0f); ], [sim_cv_lib_gl_pthread="$sim_ac_gl_libcheck"]) fi done ]) if test "x$sim_cv_lib_gl_pthread" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl_pthread $sim_ac_pthread_libs" fi fi fi if test "x$sim_ac_gl_libs" != "x"; then LIBS="$sim_ac_save_libs" GL_LIBS="$sim_ac_gl_libs" sim_ac_gl_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) ############################################################################ # Usage: # SIM_AC_CHECK_GLU([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to use the OpenGL utility library; GLU. If it is found, # these shell variables are set: # # $sim_ac_glu_cppflags (extra flags the compiler needs for GLU) # $sim_ac_glu_ldflags (extra flags the linker needs for GLU) # $sim_ac_glu_libs (link libraries the linker needs for GLU) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_gly_avail is set to "yes" if GLU # is found. # # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_CHECK_GLU, [ unset sim_ac_glu_cppflags unset sim_ac_glu_ldflags unset sim_ac_glu_libs sim_ac_glu_avail=no # It's usually libGLU.so on UNIX systems and glu32.lib on MSWindows. sim_ac_glu_names="-lGLU -lglu32" sim_ac_glu_mesanames=-lMesaGLU # with_mesa is set from the SIM_AC_CHECK_OPENGL macro. if test "x$with_mesa" = "xyes"; then sim_ac_glu_first=$sim_ac_glu_mesanames sim_ac_glu_second=$sim_ac_glu_names else sim_ac_glu_first=$sim_ac_glu_names sim_ac_glu_second=$sim_ac_glu_mesanames fi AC_ARG_WITH( [glu],[ --with-glu use the OpenGL utility library [[default=yes]]],[],[with_glu=yes]) if test x"$with_glu" != xno; then if test x"$with_glu" != xyes; then sim_ac_glu_cppflags="-I${with_glu}/include" sim_ac_glu_ldflags="-L${with_glu}/lib" fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_glu_cppflags" LDFLAGS="$LDFLAGS $sim_ac_glu_ldflags" AC_CACHE_CHECK( [whether GLU is available], sim_cv_lib_glu, [sim_cv_lib_glu=UNRESOLVED # Some platforms (like BeOS) have the GLU functionality in the GL # library (and no GLU library present). for sim_ac_glu_libcheck in "" $sim_ac_glu_first $sim_ac_glu_second; do if test "x$sim_cv_lib_glu" = "xUNRESOLVED"; then LIBS="$sim_ac_glu_libcheck $sim_ac_save_libs $GL_LIBS" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [ gluSphere(0L, 1.0, 1, 1); ], [sim_cv_lib_glu="$sim_ac_glu_libcheck"]) fi done ]) LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_glu" != "xUNRESOLVED"; then sim_ac_glu_libs="$sim_cv_lib_glu" LIBS="$sim_ac_save_libs" GL_LIBS="$GL_LIBS $sim_ac_glu_libs" sim_ac_glu_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) # ************************************************************************** # SIM_AC_GLU_READY_IFELSE( [ACTION-IF-TRUE], [ACTION-IF-FALSE] ) AC_DEFUN([SIM_AC_GLU_READY_IFELSE], [AC_CACHE_CHECK( [if GLU is available as part of GL library], [sim_cv_glu_ready], [AC_TRY_LINK( [ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [ gluSphere(0L, 1.0, 1, 1); ], [sim_cv_glu_ready=true], [sim_cv_glu_ready=false])]) if ${sim_cv_glu_ready}; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) # SIM_AC_GLU_READY_IFELSE() ############################################################################ # Usage: # SIM_AC_GLU_NURBSOBJECT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find out whether the interface struct against the GLU # library NURBS functions is called "GLUnurbs" or "GLUnurbsObj". # (This seems to have changed somewhere between release 1.1 and # release 1.3 of GLU). # # The variable $sim_ac_glu_nurbsobject is set to the correct name # if the nurbs structure is found. # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_GLU_NURBSOBJECT, [ AC_CACHE_CHECK( [what structure to use in the GLU NURBS interface], sim_cv_func_glu_nurbsobject, [sim_cv_func_glu_nurbsobject=NONE for sim_ac_glu_structname in GLUnurbs GLUnurbsObj; do if test "$sim_cv_func_glu_nurbsobject" = NONE; then AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [$sim_ac_glu_structname * hepp = gluNewNurbsRenderer(); gluDeleteNurbsRenderer(hepp)], [sim_cv_func_glu_nurbsobject=$sim_ac_glu_structname]) fi done ]) if test $sim_cv_func_glu_nurbsobject = NONE; then sim_ac_glu_nurbsobject= $2 else sim_ac_glu_nurbsobject=$sim_cv_func_glu_nurbsobject $1 fi ]) # ************************************************************************** # SIM_AC_HAVE_GLX_IFELSE( IF-FOUND, IF-NOT-FOUND ) # # Check whether GLX is on the system. AC_DEFUN([SIM_AC_HAVE_GLX_IFELSE], [ AC_CACHE_CHECK( [whether GLX is on the system], sim_cv_have_glx, AC_TRY_LINK( [#include ], [(void)glXChooseVisual(0L, 0, 0L);], [sim_cv_have_glx=true], [sim_cv_have_glx=false])) if ${sim_cv_have_glx=false}; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) # SIM_AC_HAVE_GLX_IFELSE() ############################################################################ # Usage: # SIM_CHECK_MOTIF_GLWIDGET([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]) # # Description: # This macro checks for a GL widget that can be used with Xt/Motif. # # Variables: # $sim_cv_motif_glwidget (cached) class + header + library # $sim_cv_motif_glwidget_hdrloc (cached) GL | X11/GLw # # $sim_ac_motif_glwidget_class glwMDrawingAreaWidgetClass | # glwDrawingAreaWidgetClass # $sim_ac_motif_glwidget_header GLwDrawA.h | GLwMDrawA.h # $sim_ac_motif_glwidget_library GLwM | GLw | MesaGLwM | MesaGLw # # $LIBS = -l$sim_ac_motif_glwidget_library $LIBS # # Defines: # XT_GLWIDGET $sim_ac_motif_glwidget_class # HAVE_GL_GLWDRAWA_H #include # HAVE_GL_GLWMDRAWA_H #include # HAVE_X11_GWL_GLWDRAWA_H #include # HAVE_X11_GWL_GLWMDRAWA_H #include # # Authors: # Lars J. Aas , # Loring Holden , # Morten Eriksen # AC_DEFUN([SIM_CHECK_MOTIF_GLWIDGET], [ AC_ARG_WITH( [glw],[ --with-glw use the OpenGL widget Library [[default=yes]]], [], [with_glw=yes]) if test x"$with_glw" != x"no" ; then if test x"$with_glw" != x"yes" ; then sim_ac_glw_cppflags="-I${with_glw}/include" sim_ac_glw_ldflags="-L${with_glw}/lib" fi SAVECPPFLAGS="$CPPFLAGS" SAVELDFLAGS="$LDFLAGS" SAVELIBS="$LIBS" CPPFLAGS="$SAVECPPFLAGS $sim_ac_glw_cppflags" LDFLAGS="$SAVELDFLAGS $sim_ac_glw_ldflags" AC_CACHE_CHECK( [for a GL widget], sim_cv_motif_glwidget, [ XWIDGETLIBS="$X_LIBS $X11_LIBS $XT_LIBS $X_LIBS $X_PRE_LIBS $XM_LIBS" sim_cv_motif_glwidget=UNKNOWN for lib in GLwM GLw MesaGLwM MesaGLw; do if test x"$sim_cv_motif_glwidget" = x"UNKNOWN"; then LIBS="-l$lib $SAVELIBS $XWIDGETLIBS $GL_LIBS -lm" AC_TRY_LINK( [#include #include extern WidgetClass glwMDrawingAreaWidgetClass;], [Widget glxManager = NULL; Widget glxWidget = XtVaCreateManagedWidget("GLWidget", glwMDrawingAreaWidgetClass, glxManager, NULL);], [sim_cv_motif_glwidget="glwMDrawingAreaWidgetClass GLwMDrawA.h $lib"], [sim_cv_motif_glwidget=UNKNOWN]) fi done LIBS=$SAVELIBS ]) if test "x$sim_cv_motif_glwidget" = "xUNKNOWN"; then ifelse([$2], , :, [$2]) else sim_ac_motif_glwidget_class=`echo $sim_cv_motif_glwidget | cut -d" " -f1` sim_ac_motif_glwidget_header=`echo $sim_cv_motif_glwidget | cut -d" " -f2` sim_ac_motif_glwidget_library=`echo $sim_cv_motif_glwidget | cut -d" " -f3` AC_CACHE_CHECK( [the $sim_ac_motif_glwidget_header header location], sim_cv_motif_glwidget_hdrloc, [sim_cv_motif_glwidget_hdrloc=UNKNOWN for location in X11/GLw GL; do if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then AC_TRY_CPP( [#include #include <$location/$sim_ac_motif_glwidget_header>], [sim_cv_motif_glwidget_hdrloc=$location], [sim_cv_motif_glwidget_hdrloc=UNKNOWN]) fi done]) if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then ifelse([$2], , :, [$2]) else if test "x$sim_ac_motif_glwidget_header" = "xGLwDrawA.h"; then if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then AC_DEFINE(HAVE_GL_GLWDRAWA_H, 1, [Define this to use OpenGL widget from ]) else AC_DEFINE(HAVE_X11_GLW_GLWDRAWA_H, 1, [Define this to use OpenGL widget from ]) fi else if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then AC_DEFINE(HAVE_GL_GLWMDRAWA_H, 1, [Define this to use OpenGL widget from ]) else AC_DEFINE(HAVE_X11_GLW_GLWMDRAWA_H, 1, [Define this to use OpenGL widget from ]) fi fi AC_DEFINE_UNQUOTED(XT_GLWIDGET, $sim_ac_motif_glwidget_class, [Define this to the Xt/Motif OpenGL widget class to use]) LIBS="$LIBS" GL_LIBS="$GL_LIBS -l$sim_ac_motif_glwidget_library" $1 fi fi fi ]) dnl dnl XMAKEMOL_GLUT_CHECK([ ACTION-IF-FOUND ]) dnl dnl Checks if GLUT is found. If it is, $ac_cv_lib_glut is set to "yes". AC_DEFUN([XMAKEMOL_GLUT_CHECK], [ AC_ARG_WITH(glut-prefix, [ --with-glut-includes=DIR Prefix for GLUT],[ glut_prefix="$withval"]) dnl Check for GLUT includes if test ".$glut_prefix" != . ; then GLUT_INCLUDES="-I$glut_prefix/include" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$GLUT_INCLUDES $CPPFLAGS" AC_CHECK_HEADER(GL/glut.h,:,no_glut=yes) CPPFLAGS="$save_CPPFLAGS" if test ".$glut_prefix" != . ; then CON_LIBS="-L$glut_prefix/lib" fi if test ".$no_glut" != . ; then ac_cv_lib_glut=no GL_LIBS="" else AC_DEFINE(GL,1) ac_cv_lib_glut=yes LDFLAGS="$LDFLAGS $CON_LIBS" GL_LIBS="$GL_LIBS -lglut" fi ]) xmakemol-5.16/aclocal.m40000644000175000017500000021103310665601054012046 00000000000000dnl aclocal.m4t generated automatically by aclocal 1.4-p6 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl @(#)$Mu: mgv/acinclude.m4 1.5 1998/08/25 21:34:32 $ dnl dnl acinclude.m4 dnl local automake/autoconf/m4 fun for mgv. dnl dnl Copyright (C) 1998 Eric A. Howe dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl Authors: Eric A. Howe (mu@trends.net) dnl dnl dnl ICE_FIND_XPM dnl --------------- dnl dnl Find Xpm libraries and headers. dnl Put Xpm include directory in xpm_includes, dnl put Xpm library directory in xpm_libraries, dnl and add appropriate flags to X_CFLAGS and X_LIBS. dnl dnl Set @XPM_LIBS@ to -lXpm if appropriate. dnl dnl Borrowed from DDD. dnl AC_DEFUN(ICE_FIND_XPM, [ AC_REQUIRE([AC_PATH_XTRA]) xpm_includes= xpm_libraries= AC_ARG_WITH(xpm, [ --without-xpm do not use the Xpm library], with_xpm=no) dnl Treat --without-xpm like dnl --without-xpm-includes --without-xpm-libraries. if test "$with_xpm" = "no" then xpm_includes=no xpm_libraries=no fi AC_ARG_WITH(xpm-includes, [ --with-xpm-includes=DIR Xpm include files are in DIR], xpm_includes="$withval") AC_ARG_WITH(xpm-libraries, [ --with-xpm-libraries=DIR Xpm libraries are in DIR], xpm_libraries="$withval") AC_MSG_CHECKING(for Xpm) # # # Search the include files. Note that XPM can come in (as # in X11R6) or in if installed locally. # if test "$xpm_includes" = ""; then AC_CACHE_VAL(ice_cv_xpm_includes, [ ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # AC_TRY_COMPILE([ #include ],[int a;], [ # X11/xpm.h is in the standard search path. ice_cv_xpm_includes= ], [ # X11/xpm.h is not in the standard search path. # Locate it and put its directory in `xpm_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Xaw). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xaw). # Other directories are just guesses. ice_cv_xpm_includes=no for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/X11/xpm.h" || test -f "$dir/xpm.h"; then ice_cv_xpm_includes="$dir" echo "found xpm.h from $dir" 1>&5 break fi done ]) # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" ]) xpm_includes="$ice_cv_xpm_includes" fi # # # Now for the libraries. # if test "$xpm_libraries" = ""; then AC_CACHE_VAL(ice_cv_xpm_libraries, [ ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. AC_TRY_LINK([ #include #include ],[XtToolkitInitialize();], [ # libxpm.a is in the standard search path. ice_cv_xpm_libraries= ], [ # libXpm.a is not in the standard search path. # Locate it and put its directory in `xpm_libraries' # # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Xpm). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xpm). # Other directories are just guesses. ice_cv_xpm_libraries=no for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \ /usr/lib/Motif1.1 /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 \ /usr/lib/X11 /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXpm.* 2> /dev/null`" != ""; then ice_cv_xpm_libraries="$dir" echo "found libXpm from $dir" 1>&5 break fi done ]) # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" ]) # xpm_libraries="$ice_cv_xpm_libraries" fi # # Define XPM in config.h or disable XPM completely of either the header # or the library was not found. # if test "$xpm_libraries" != "no" && test "$xpm_includes" != "no"; then AC_DEFINE(XPM,1) else xpm_libraries=no xpm_includes=no fi # # Add Xpm definitions to X flags # if test "$xpm_includes" != "" && test "$xpm_includes" != "$x_includes" && test "$xpm_includes" != "no" then X_CFLAGS="-I$xpm_includes $X_CFLAGS" fi if test "$xpm_libraries" != "" && test "$xpm_libraries" != "$x_libraries" && test "$xpm_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$xpm_libraries -R $xpm_libraries $X_LIBS";; *-R*) X_LIBS="-L$xpm_libraries -R$xpm_libraries $X_LIBS";; *) X_LIBS="-L$xpm_libraries $X_LIBS";; esac fi # # xpm_libraries_result="$xpm_libraries" xpm_includes_result="$xpm_includes" test "$xpm_libraries_result" = "" && xpm_libraries_result="in default path" test "$xpm_includes_result" = "" && xpm_includes_result="in default path" test "$xpm_libraries_result" = "no" && xpm_libraries_result="(none)" test "$xpm_includes_result" = "no" && xpm_includes_result="(none)" AC_MSG_RESULT( [libraries $xpm_libraries_result, headers $xpm_includes_result]) # # Export @XPM_LIBS@ to Makefile.am # if test "$xpm_libraries" != "no"; then XPM_LIBS="-lXpm" else XPM_LIBS="" fi AC_SUBST(XPM_LIBS) ])dnl dnl dnl ICE_FIND_MOTIF dnl -------------- dnl dnl Find Motif libraries and headers dnl Put Motif include directory in motif_includes, dnl put Motif library directory in motif_libraries, dnl and add appropriate flags to X_CFLAGS and X_LIBS. dnl dnl Borrowed from DDD. dnl AC_DEFUN(ICE_FIND_MOTIF, [ AC_REQUIRE([AC_PATH_XTRA]) motif_includes= motif_libraries= AC_ARG_WITH(motif-includes, [ --with-motif-includes=DIR Motif include files are in DIR], motif_includes="$withval") AC_ARG_WITH(motif-libraries, [ --with-motif-libraries=DIR Motif libraries are in DIR], motif_libraries="$withval") AC_MSG_CHECKING(for Motif) # # # Search the include files. # if test "$motif_includes" = ""; then AC_CACHE_VAL(ice_cv_motif_includes, [ ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # AC_TRY_COMPILE([#include ],[int a;], [ # Xm/Xm.h is in the standard search path. ice_cv_motif_includes= ], [ # Xm/Xm.h is not in the standard search path. # Locate it and put its directory in `motif_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/Xm/Xm.h"; then ice_cv_motif_includes="$dir" break fi done if test "$ice_cv_motif_includes" = ""; then ice_cv_motif_includes=no fi ]) # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" ]) motif_includes="$ice_cv_motif_includes" fi # # # Now for the libraries. # if test "$motif_libraries" = ""; then AC_CACHE_VAL(ice_cv_motif_libraries, [ ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. AC_TRY_LINK([ #include #include ],[XtToolkitInitialize();], [ # libXm.a is in the standard search path. ice_cv_motif_libraries= ], [ # libXm.a is not in the standard search path. # Locate it and put its directory in `motif_libraries' # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/lesstif is used on Linux (Lesstif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ /usr/lesstif*/lib /usr/lib/Lesstif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then ice_cv_motif_libraries="$dir" break fi done if test "$ice_cv_motif_libraries" = ""; then ice_cv_motif_libraries=no fi ]) # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" ]) # motif_libraries="$ice_cv_motif_libraries" fi # Add Motif definitions to X flags # if test "$motif_includes" != "" && test "$motif_includes" != "$x_includes" && test "$motif_includes" != "no" then X_CFLAGS="-I$motif_includes $X_CFLAGS" fi if test "$motif_libraries" != "" && test "$motif_libraries" != "$x_libraries" && test "$motif_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$motif_libraries -R $motif_libraries $X_LIBS";; *-R*) X_LIBS="-L$motif_libraries -R$motif_libraries $X_LIBS";; *) X_LIBS="-L$motif_libraries $X_LIBS";; esac fi # # motif_libraries_result="$motif_libraries" motif_includes_result="$motif_includes" test "$motif_libraries_result" = "" && motif_libraries_result="in default path" test "$motif_includes_result" = "" && motif_includes_result="in default path" test "$motif_libraries_result" = "no" && motif_libraries_result="(none)" test "$motif_includes_result" = "no" && motif_includes_result="(none)" AC_MSG_RESULT( [libraries $motif_libraries_result, headers $motif_includes_result]) ])dnl # Usage: # SIM_AC_CHECK_PTHREAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find the PTHREAD development system. If it is found, these # shell variables are set: # # $sim_ac_pthread_cppflags (extra flags the compiler needs for pthread) # $sim_ac_pthread_ldflags (extra flags the linker needs for pthread) # $sim_ac_pthread_libs (link libraries the linker needs for pthread) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_pthread_avail is set to "yes" if the # pthread development system is found. # # # Author: Morten Eriksen, . AC_DEFUN([SIM_AC_CHECK_PTHREAD], [ AC_ARG_WITH( [pthread], [ --with-pthread pthread installation directory], [],[with_pthread=yes]) sim_ac_pthread_avail=no if test x"$with_pthread" != xno; then if test x"$with_pthread" != xyes; then sim_ac_pthread_cppflags="-I${with_pthread}/include" sim_ac_pthread_ldflags="-L${with_pthread}/lib" fi sim_ac_pthread_libs_first="-lpthread" sim_ac_pthread_libs_second="-pthread" sim_ac_pthread_libs_third="-lc_r" sim_ac_pthread_libs="" # FreeBSD 4.x use "-pthread" or "-lc_r" sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS AC_CACHE_CHECK( [whether the pthread development system is available], sim_cv_lib_pthread_avail, [ for sim_pthread_libs in $sim_ac_pthread_libs_first \ $sim_ac_pthread_libs_second $sim_ac_pthread_libs_third ; do if test x"$sim_cv_lib_pthread_avail" != x"yes" ; then CPPFLAGS="$CPPFLAGS $sim_ac_pthread_cppflags" LDFLAGS="$LDFLAGS $sim_ac_pthread_ldflags" LIBS="$sim_pthread_libs $LIBS" AC_TRY_LINK([#include ], [(void)pthread_create(0L, 0L, 0L, 0L);], [sim_cv_lib_pthread_avail=yes sim_ac_pthread_libs="$sim_pthread_libs" ], [sim_cv_lib_pthread_avail=no]) fi if test x"$sim_cv_lib_pthread_avail" != x"yes"; then CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs fi done ] ) if test x"$sim_cv_lib_pthread_avail" = xyes; then sim_ac_pthread_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) # Usage: # SIM_AC_CHECK_OPENGL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find an OpenGL development system, either a native # implementation or the OpenGL-compatible Mesa library. If # it is found, these shell variables are set: # # $sim_ac_gl_cppflags (extra flags the compiler needs for OpenGL/Mesa) # $sim_ac_gl_ldflags (extra flags the linker needs for OpenGL/Mesa) # $sim_ac_gl_libs (link libraries the linker needs for OpenGL/Mesa) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_gl_avail is set to "yes" if an # OpenGL-compatible development system is found. # # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_CHECK_OPENGL, [ unset sim_ac_gl_cppflags unset sim_ac_gl_ldflags unset sim_ac_gl_libs sim_ac_gl_avail=no AC_ARG_WITH( [mesa], [ --with-mesa prefer MesaGL (if found) over OpenGL [[default=yes]]], [],[with_mesa=yes]) # It's usually libGL.so on UNIX systems and opengl32.lib on MSWindows. sim_ac_gl_glnames="-lGL -lopengl32" sim_ac_gl_mesaglnames=-lMesaGL GL_LIBS="" if test "x$with_mesa" = "xyes"; then sim_ac_gl_first=$sim_ac_gl_mesaglnames sim_ac_gl_second=$sim_ac_gl_glnames else sim_ac_gl_first=$sim_ac_gl_glnames sim_ac_gl_second=$sim_ac_gl_mesaglnames fi AC_ARG_WITH( [opengl], [ --with-opengl OpenGL/Mesa installation directory],[],[with_opengl=yes]) if test x"$with_opengl" != xno; then if test x"$with_opengl" != xyes; then sim_ac_gl_cppflags="-I${with_opengl}/include" sim_ac_gl_ldflags="-L${with_opengl}/lib" else # This is a common location for the OpenGL library on HPUX. sim_ac_gl_hpux=/opt/graphics/OpenGL if test -d $sim_ac_gl_hpux; then sim_ac_gl_cppflags=-I$sim_ac_gl_hpux/include sim_ac_gl_ldflags=-L$sim_ac_gl_hpux/lib fi fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_gl_cppflags" LDFLAGS="$LDFLAGS $sim_ac_gl_ldflags" AC_CACHE_CHECK( [whether OpenGL library is available], sim_cv_lib_gl, [sim_cv_lib_gl=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_save_libs -lm" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include ], [glPointSize(1.0f);], [sim_cv_lib_gl="$sim_ac_gl_libcheck"], ) fi done ]) LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_gl" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl" else AC_MSG_WARN([couldn't compile or link with OpenGL library -- trying with pthread library in place...]) SIM_AC_CHECK_PTHREAD([ sim_ac_gl_cppflags="$sim_ac_gl_cppflags $sim_ac_pthread_cppflags" sim_ac_gl_ldflags="$sim_ac_gl_ldflags $sim_ac_pthread_ldflags"], [AC_MSG_WARN([couldn't compile or link with pthread library])]) if test "x$sim_ac_pthread_avail" = "xyes"; then AC_CACHE_CHECK( [whether OpenGL library can be linked with pthread library], sim_cv_lib_gl_pthread, [sim_cv_lib_gl_pthread=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl_pthread" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_pthread_libs $sim_ac_save_libs" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include ], [ glPointSize(1.0f); ], [sim_cv_lib_gl_pthread="$sim_ac_gl_libcheck"]) fi done ]) if test "x$sim_cv_lib_gl_pthread" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl_pthread $sim_ac_pthread_libs" fi fi fi if test "x$sim_ac_gl_libs" != "x"; then LIBS="$sim_ac_save_libs" GL_LIBS="$sim_ac_gl_libs" sim_ac_gl_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) # Usage: # SIM_AC_CHECK_GLU([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to use the OpenGL utility library; GLU. If it is found, # these shell variables are set: # # $sim_ac_glu_cppflags (extra flags the compiler needs for GLU) # $sim_ac_glu_ldflags (extra flags the linker needs for GLU) # $sim_ac_glu_libs (link libraries the linker needs for GLU) # # The CPPFLAGS, LDFLAGS and LIBS flags will also be modified accordingly. # In addition, the variable $sim_ac_gly_avail is set to "yes" if GLU # is found. # # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_CHECK_GLU, [ unset sim_ac_glu_cppflags unset sim_ac_glu_ldflags unset sim_ac_glu_libs sim_ac_glu_avail=no # It's usually libGLU.so on UNIX systems and glu32.lib on MSWindows. sim_ac_glu_names="-lGLU -lglu32" sim_ac_glu_mesanames=-lMesaGLU # with_mesa is set from the SIM_AC_CHECK_OPENGL macro. if test "x$with_mesa" = "xyes"; then sim_ac_glu_first=$sim_ac_glu_mesanames sim_ac_glu_second=$sim_ac_glu_names else sim_ac_glu_first=$sim_ac_glu_names sim_ac_glu_second=$sim_ac_glu_mesanames fi AC_ARG_WITH( [glu],[ --with-glu use the OpenGL utility library [[default=yes]]],[],[with_glu=yes]) if test x"$with_glu" != xno; then if test x"$with_glu" != xyes; then sim_ac_glu_cppflags="-I${with_glu}/include" sim_ac_glu_ldflags="-L${with_glu}/lib" fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_glu_cppflags" LDFLAGS="$LDFLAGS $sim_ac_glu_ldflags" AC_CACHE_CHECK( [whether GLU is available], sim_cv_lib_glu, [sim_cv_lib_glu=UNRESOLVED # Some platforms (like BeOS) have the GLU functionality in the GL # library (and no GLU library present). for sim_ac_glu_libcheck in "" $sim_ac_glu_first $sim_ac_glu_second; do if test "x$sim_cv_lib_glu" = "xUNRESOLVED"; then LIBS="$sim_ac_glu_libcheck $sim_ac_save_libs $GL_LIBS" AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [ gluSphere(0L, 1.0, 1, 1); ], [sim_cv_lib_glu="$sim_ac_glu_libcheck"]) fi done ]) LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_glu" != "xUNRESOLVED"; then sim_ac_glu_libs="$sim_cv_lib_glu" LIBS="$sim_ac_save_libs" GL_LIBS="$GL_LIBS $sim_ac_glu_libs" sim_ac_glu_avail=yes $1 else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs $2 fi fi ]) # ************************************************************************** # SIM_AC_GLU_READY_IFELSE( [ACTION-IF-TRUE], [ACTION-IF-FALSE] ) AC_DEFUN([SIM_AC_GLU_READY_IFELSE], [AC_CACHE_CHECK( [if GLU is available as part of GL library], [sim_cv_glu_ready], [AC_TRY_LINK( [ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [ gluSphere(0L, 1.0, 1, 1); ], [sim_cv_glu_ready=true], [sim_cv_glu_ready=false])]) if ${sim_cv_glu_ready}; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) # SIM_AC_GLU_READY_IFELSE() # Usage: # SIM_AC_GLU_NURBSOBJECT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) # # Try to find out whether the interface struct against the GLU # library NURBS functions is called "GLUnurbs" or "GLUnurbsObj". # (This seems to have changed somewhere between release 1.1 and # release 1.3 of GLU). # # The variable $sim_ac_glu_nurbsobject is set to the correct name # if the nurbs structure is found. # # Author: Morten Eriksen, . AC_DEFUN(SIM_AC_GLU_NURBSOBJECT, [ AC_CACHE_CHECK( [what structure to use in the GLU NURBS interface], sim_cv_func_glu_nurbsobject, [sim_cv_func_glu_nurbsobject=NONE for sim_ac_glu_structname in GLUnurbs GLUnurbsObj; do if test "$sim_cv_func_glu_nurbsobject" = NONE; then AC_TRY_LINK([ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include ], [$sim_ac_glu_structname * hepp = gluNewNurbsRenderer(); gluDeleteNurbsRenderer(hepp)], [sim_cv_func_glu_nurbsobject=$sim_ac_glu_structname]) fi done ]) if test $sim_cv_func_glu_nurbsobject = NONE; then sim_ac_glu_nurbsobject= $2 else sim_ac_glu_nurbsobject=$sim_cv_func_glu_nurbsobject $1 fi ]) # ************************************************************************** # SIM_AC_HAVE_GLX_IFELSE( IF-FOUND, IF-NOT-FOUND ) # # Check whether GLX is on the system. AC_DEFUN([SIM_AC_HAVE_GLX_IFELSE], [ AC_CACHE_CHECK( [whether GLX is on the system], sim_cv_have_glx, AC_TRY_LINK( [#include ], [(void)glXChooseVisual(0L, 0, 0L);], [sim_cv_have_glx=true], [sim_cv_have_glx=false])) if ${sim_cv_have_glx=false}; then ifelse([$1], , :, [$1]) else ifelse([$2], , :, [$2]) fi ]) # SIM_AC_HAVE_GLX_IFELSE() # Usage: # SIM_CHECK_MOTIF_GLWIDGET([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]) # # Description: # This macro checks for a GL widget that can be used with Xt/Motif. # # Variables: # $sim_cv_motif_glwidget (cached) class + header + library # $sim_cv_motif_glwidget_hdrloc (cached) GL | X11/GLw # # $sim_ac_motif_glwidget_class glwMDrawingAreaWidgetClass | # glwDrawingAreaWidgetClass # $sim_ac_motif_glwidget_header GLwDrawA.h | GLwMDrawA.h # $sim_ac_motif_glwidget_library GLwM | GLw | MesaGLwM | MesaGLw # # $LIBS = -l$sim_ac_motif_glwidget_library $LIBS # # Defines: # XT_GLWIDGET $sim_ac_motif_glwidget_class # HAVE_GL_GLWDRAWA_H #include # HAVE_GL_GLWMDRAWA_H #include # HAVE_X11_GWL_GLWDRAWA_H #include # HAVE_X11_GWL_GLWMDRAWA_H #include # # Authors: # Lars J. Aas , # Loring Holden , # Morten Eriksen # AC_DEFUN([SIM_CHECK_MOTIF_GLWIDGET], [ AC_ARG_WITH( [glw],[ --with-glw use the OpenGL widget Library [[default=yes]]], [], [with_glw=yes]) if test x"$with_glw" != x"no" ; then if test x"$with_glw" != x"yes" ; then sim_ac_glw_cppflags="-I${with_glw}/include" sim_ac_glw_ldflags="-L${with_glw}/lib" fi SAVECPPFLAGS="$CPPFLAGS" SAVELDFLAGS="$LDFLAGS" SAVELIBS="$LIBS" CPPFLAGS="$SAVECPPFLAGS $sim_ac_glw_cppflags" LDFLAGS="$SAVELDFLAGS $sim_ac_glw_ldflags" AC_CACHE_CHECK( [for a GL widget], sim_cv_motif_glwidget, [ XWIDGETLIBS="$X_LIBS $X11_LIBS $XT_LIBS $X_LIBS $X_PRE_LIBS $XM_LIBS" sim_cv_motif_glwidget=UNKNOWN for lib in GLwM GLw MesaGLwM MesaGLw; do if test x"$sim_cv_motif_glwidget" = x"UNKNOWN"; then LIBS="-l$lib $SAVELIBS $XWIDGETLIBS $GL_LIBS -lm" AC_TRY_LINK( [#include #include extern WidgetClass glwMDrawingAreaWidgetClass;], [Widget glxManager = NULL; Widget glxWidget = XtVaCreateManagedWidget("GLWidget", glwMDrawingAreaWidgetClass, glxManager, NULL);], [sim_cv_motif_glwidget="glwMDrawingAreaWidgetClass GLwMDrawA.h $lib"], [sim_cv_motif_glwidget=UNKNOWN]) fi done LIBS=$SAVELIBS ]) if test "x$sim_cv_motif_glwidget" = "xUNKNOWN"; then ifelse([$2], , :, [$2]) else sim_ac_motif_glwidget_class=`echo $sim_cv_motif_glwidget | cut -d" " -f1` sim_ac_motif_glwidget_header=`echo $sim_cv_motif_glwidget | cut -d" " -f2` sim_ac_motif_glwidget_library=`echo $sim_cv_motif_glwidget | cut -d" " -f3` AC_CACHE_CHECK( [the $sim_ac_motif_glwidget_header header location], sim_cv_motif_glwidget_hdrloc, [sim_cv_motif_glwidget_hdrloc=UNKNOWN for location in X11/GLw GL; do if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then AC_TRY_CPP( [#include #include <$location/$sim_ac_motif_glwidget_header>], [sim_cv_motif_glwidget_hdrloc=$location], [sim_cv_motif_glwidget_hdrloc=UNKNOWN]) fi done]) if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then ifelse([$2], , :, [$2]) else if test "x$sim_ac_motif_glwidget_header" = "xGLwDrawA.h"; then if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then AC_DEFINE(HAVE_GL_GLWDRAWA_H, 1, [Define this to use OpenGL widget from ]) else AC_DEFINE(HAVE_X11_GLW_GLWDRAWA_H, 1, [Define this to use OpenGL widget from ]) fi else if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then AC_DEFINE(HAVE_GL_GLWMDRAWA_H, 1, [Define this to use OpenGL widget from ]) else AC_DEFINE(HAVE_X11_GLW_GLWMDRAWA_H, 1, [Define this to use OpenGL widget from ]) fi fi AC_DEFINE_UNQUOTED(XT_GLWIDGET, $sim_ac_motif_glwidget_class, [Define this to the Xt/Motif OpenGL widget class to use]) LIBS="$LIBS" GL_LIBS="$GL_LIBS -l$sim_ac_motif_glwidget_library" $1 fi fi fi ]) dnl dnl XMAKEMOL_GLUT_CHECK([ ACTION-IF-FOUND ]) dnl dnl Checks if GLUT is found. If it is, $ac_cv_lib_glut is set to "yes". AC_DEFUN([XMAKEMOL_GLUT_CHECK], [ AC_ARG_WITH(glut-prefix, [ --with-glut-includes=DIR Prefix for GLUT],[ glut_prefix="$withval"]) dnl Check for GLUT includes if test ".$glut_prefix" != . ; then GLUT_INCLUDES="-I$glut_prefix/include" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$GLUT_INCLUDES $CPPFLAGS" AC_CHECK_HEADER(GL/glut.h,:,no_glut=yes) CPPFLAGS="$save_CPPFLAGS" if test ".$glut_prefix" != . ; then CON_LIBS="-L$glut_prefix/lib" fi if test ".$no_glut" != . ; then ac_cv_lib_glut=no GL_LIBS="" else AC_DEFINE(GL,1) ac_cv_lib_glut=yes LDFLAGS="$LDFLAGS $CON_LIBS" GL_LIBS="$GL_LIBS -lglut" fi ]) # lib-prefix.m4 serial 5 (gettext-0.15) dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing dnl the basename of the libdir, either "lib" or "lib64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. The current dnl practice is that on a system supporting 32-bit and 64-bit instruction dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit dnl libraries go under $prefix/lib. We determine the compiler's default dnl mode by looking at the compiler's library search path. If at least dnl of its elements ends in /lib64 or points to a directory whose absolute dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the dnl default, namely "lib". acl_libdirstem=lib searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ]) # lib-link.m4 serial 8 (gettext-0.15) dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_PREREQ(2.50) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes undefine([Name]) undefine([NAME]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. If found, it dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) define([Name],[translit([$1],[./-], [___])]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. ac_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ac_save_LIBS="$LIBS" LIBS="$LIBS $LIB[]NAME" AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) LIBS="$ac_save_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) undefine([Name]) undefine([NAME]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, dnl hardcode_direct, hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Tell automake >= 1.10 to complain if config.rpath is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE(rpath, [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib$1-prefix], [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib --without-lib$1-prefix don't search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= if test $use_additional = yes; then if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi else if test -f "$additional_libdir/lib$name.$libext"; then found_dir="$additional_libdir" found_a="$additional_libdir/lib$name.$libext" if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi else if test -f "$dir/lib$name.$libext"; then found_dir="$dir" found_a="$dir/lib$name.$libext" if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" done dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" eval flag=\"$hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) # lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision dnl with libtool.m4. dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] [re_direlt='/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(acl_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$acl_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_LIB_PROG_LD_GNU ]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.4-p6])]) # # Check to make sure that the build environment is sane. # AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) xmakemol-5.16/config.guess0000755000175000017500000012626010501032643012524 00000000000000#! /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 Free Software Foundation, # Inc. timestamp='2006-07-02' # 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 to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 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 ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # 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 ;; 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:SunOS:5.*:*) echo i386-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:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *: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 __LP64__ >/dev/null 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 ;; i*: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 ;; x86:Interix*:[3456]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[3456]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-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 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu 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 ;; 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:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu 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 ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} 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 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-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 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; 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.0*:*) 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 i386. echo i386-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; } ;; 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.0*:*) 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 ;; 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 ;; 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 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 ;; 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: xmakemol-5.16/config.h.in0000644000175000017500000002521610501032643012226 00000000000000/* config.h.in. Generated from configure.in by autoheader. */ #undef HAVE_MOTIF #undef XPM #undef VERSION #undef GL /* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE #undef _ALL_SOURCE #endif /* Define if using alloca.c. */ #undef C_ALLOCA /* Define if type char is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ #undef __CHAR_UNSIGNED__ #endif /* Define if the closedir function returns void instead of int. */ #undef CLOSEDIR_VOID /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define for DGUX with . */ #undef DGUX /* Define if you have . */ #undef DIRENT /* Define to the type of elements in the array set by `getgroups'. Usually this is either `int' or `gid_t'. */ #undef GETGROUPS_T /* Define if the `getloadavg' function needs to be run setuid or setgid. */ #undef GETLOADAVG_PRIVILEGED /* Define if the `getpgrp' function takes no argument. */ #undef GETPGRP_VOID /* Define to `int' if doesn't define. */ #undef gid_t /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if your system has a working fnmatch function. */ #undef HAVE_FNMATCH /* Define if your system has its own `getloadavg' function. */ #undef HAVE_GETLOADAVG /* Define if you have the getmntent function. */ #undef HAVE_GETMNTENT /* Define if the `long double' type works. */ #undef HAVE_LONG_DOUBLE /* Define if you support file names longer than 14 characters. */ #undef HAVE_LONG_FILE_NAMES /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if system calls automatically restart after interruption by a signal. */ #undef HAVE_RESTARTABLE_SYSCALLS /* Define if your struct stat has st_blksize. */ #undef HAVE_ST_BLKSIZE /* Define if your struct stat has st_blocks. */ #undef HAVE_ST_BLOCKS /* Define if you have the strcoll function and it is properly defined. */ #undef HAVE_STRCOLL /* Define if your struct stat has st_rdev. */ #undef HAVE_ST_RDEV /* Define if you have the strftime function. */ #undef HAVE_STRFTIME /* Define if you have the ANSI # stringizing operator in cpp. */ #undef HAVE_STRINGIZE /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if your struct tm has tm_zone. */ #undef HAVE_TM_ZONE /* Define if you don't have tm_zone but do have the external array tzname. */ #undef HAVE_TZNAME /* Define if you have . */ #undef HAVE_UNISTD_H /* Define if utime(file, NULL) sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL /* Define if you have . */ #undef HAVE_VFORK_H /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define if you have the wait3 system call. */ #undef HAVE_WAIT3 /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define if int is 16 bits instead of 32. */ #undef INT_16_BITS /* Define if long int is 64 bits. */ #undef LONG_64_BITS /* Define if major, minor, and makedev are declared in . */ #undef MAJOR_IN_MKDEV /* Define if major, minor, and makedev are declared in . */ #undef MAJOR_IN_SYSMACROS /* Define if on MINIX. */ #undef _MINIX /* Define to `int' if doesn't define. */ #undef mode_t /* Define if you don't have , but have . */ #undef NDIR /* Define if you have , and doesn't declare the mem* functions. */ #undef NEED_MEMORY_H /* Define if your struct nlist has an n_un member. */ #undef NLIST_NAME_UNION /* Define if you have . */ #undef NLIST_STRUCT /* Define if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define if your Fortran 77 compiler doesn't accept -c and -o together. */ #undef F77_NO_MINUS_C_MINUS_O /* Define to `long' if doesn't define. */ #undef off_t /* Define to `int' if doesn't define. */ #undef pid_t /* Define if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define to the type of arg1 for select(). */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for select(). */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg5 for select(). */ #undef SELECT_TYPE_ARG5 /* Define if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID /* Define if the setvbuf function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ #undef SETVBUF_REVERSED /* Define to `unsigned' if doesn't define. */ #undef size_t /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define on System V Release 4. */ #undef SVR4 /* Define if you don't have , but have . */ #undef SYSDIR /* Define if you don't have , but have . */ #undef SYSNDIR /* Define if `sys_siglist' is declared by . */ #undef SYS_SIGLIST_DECLARED /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define to `int' if doesn't define. */ #undef uid_t /* Define for Encore UMAX. */ #undef UMAX /* Define for Encore UMAX 4.3 that has instead of . */ #undef UMAX4_3 /* Define if you do not have , index, bzero, etc.. */ #undef USG /* Define vfork as fork if vfork does not work. */ #undef vfork /* Define if the closedir function returns void instead of int. */ #undef VOID_CLOSEDIR /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define if lex declares yytext as a char * by default, not a char[]. */ #undef YYTEXT_POINTER /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `ftime' function. */ #undef HAVE_FTIME /* Define this to use OpenGL widget from */ #undef HAVE_GL_GLWDRAWA_H /* Define this to use OpenGL widget from */ #undef HAVE_GL_GLWMDRAWA_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define this to use OpenGL widget from */ #undef HAVE_X11_GLW_GLWDRAWA_H /* Define this to use OpenGL widget from */ #undef HAVE_X11_GLW_GLWMDRAWA_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define this to the Xt/Motif OpenGL widget class to use */ #undef XT_GLWIDGET /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define to empty if `const' does not conform to ANSI C. */ #undef const xmakemol-5.16/config.sub0000755000175000017500000007730010501032643012167 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-07-02' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 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* | \ 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) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -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 \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | 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 \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; 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-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | 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-* \ | sh-* | sh[1234]-* | sh[24]a-* | 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-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; 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 ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-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 ;; 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 ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; 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 ;; 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 ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; 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 ;; 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 ;; 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[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. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -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* \ | -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*) # 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 ;; -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 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 ;; 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 ;; -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: xmakemol-5.16/configure0000755000175000017500000075644010665601056012137 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be 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=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi 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 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="xmakemol.c" # 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='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT XMKMF CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS XPM_LIBS X11_LIBS XEXT_LIBS XI_LIBS XT_LIBS XM_LIBS GREP EGREP GL_LIBS ALLOCA LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS XMKMF CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package 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/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System --with-motif-includes=DIR Motif include files are in DIR --with-motif-libraries=DIR Motif libraries are in DIR --without-xpm do not use the Xpm library --with-xpm-includes=DIR Xpm include files are in DIR --with-xpm-libraries=DIR Xpm libraries are in DIR --with-mesa prefer MesaGL (if found) over OpenGL [default=yes] --with-opengl OpenGL/Mesa installation directory --with-pthread pthread installation directory --with-glu use the OpenGL utility library [default=yes] --with-glw use the OpenGL widget Library [default=yes] --with-glut-includes=DIR Prefix for GLUT 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 C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory XMKMF Path to xmkmf, Makefile generator for X Window System 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. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # 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. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.4" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS 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 { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftestfile ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest* { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=xmakemol VERSION=5.16 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF missing_dir=`cd $ac_aux_dir && pwd` { echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5 echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6; } # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal-${am__api_version} { echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6; } else ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" { echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6; } fi { echo "$as_me:$LINENO: checking for working autoconf" >&5 echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6; } # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf { echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6; } else AUTOCONF="$missing_dir/missing autoconf" { echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6; } fi { echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5 echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6; } # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-${am__api_version} { echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6; } else AUTOMAKE="$missing_dir/missing automake-${am__api_version}" { echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6; } fi { echo "$as_me:$LINENO: checking for working autoheader" >&5 echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6; } # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader { echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6; } else AUTOHEADER="$missing_dir/missing autoheader" { echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6; } fi { echo "$as_me:$LINENO: checking for working makeinfo" >&5 echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6; } # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo { echo "$as_me:$LINENO: result: found" >&5 echo "${ECHO_T}found" >&6; } else MAKEINFO="$missing_dir/missing makeinfo" { echo "$as_me:$LINENO: result: missing" >&5 echo "${ECHO_T}missing" >&6; } fi ac_config_headers="$ac_config_headers config.h" ac_config_commands="$ac_config_commands default-1" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_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" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS 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 { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 echo "$as_me: error: Cannot use X directory names containing '" >&2;} { (exit 1); exit 1; }; };; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . { echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6; } if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6; } if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. { echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6; } if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* 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 gethostbyname (); /* 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_gethostbyname || defined __stub___gethostbyname choke me #endif int main () { return gethostbyname (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6; } if test $ac_cv_func_gethostbyname = no; then { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; } if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6; } if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. { echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6; } if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* 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 connect (); /* 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_connect || defined __stub___connect choke me #endif int main () { return connect (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6; } if test $ac_cv_func_connect = no; then { echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 connect (); int main () { return connect (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6; } if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. { echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6; } if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* 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 remove (); /* 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_remove || defined __stub___remove choke me #endif int main () { return remove (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6; } if test $ac_cv_func_remove = no; then { echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6; } if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 remove (); int main () { return remove (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6; } if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. { echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6; } if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* 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 shmat (); /* 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_shmat || defined __stub___shmat choke me #endif int main () { return shmat (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6; } if test $ac_cv_func_shmat = no; then { echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6; } if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 shmat (); int main () { return shmat (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6; } if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; } if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi motif_includes= motif_libraries= # Check whether --with-motif-includes was given. if test "${with_motif_includes+set}" = set; then withval=$with_motif_includes; motif_includes="$withval" fi # Check whether --with-motif-libraries was given. if test "${with_motif_libraries+set}" = set; then withval=$with_motif_libraries; motif_libraries="$withval" fi { echo "$as_me:$LINENO: checking for Motif" >&5 echo $ECHO_N "checking for Motif... $ECHO_C" >&6; } # # # Search the include files. # if test "$motif_includes" = ""; then if test "${ice_cv_motif_includes+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int a; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Xm/Xm.h is in the standard search path. ice_cv_motif_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Xm/Xm.h is not in the standard search path. # Locate it and put its directory in `motif_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/Xm/Xm.h"; then ice_cv_motif_includes="$dir" break fi done if test "$ice_cv_motif_includes" = ""; then ice_cv_motif_includes=no fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" fi motif_includes="$ice_cv_motif_includes" fi # # # Now for the libraries. # if test "$motif_libraries" = ""; then if test "${ice_cv_motif_libraries+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ice_motif_save_LIBS="$LIBS" ice_motif_save_CFLAGS="$CFLAGS" ice_motif_save_CPPFLAGS="$CPPFLAGS" ice_motif_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { XtToolkitInitialize(); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then # libXm.a is in the standard search path. ice_cv_motif_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # libXm.a is not in the standard search path. # Locate it and put its directory in `motif_libraries' # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Athena). # /usr/dt is used on Solaris (Motif). # /usr/lesstif is used on Linux (Lesstif). # /usr/openwin is used on Solaris (X and Athena). # Other directories are just guesses. for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ /usr/lesstif*/lib /usr/lib/Lesstif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then ice_cv_motif_libraries="$dir" break fi done if test "$ice_cv_motif_libraries" = ""; then ice_cv_motif_libraries=no fi fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # LIBS="$ice_motif_save_LIBS" CFLAGS="$ice_motif_save_CFLAGS" CPPFLAGS="$ice_motif_save_CPPFLAGS" LDFLAGS="$ice_motif_save_LDFLAGS" fi # motif_libraries="$ice_cv_motif_libraries" fi # Add Motif definitions to X flags # if test "$motif_includes" != "" && test "$motif_includes" != "$x_includes" && test "$motif_includes" != "no" then X_CFLAGS="-I$motif_includes $X_CFLAGS" fi if test "$motif_libraries" != "" && test "$motif_libraries" != "$x_libraries" && test "$motif_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$motif_libraries -R $motif_libraries $X_LIBS";; *-R*) X_LIBS="-L$motif_libraries -R$motif_libraries $X_LIBS";; *) X_LIBS="-L$motif_libraries $X_LIBS";; esac fi # # motif_libraries_result="$motif_libraries" motif_includes_result="$motif_includes" test "$motif_libraries_result" = "" && motif_libraries_result="in default path" test "$motif_includes_result" = "" && motif_includes_result="in default path" test "$motif_libraries_result" = "no" && motif_libraries_result="(none)" test "$motif_includes_result" = "no" && motif_includes_result="(none)" { echo "$as_me:$LINENO: result: libraries $motif_libraries_result, headers $motif_includes_result" >&5 echo "${ECHO_T}libraries $motif_libraries_result, headers $motif_includes_result" >&6; } xpm_includes= xpm_libraries= # Check whether --with-xpm was given. if test "${with_xpm+set}" = set; then withval=$with_xpm; with_xpm=no fi if test "$with_xpm" = "no" then xpm_includes=no xpm_libraries=no fi # Check whether --with-xpm-includes was given. if test "${with_xpm_includes+set}" = set; then withval=$with_xpm_includes; xpm_includes="$withval" fi # Check whether --with-xpm-libraries was given. if test "${with_xpm_libraries+set}" = set; then withval=$with_xpm_libraries; xpm_libraries="$withval" fi { echo "$as_me:$LINENO: checking for Xpm" >&5 echo $ECHO_N "checking for Xpm... $ECHO_C" >&6; } # # # Search the include files. Note that XPM can come in (as # in X11R6) or in if installed locally. # if test "$xpm_includes" = ""; then if test "${ice_cv_xpm_includes+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int a; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # X11/xpm.h is in the standard search path. ice_cv_xpm_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # X11/xpm.h is not in the standard search path. # Locate it and put its directory in `xpm_includes' # # /usr/include/Motif* are used on HP-UX (Motif). # /usr/include/X11* are used on HP-UX (X and Xaw). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xaw). # Other directories are just guesses. ice_cv_xpm_includes=no for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ /usr/dt/include /usr/openwin/include \ /usr/dt/*/include /opt/*/include /usr/include/Motif* \ "${prefix}"/*/include /usr/*/include /usr/local/*/include \ "${prefix}"/include/* /usr/include/* /usr/local/include/*; do if test -f "$dir/X11/xpm.h" || test -f "$dir/xpm.h"; then ice_cv_xpm_includes="$dir" echo "found xpm.h from $dir" 1>&5 break fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" fi xpm_includes="$ice_cv_xpm_includes" fi # # # Now for the libraries. # if test "$xpm_libraries" = ""; then if test "${ice_cv_xpm_libraries+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ice_xpm_save_LIBS="$LIBS" ice_xpm_save_CFLAGS="$CFLAGS" ice_xpm_save_CPPFLAGS="$CPPFLAGS" ice_xpm_save_LDFLAGS="$LDFLAGS" # LIBS="$X_PRE_LIBS -lXpm -lXt -lX11 $X_EXTRA_LIBS $LIBS" CFLAGS="$X_CFLAGS $CFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" LDFLAGS="$X_LIBS $LDFLAGS" # # # We use XtToolkitInitialize() here since it takes no arguments # and thus also works with a C++ compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { XtToolkitInitialize(); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then # libxpm.a is in the standard search path. ice_cv_xpm_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # libXpm.a is not in the standard search path. # Locate it and put its directory in `xpm_libraries' # # # /usr/lib/Motif* are used on HP-UX (Motif). # /usr/lib/X11* are used on HP-UX (X and Xpm). # /usr/dt is used on Solaris (Motif). # /usr/openwin is used on Solaris (X and Xpm). # Other directories are just guesses. ice_cv_xpm_libraries=no for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ /usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \ /usr/lib/Motif1.1 /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 \ /usr/lib/X11 /usr/dt/lib /usr/openwin/lib \ /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do if test -d "$dir" && test "`ls $dir/libXpm.* 2> /dev/null`" != ""; then ice_cv_xpm_libraries="$dir" echo "found libXpm from $dir" 1>&5 break fi done fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # LIBS="$ice_xpm_save_LIBS" CFLAGS="$ice_xpm_save_CFLAGS" CPPFLAGS="$ice_xpm_save_CPPFLAGS" LDFLAGS="$ice_xpm_save_LDFLAGS" fi # xpm_libraries="$ice_cv_xpm_libraries" fi # # Define XPM in config.h or disable XPM completely of either the header # or the library was not found. # if test "$xpm_libraries" != "no" && test "$xpm_includes" != "no"; then cat >>confdefs.h <<\_ACEOF #define XPM 1 _ACEOF else xpm_libraries=no xpm_includes=no fi # # Add Xpm definitions to X flags # if test "$xpm_includes" != "" && test "$xpm_includes" != "$x_includes" && test "$xpm_includes" != "no" then X_CFLAGS="-I$xpm_includes $X_CFLAGS" fi if test "$xpm_libraries" != "" && test "$xpm_libraries" != "$x_libraries" && test "$xpm_libraries" != "no" then case "$X_LIBS" in *-R\ *) X_LIBS="-L$xpm_libraries -R $xpm_libraries $X_LIBS";; *-R*) X_LIBS="-L$xpm_libraries -R$xpm_libraries $X_LIBS";; *) X_LIBS="-L$xpm_libraries $X_LIBS";; esac fi # # xpm_libraries_result="$xpm_libraries" xpm_includes_result="$xpm_includes" test "$xpm_libraries_result" = "" && xpm_libraries_result="in default path" test "$xpm_includes_result" = "" && xpm_includes_result="in default path" test "$xpm_libraries_result" = "no" && xpm_libraries_result="(none)" test "$xpm_includes_result" = "no" && xpm_includes_result="(none)" { echo "$as_me:$LINENO: result: libraries $xpm_libraries_result, headers $xpm_includes_result" >&5 echo "${ECHO_T}libraries $xpm_libraries_result, headers $xpm_includes_result" >&6; } # # Export @XPM_LIBS@ to Makefile.am # if test "$xpm_libraries" != "no"; then XPM_LIBS="-lXpm" else XPM_LIBS="" fi LIBS="$LIBS $X_EXTRA_LIBS" CFLAGS="$CFLAGS $X_CFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" X11_LIBS="" { echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5 echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6; } if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 ${X_PRE_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_X11_XOpenDisplay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_XOpenDisplay=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5 echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6; } if test $ac_cv_lib_X11_XOpenDisplay = yes; then X11_LIBS="-lX11" fi if test "$X11_LIBS" = ""; then { { echo "$as_me:$LINENO: error: The X11 library '-lX11' could not be found. Please use the configure options '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics." >&5 echo "$as_me: error: The X11 library '-lX11' could not be found. Please use the configure options '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics." >&2;} { (exit 1); exit 1; }; } fi XEXT_LIBS="" { echo "$as_me:$LINENO: checking for XShapeQueryVersion in -lXext" >&5 echo $ECHO_N "checking for XShapeQueryVersion in -lXext... $ECHO_C" >&6; } if test "${ac_cv_lib_Xext_XShapeQueryVersion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXext ${X_PRE_LIBS} ${X11_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 XShapeQueryVersion (); int main () { return XShapeQueryVersion (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xext_XShapeQueryVersion=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xext_XShapeQueryVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XShapeQueryVersion" >&5 echo "${ECHO_T}$ac_cv_lib_Xext_XShapeQueryVersion" >&6; } if test $ac_cv_lib_Xext_XShapeQueryVersion = yes; then XEXT_LIBS="-lXext" fi XI_LIBS="" { echo "$as_me:$LINENO: checking for XGetExtensionVersion in -lXi" >&5 echo $ECHO_N "checking for XGetExtensionVersion in -lXi... $ECHO_C" >&6; } if test "${ac_cv_lib_Xi_XGetExtensionVersion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXi ${X_PRE_LIBS} ${X11_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 XGetExtensionVersion (); int main () { return XGetExtensionVersion (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xi_XGetExtensionVersion=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xi_XGetExtensionVersion=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xi_XGetExtensionVersion" >&5 echo "${ECHO_T}$ac_cv_lib_Xi_XGetExtensionVersion" >&6; } if test $ac_cv_lib_Xi_XGetExtensionVersion = yes; then XI_LIBS="-lXi" fi XT_LIBS="" { echo "$as_me:$LINENO: checking for XtToolkitInitialize in -lXt" >&5 echo $ECHO_N "checking for XtToolkitInitialize in -lXt... $ECHO_C" >&6; } if test "${ac_cv_lib_Xt_XtToolkitInitialize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXt ${X_PRE_LIBS} ${X11_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 XtToolkitInitialize (); int main () { return XtToolkitInitialize (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xt_XtToolkitInitialize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xt_XtToolkitInitialize=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xt_XtToolkitInitialize" >&5 echo "${ECHO_T}$ac_cv_lib_Xt_XtToolkitInitialize" >&6; } if test $ac_cv_lib_Xt_XtToolkitInitialize = yes; then XT_LIBS="-lXt" fi if test "$XT_LIBS" = ""; then { { echo "$as_me:$LINENO: error: The X toolkit library '-lXt' could not be found. Please use the configure iptions '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics." >&5 echo "$as_me: error: The X toolkit library '-lXt' could not be found. Please use the configure iptions '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics." >&2;} { (exit 1); exit 1; }; } fi XM_LIBS="" { echo "$as_me:$LINENO: checking for XmRepTypeInstallTearOffModelConverter in -lXm" >&5 echo $ECHO_N "checking for XmRepTypeInstallTearOffModelConverter in -lXm... $ECHO_C" >&6; } if test "${ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXm ${X_PRE_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${XI_LIBS} ${X11_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 XmRepTypeInstallTearOffModelConverter (); int main () { return XmRepTypeInstallTearOffModelConverter (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter" >&5 echo "${ECHO_T}$ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter" >&6; } if test $ac_cv_lib_Xm_XmRepTypeInstallTearOffModelConverter = yes; then XM_LIBS="-lXm" cat >>confdefs.h <<\_ACEOF #define HAVE_MOTIF 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_MOTIF 0 _ACEOF fi if test "$XM_LIBS" = ""; then { { echo "$as_me:$LINENO: error: The Motif library '-lXm' could not be found. Please use the configure options '--with-motif-includes=DIR' and '--with-motif-libraries=DIR' to specify the Xm location. See the 'config.log' file for further diagnostics." >&5 echo "$as_me: error: The Motif library '-lXm' could not be found. Please use the configure options '--with-motif-includes=DIR' and '--with-motif-libraries=DIR' to specify the Xm location. See the 'config.log' file for further diagnostics." >&2;} { (exit 1); exit 1; }; } fi GL_LIBS="" { echo "$as_me:$LINENO: checking for pow in -lm" >&5 echo $ECHO_N "checking for pow in -lm... $ECHO_C" >&6; } if test "${ac_cv_lib_m_pow+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any 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 pow (); int main () { return pow (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_m_pow=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5 echo "${ECHO_T}$ac_cv_lib_m_pow" >&6; } if test $ac_cv_lib_m_pow = yes; then MATHLIB="true" fi if test x"$MATHLIB" != x"true"; then { { echo "$as_me:$LINENO: error: the math library '-lm' could not be found! Please check the installation of math library" >&5 echo "$as_me: error: the math library '-lm' could not be found! Please check the installation of math library" >&2;} { (exit 1); exit 1; }; } fi if test x"$MATHLIB" = x"true"; then LIBS="$LIBS -lm" unset sim_ac_gl_cppflags unset sim_ac_gl_ldflags unset sim_ac_gl_libs sim_ac_gl_avail=no # Check whether --with-mesa was given. if test "${with_mesa+set}" = set; then withval=$with_mesa; else with_mesa=yes fi # It's usually libGL.so on UNIX systems and opengl32.lib on MSWindows. sim_ac_gl_glnames="-lGL -lopengl32" sim_ac_gl_mesaglnames=-lMesaGL GL_LIBS="" if test "x$with_mesa" = "xyes"; then sim_ac_gl_first=$sim_ac_gl_mesaglnames sim_ac_gl_second=$sim_ac_gl_glnames else sim_ac_gl_first=$sim_ac_gl_glnames sim_ac_gl_second=$sim_ac_gl_mesaglnames fi # Check whether --with-opengl was given. if test "${with_opengl+set}" = set; then withval=$with_opengl; else with_opengl=yes fi if test x"$with_opengl" != xno; then if test x"$with_opengl" != xyes; then sim_ac_gl_cppflags="-I${with_opengl}/include" sim_ac_gl_ldflags="-L${with_opengl}/lib" else # This is a common location for the OpenGL library on HPUX. sim_ac_gl_hpux=/opt/graphics/OpenGL if test -d $sim_ac_gl_hpux; then sim_ac_gl_cppflags=-I$sim_ac_gl_hpux/include sim_ac_gl_ldflags=-L$sim_ac_gl_hpux/lib fi fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_gl_cppflags" LDFLAGS="$LDFLAGS $sim_ac_gl_ldflags" { echo "$as_me:$LINENO: checking whether OpenGL library is available" >&5 echo $ECHO_N "checking whether OpenGL library is available... $ECHO_C" >&6; } if test "${sim_cv_lib_gl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else sim_cv_lib_gl=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_save_libs -lm" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include int main () { glPointSize(1.0f); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then sim_cv_lib_gl="$sim_ac_gl_libcheck" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi done fi { echo "$as_me:$LINENO: result: $sim_cv_lib_gl" >&5 echo "${ECHO_T}$sim_cv_lib_gl" >&6; } LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_gl" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl" else { echo "$as_me:$LINENO: WARNING: couldn't compile or link with OpenGL library -- trying with pthread library in place..." >&5 echo "$as_me: WARNING: couldn't compile or link with OpenGL library -- trying with pthread library in place..." >&2;} # Check whether --with-pthread was given. if test "${with_pthread+set}" = set; then withval=$with_pthread; else with_pthread=yes fi sim_ac_pthread_avail=no if test x"$with_pthread" != xno; then if test x"$with_pthread" != xyes; then sim_ac_pthread_cppflags="-I${with_pthread}/include" sim_ac_pthread_ldflags="-L${with_pthread}/lib" fi sim_ac_pthread_libs_first="-lpthread" sim_ac_pthread_libs_second="-pthread" sim_ac_pthread_libs_third="-lc_r" sim_ac_pthread_libs="" # FreeBSD 4.x use "-pthread" or "-lc_r" sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS { echo "$as_me:$LINENO: checking whether the pthread development system is available" >&5 echo $ECHO_N "checking whether the pthread development system is available... $ECHO_C" >&6; } if test "${sim_cv_lib_pthread_avail+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for sim_pthread_libs in $sim_ac_pthread_libs_first \ $sim_ac_pthread_libs_second $sim_ac_pthread_libs_third ; do if test x"$sim_cv_lib_pthread_avail" != x"yes" ; then CPPFLAGS="$CPPFLAGS $sim_ac_pthread_cppflags" LDFLAGS="$LDFLAGS $sim_ac_pthread_ldflags" LIBS="$sim_pthread_libs $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { (void)pthread_create(0L, 0L, 0L, 0L); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then sim_cv_lib_pthread_avail=yes sim_ac_pthread_libs="$sim_pthread_libs" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 sim_cv_lib_pthread_avail=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi if test x"$sim_cv_lib_pthread_avail" != x"yes"; then CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs fi done fi { echo "$as_me:$LINENO: result: $sim_cv_lib_pthread_avail" >&5 echo "${ECHO_T}$sim_cv_lib_pthread_avail" >&6; } if test x"$sim_cv_lib_pthread_avail" = xyes; then sim_ac_pthread_avail=yes sim_ac_gl_cppflags="$sim_ac_gl_cppflags $sim_ac_pthread_cppflags" sim_ac_gl_ldflags="$sim_ac_gl_ldflags $sim_ac_pthread_ldflags" else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs { echo "$as_me:$LINENO: WARNING: couldn't compile or link with pthread library" >&5 echo "$as_me: WARNING: couldn't compile or link with pthread library" >&2;} fi fi if test "x$sim_ac_pthread_avail" = "xyes"; then { echo "$as_me:$LINENO: checking whether OpenGL library can be linked with pthread library" >&5 echo $ECHO_N "checking whether OpenGL library can be linked with pthread library... $ECHO_C" >&6; } if test "${sim_cv_lib_gl_pthread+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else sim_cv_lib_gl_pthread=UNRESOLVED for sim_ac_gl_libcheck in $sim_ac_gl_first $sim_ac_gl_second; do if test "x$sim_cv_lib_gl_pthread" = "xUNRESOLVED"; then LIBS="$sim_ac_gl_libcheck $sim_ac_pthread_libs $sim_ac_save_libs" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include int main () { glPointSize(1.0f); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then sim_cv_lib_gl_pthread="$sim_ac_gl_libcheck" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi done fi { echo "$as_me:$LINENO: result: $sim_cv_lib_gl_pthread" >&5 echo "${ECHO_T}$sim_cv_lib_gl_pthread" >&6; } if test "x$sim_cv_lib_gl_pthread" != "xUNRESOLVED"; then sim_ac_gl_libs="$sim_cv_lib_gl_pthread $sim_ac_pthread_libs" fi fi fi if test "x$sim_ac_gl_libs" != "x"; then LIBS="$sim_ac_save_libs" GL_LIBS="$sim_ac_gl_libs" sim_ac_gl_avail=yes OPENGLLIB="true" else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs fi fi if test x"$OPENGLLIB" = x"true" ; then unset sim_ac_glu_cppflags unset sim_ac_glu_ldflags unset sim_ac_glu_libs sim_ac_glu_avail=no # It's usually libGLU.so on UNIX systems and glu32.lib on MSWindows. sim_ac_glu_names="-lGLU -lglu32" sim_ac_glu_mesanames=-lMesaGLU # with_mesa is set from the SIM_AC_CHECK_OPENGL macro. if test "x$with_mesa" = "xyes"; then sim_ac_glu_first=$sim_ac_glu_mesanames sim_ac_glu_second=$sim_ac_glu_names else sim_ac_glu_first=$sim_ac_glu_names sim_ac_glu_second=$sim_ac_glu_mesanames fi # Check whether --with-glu was given. if test "${with_glu+set}" = set; then withval=$with_glu; else with_glu=yes fi if test x"$with_glu" != xno; then if test x"$with_glu" != xyes; then sim_ac_glu_cppflags="-I${with_glu}/include" sim_ac_glu_ldflags="-L${with_glu}/lib" fi sim_ac_save_cppflags=$CPPFLAGS sim_ac_save_ldflags=$LDFLAGS sim_ac_save_libs=$LIBS CPPFLAGS="$CPPFLAGS $sim_ac_glu_cppflags" LDFLAGS="$LDFLAGS $sim_ac_glu_ldflags" { echo "$as_me:$LINENO: checking whether GLU is available" >&5 echo $ECHO_N "checking whether GLU is available... $ECHO_C" >&6; } if test "${sim_cv_lib_glu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else sim_cv_lib_glu=UNRESOLVED # Some platforms (like BeOS) have the GLU functionality in the GL # library (and no GLU library present). for sim_ac_glu_libcheck in "" $sim_ac_glu_first $sim_ac_glu_second; do if test "x$sim_cv_lib_glu" = "xUNRESOLVED"; then LIBS="$sim_ac_glu_libcheck $sim_ac_save_libs $GL_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_WINDOWS_H #include #endif /* HAVE_WINDOWS_H */ #include #include int main () { gluSphere(0L, 1.0, 1, 1); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then sim_cv_lib_glu="$sim_ac_glu_libcheck" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi done fi { echo "$as_me:$LINENO: result: $sim_cv_lib_glu" >&5 echo "${ECHO_T}$sim_cv_lib_glu" >&6; } LIBS="$sim_ac_save_libs" if test "x$sim_cv_lib_glu" != "xUNRESOLVED"; then sim_ac_glu_libs="$sim_cv_lib_glu" LIBS="$sim_ac_save_libs" GL_LIBS="$GL_LIBS $sim_ac_glu_libs" sim_ac_glu_avail=yes GLULIB="true" else CPPFLAGS=$sim_ac_save_cppflags LDFLAGS=$sim_ac_save_ldflags LIBS=$sim_ac_save_libs fi fi if test x"$GLULIB" = x"true" ; then # Check whether --with-glw was given. if test "${with_glw+set}" = set; then withval=$with_glw; else with_glw=yes fi if test x"$with_glw" != x"no" ; then if test x"$with_glw" != x"yes" ; then sim_ac_glw_cppflags="-I${with_glw}/include" sim_ac_glw_ldflags="-L${with_glw}/lib" fi SAVECPPFLAGS="$CPPFLAGS" SAVELDFLAGS="$LDFLAGS" SAVELIBS="$LIBS" CPPFLAGS="$SAVECPPFLAGS $sim_ac_glw_cppflags" LDFLAGS="$SAVELDFLAGS $sim_ac_glw_ldflags" { echo "$as_me:$LINENO: checking for a GL widget" >&5 echo $ECHO_N "checking for a GL widget... $ECHO_C" >&6; } if test "${sim_cv_motif_glwidget+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else XWIDGETLIBS="$X_LIBS $X11_LIBS $XT_LIBS $X_LIBS $X_PRE_LIBS $XM_LIBS" sim_cv_motif_glwidget=UNKNOWN for lib in GLwM GLw MesaGLwM MesaGLw; do if test x"$sim_cv_motif_glwidget" = x"UNKNOWN"; then LIBS="-l$lib $SAVELIBS $XWIDGETLIBS $GL_LIBS -lm" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include extern WidgetClass glwMDrawingAreaWidgetClass; int main () { Widget glxManager = NULL; Widget glxWidget = XtVaCreateManagedWidget("GLWidget", glwMDrawingAreaWidgetClass, glxManager, NULL); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then sim_cv_motif_glwidget="glwMDrawingAreaWidgetClass GLwMDrawA.h $lib" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 sim_cv_motif_glwidget=UNKNOWN fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi done LIBS=$SAVELIBS fi { echo "$as_me:$LINENO: result: $sim_cv_motif_glwidget" >&5 echo "${ECHO_T}$sim_cv_motif_glwidget" >&6; } if test "x$sim_cv_motif_glwidget" = "xUNKNOWN"; then GL_LIBS="" else sim_ac_motif_glwidget_class=`echo $sim_cv_motif_glwidget | cut -d" " -f1` sim_ac_motif_glwidget_header=`echo $sim_cv_motif_glwidget | cut -d" " -f2` sim_ac_motif_glwidget_library=`echo $sim_cv_motif_glwidget | cut -d" " -f3` { echo "$as_me:$LINENO: checking the $sim_ac_motif_glwidget_header header location" >&5 echo $ECHO_N "checking the $sim_ac_motif_glwidget_header header location... $ECHO_C" >&6; } if test "${sim_cv_motif_glwidget_hdrloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else sim_cv_motif_glwidget_hdrloc=UNKNOWN for location in X11/GLw GL; do if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$location/$sim_ac_motif_glwidget_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then sim_cv_motif_glwidget_hdrloc=$location else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 sim_cv_motif_glwidget_hdrloc=UNKNOWN fi rm -f conftest.err conftest.$ac_ext fi done fi { echo "$as_me:$LINENO: result: $sim_cv_motif_glwidget_hdrloc" >&5 echo "${ECHO_T}$sim_cv_motif_glwidget_hdrloc" >&6; } if test "x$sim_cv_motif_glwidget_hdrloc" = "xUNKNOWN"; then GL_LIBS="" else if test "x$sim_ac_motif_glwidget_header" = "xGLwDrawA.h"; then if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GL_GLWDRAWA_H 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_X11_GLW_GLWDRAWA_H 1 _ACEOF fi else if test "x$sim_cv_motif_glwidget_hdrloc" = "xGL"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GL_GLWMDRAWA_H 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_X11_GLW_GLWMDRAWA_H 1 _ACEOF fi fi cat >>confdefs.h <<_ACEOF #define XT_GLWIDGET $sim_ac_motif_glwidget_class _ACEOF LIBS="$LIBS" GL_LIBS="$GL_LIBS -l$sim_ac_motif_glwidget_library" GLWIDGETLIB="true" fi fi fi { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else 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 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" 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 ac_count=`expr $ac_count + 1` 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 fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else 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 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" 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 ac_count=`expr $ac_count + 1` 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 fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #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 rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-glut-prefix was given. if test "${with_glut_prefix+set}" = set; then withval=$with_glut_prefix; glut_prefix="$withval" fi if test ".$glut_prefix" != . ; then GLUT_INCLUDES="-I$glut_prefix/include" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$GLUT_INCLUDES $CPPFLAGS" if test "${ac_cv_header_GL_glut_h+set}" = set; then { echo "$as_me:$LINENO: checking for GL/glut.h" >&5 echo $ECHO_N "checking for GL/glut.h... $ECHO_C" >&6; } if test "${ac_cv_header_GL_glut_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_GL_glut_h" >&5 echo "${ECHO_T}$ac_cv_header_GL_glut_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking GL/glut.h usability" >&5 echo $ECHO_N "checking GL/glut.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking GL/glut.h presence" >&5 echo $ECHO_N "checking GL/glut.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: GL/glut.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: GL/glut.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: GL/glut.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: GL/glut.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: GL/glut.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: GL/glut.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: GL/glut.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: GL/glut.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: GL/glut.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: GL/glut.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: GL/glut.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for GL/glut.h" >&5 echo $ECHO_N "checking for GL/glut.h... $ECHO_C" >&6; } if test "${ac_cv_header_GL_glut_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_GL_glut_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_GL_glut_h" >&5 echo "${ECHO_T}$ac_cv_header_GL_glut_h" >&6; } fi if test $ac_cv_header_GL_glut_h = yes; then : else no_glut=yes fi CPPFLAGS="$save_CPPFLAGS" if test ".$glut_prefix" != . ; then CON_LIBS="-L$glut_prefix/lib" fi if test ".$no_glut" != . ; then ac_cv_lib_glut=no GL_LIBS="" else cat >>confdefs.h <<\_ACEOF #define GL 1 _ACEOF ac_cv_lib_glut=yes LDFLAGS="$LDFLAGS $CON_LIBS" GL_LIBS="$GL_LIBS -lglut" fi fi fi fi { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #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 rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { echo "$as_me:$LINENO: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 _ACEOF fi { echo "$as_me:$LINENO: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #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 */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF 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 cat >>confdefs.h <<\_ACEOF #define C_ALLOCA 1 _ACEOF { echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #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 { echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any 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 $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int 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 rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_func in ftime strstr usleep do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any 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 $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be 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=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi 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 # 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 $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim SET_MAKE!$SET_MAKE$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim XMKMF!$XMKMF$ac_delim CPP!$CPP$ac_delim X_CFLAGS!$X_CFLAGS$ac_delim X_PRE_LIBS!$X_PRE_LIBS$ac_delim X_LIBS!$X_LIBS$ac_delim X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim XPM_LIBS!$XPM_LIBS$ac_delim X11_LIBS!$X11_LIBS$ac_delim XEXT_LIBS!$XEXT_LIBS$ac_delim XI_LIBS!$XI_LIBS$ac_delim XT_LIBS!$XT_LIBS$ac_delim XM_LIBS!$XM_LIBS$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim GL_LIBS!$GL_LIBS$ac_delim ALLOCA!$ALLOCA$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then 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. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "default-1":C) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi xmakemol-5.16/configure.in0000644000175000017500000001304010665573763012534 00000000000000/* Copyright (C) 2001, 2002, 2003, 2004 Matthew P. Hodges Copyright (C) 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA configure.in for xmakemol: acincluce.m4 gives detailed description of local routines below: [ICE_FIND_MOTIF] -- borrowed from mgv [ICE_FIND_XPM] -- borrowed from mgv [SIM_AC_CHECK_OPENGL] -- derived from coin3d [SIM_AC_CHECK_GLU] -- derived from coin3d [SIM_CHECK_MOTIF_GLWIDGET] --derived from coin3d */ dnl Process this file with autoconf to produce a configure script. AC_INIT(xmakemol.c) dnl Checks for system AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(xmakemol,5.16) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL dnl Configs from ac_opengl package dnl AC_CONFIG_AUX_DIR(config) dnl Checks for libraries. dnl ========================================================================== dnl Checks for libraries. dnl ========================================================================== AC_PATH_X AC_PATH_XTRA ICE_FIND_MOTIF ICE_FIND_XPM LIBS="$LIBS $X_EXTRA_LIBS" CFLAGS="$CFLAGS $X_CFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" dnl ========================================================================== dnl Check for X11. dnl ========================================================================== X11_LIBS="" AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS}) if test "$X11_LIBS" = ""; then AC_MSG_ERROR([The X11 library '-lX11' could not be found. Please use the configure options '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics.]) fi AC_SUBST(X_LIBS) AC_SUBST(X11_LIBS) AC_SUBST(X_PRE_LIBS) dnl ========================================================================== dnl Check for Xext, Xpm usually needs the shape extensions. dnl We don't crap out if we can't find it though. dnl ========================================================================== XEXT_LIBS="" AC_CHECK_LIB(Xext, XShapeQueryVersion, XEXT_LIBS="-lXext",, ${X_PRE_LIBS} ${X11_LIBS}) AC_SUBST(XEXT_LIBS) dnl ========================================================================== dnl Check for Xi, GLUT sometimes uses it dnl We don't crap out if we can't find it though. dnl ========================================================================== XI_LIBS="" AC_CHECK_LIB(Xi, XGetExtensionVersion, XI_LIBS="-lXi",, ${X_PRE_LIBS} ${X11_LIBS}) AC_SUBST(XI_LIBS) dnl ========================================================================== dnl Check for Xt dnl ========================================================================== XT_LIBS="" AC_CHECK_LIB(Xt, XtToolkitInitialize, XT_LIBS="-lXt",, ${X_PRE_LIBS} ${X11_LIBS}) if test "$XT_LIBS" = ""; then AC_MSG_ERROR([The X toolkit library '-lXt' could not be found. Please use the configure iptions '--x-includes=DIR' and '--x-libraries=DIR' to specify the X location. See the 'config.log' file for further diagnostics.]) fi AC_SUBST(XT_LIBS) dnl ========================================================================== dnl Check for Motif dnl I couldn't resist using the most hideously named function in the Motif dnl API in this test, sorry if I've frightened anyone. dnl ========================================================================== XM_LIBS="" AC_CHECK_LIB(Xm, XmRepTypeInstallTearOffModelConverter, XM_LIBS="-lXm" AC_DEFINE(HAVE_MOTIF, 1), AC_DEFINE(HAVE_MOTIF, 0), ${X_PRE_LIBS} ${XPM_LIBS} ${XEXT_LIBS} ${XT_LIBS} ${XI_LIBS} ${X11_LIBS}) if test "$XM_LIBS" = ""; then AC_MSG_ERROR([The Motif library '-lXm' could not be found. Please use the configure options '--with-motif-includes=DIR' and '--with-motif-libraries=DIR' to specify the Xm location. See the 'config.log' file for further diagnostics.]) fi AC_SUBST(XM_LIBS) dnl dnl Check for OpenGL dnl GL_LIBS="" AC_CHECK_LIB(m,pow,[MATHLIB="true"]) if test x"$MATHLIB" != x"true"; then AC_MSG_ERROR([the math library '-lm' could not be found! Please check the installation of math library]) fi if test x"$MATHLIB" = x"true"; then LIBS="$LIBS -lm" SIM_AC_CHECK_OPENGL([OPENGLLIB="true"]) if test x"$OPENGLLIB" = x"true" ; then SIM_AC_CHECK_GLU([GLULIB="true"]) if test x"$GLULIB" = x"true" ; then SIM_CHECK_MOTIF_GLWIDGET([GLWIDGETLIB="true"],GL_LIBS="") XMAKEMOL_GLUT_CHECK() fi fi fi AC_SUBST(GL_LIBS) dnl Checks for other libraries dnl AC_CHECK_LIB(gen,basename,[AC_DEFINE(HAVE_LIBGEN,1) LIBS="${LIBS} -lgen"],) dnl Checks for other header files. AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_FUNC_ALLOCA AC_CHECK_FUNCS(ftime strstr usleep) AC_OUTPUT(Makefile) xmakemol-5.16/install-sh0000755000175000017500000001440610501032643012206 00000000000000#!/bin/sh # # install - install a program, script, or datafile # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xmakemol-5.16/missing0000755000175000017500000001452010501032643011576 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.in; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`$configure_ac'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`$configure_ac'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`$configure_ac'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 xmakemol-5.16/mkinstalldirs0000755000175000017500000000132210501032643013001 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here xmakemol-5.16/animate.c0000644000175000017500000003431110213024625011762 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #if HAVE_FTIME #include #else #include #include #endif /* aro - use following headers if using timeval struct and gettimeofday function below (in case compiler can't find ftime() function). #include #include */ /* #include */ char * gnu_basename (char *); #include #include #include #include #include #include #include #include #ifdef XPM #include #endif #include "globals.h" #include "defs.h" #include "bbox.h" /* wjq */ void echo_to_message_area(char *); void place_dialog_cb (Widget, XtPointer, XtPointer); static int anim_file_type; static int stop_anim; int rot_times; double rot_angle,rot_axis[3]; static Widget stop_b; void animate(Widget parent) { void anim_dlg_cancel_cb(Widget, XtPointer, XtPointer); void anim_save_anim_cb(Widget, XtPointer, XtPointer); void anim_start_anim_cb(Widget, XtPointer, XtPointer); void anim_stop_anim_cb(Widget, XtPointer, XtPointer); void axis_cb(Widget, XtPointer, XtPointer); void scale_cb(Widget, XtPointer, XtPointer); void times_cb(Widget, XtPointer, XtPointer); int n; Widget axis,axis_label,rc,scale,sep,times,times_label; Widget rc_hor, start_b, save_b; XmString title; if(!anim_dialog){ title=XmStringCreateLocalized("Animate selections"); n=0; XtSetArg (args[n],XmNautoUnmanage, False); n++; XtSetArg (args[n],XmNdialogTitle,title); n++; XtSetArg (args[n],XmNwidth,300); n++; anim_dialog=XmCreateMessageDialog(parent,"animate",args,n); XmStringFree(title); rc=XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,anim_dialog, NULL); title=XmStringCreateLocalized("Angle of rotation"); scale = XtVaCreateManagedWidget ("angle", xmScaleWidgetClass, rc, XmNmaximum, 360, XmNminimum, 1, XmNvalue, 2, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(scale, XmNvalueChangedCallback, scale_cb, NULL); rot_angle=2; sep=XmCreateSeparator(rc,"sep",NULL,0); XtManageChild(sep); times_label= XtVaCreateManagedWidget ("Rotate how many times?", xmLabelWidgetClass,rc, XmNalignment, XmALIGNMENT_BEGINNING, NULL); times=XtVaCreateManagedWidget("times",xmTextFieldWidgetClass, rc, NULL); XtAddCallback(times,XmNlosingFocusCallback,times_cb,NULL); XtVaSetValues(times, XmNvalue,"180", NULL); rot_times=180; sep=XmCreateSeparator(rc,"sep",NULL,0); XtManageChild(sep); axis_label= XtVaCreateManagedWidget ("Rotate about which axis?", xmLabelWidgetClass,rc, XmNalignment, XmALIGNMENT_BEGINNING, NULL); axis=XtVaCreateManagedWidget("axis",xmTextFieldWidgetClass, rc, NULL); XtAddCallback(axis,XmNlosingFocusCallback,axis_cb,NULL); XtVaSetValues(axis, XmNvalue,"1 1 1", NULL); rot_axis[0]=1.0;rot_axis[1]=1.0;rot_axis[2]=1.0; sep=XmCreateSeparator(rc,"sep",NULL,0); XtManageChild(sep); /* Pixmap toggle button: set default to false */ rc_hor = XtVaCreateManagedWidget ("rc_hor", xmRowColumnWidgetClass, rc, XmNorientation, XmHORIZONTAL, NULL); start_b = XtVaCreateManagedWidget ("Start", xmPushButtonWidgetClass, rc_hor, NULL); XtAddCallback(start_b, XmNactivateCallback, anim_start_anim_cb, NULL); stop_b = XtVaCreateManagedWidget ("Stop", xmPushButtonWidgetClass, rc_hor, NULL); XtAddCallback(stop_b, XmNactivateCallback, anim_stop_anim_cb, NULL); save_b = XtVaCreateManagedWidget ("Save", xmPushButtonWidgetClass, rc_hor, NULL); XtAddCallback(save_b, XmNactivateCallback,anim_save_anim_cb,NULL); XtAddCallback(anim_dialog, XmNcancelCallback, anim_dlg_cancel_cb,NULL); /* Only cancel available ... */ XtUnmanageChild (XmMessageBoxGetChild(anim_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(anim_dialog, XmDIALOG_HELP_BUTTON)); } XtAddCallback (anim_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(anim_dialog); } void anim_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(anim_dialog); anim_dialog=NULL; } void scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; rot_angle=cbs->value; } void times_cb(Widget widget, XtPointer client_data, XtPointer call_data) { char* times_str; XtVaGetValues(widget,XmNvalue,×_str,NULL); sscanf(times_str,"%d",&rot_times); } void axis_cb(Widget widget, XtPointer client_data, XtPointer call_data) { char* axis_str; XtVaGetValues(widget,XmNvalue,&axis_str,NULL); sscanf(axis_str,"%lf %lf %lf",&rot_axis[0],&rot_axis[1],&rot_axis[2]); } void anim_start_anim_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *, double, Boolean, Boolean); int i; char string[1024]; double phi = rot_angle*PI/180.0, time, last_time = 0.0; XEvent event; #ifdef HAVE_FTIME static struct timeb tb; #else struct timeval tv; #endif /* aro - if xmakemol fails to compile due to use of ftime function, try uncommenting lines using struct timeval tv, and comment out lines using struct timeb tb. Also need to uncomment appropiate #include lines above. */ /* struct timeval tv; */ stop_anim=0; if(rot_times == 0) { return; } /* Cycle */ for(i=0;i 0.5) || (i == (rot_times - 1))) { sprintf(string, "Animation: frame %d of %d", i+1, rot_times); echo_to_message_area(string); last_time = time; } XmUpdateDisplay(toplevel); /* handle all expose events during loop */ /* Handle events: - pressing Animate button will stop animation */ while(XCheckMaskEvent (XtDisplay(toplevel), ButtonPressMask | ButtonReleaseMask, &event)) { if(event.xany.window == XtWindow(stop_b)) { XtDispatchEvent(&event); } } XFlush(XtDisplay(toplevel)); if((stop_anim == 1)) { sprintf(string, "Animation: frame %d of %d", i+1, rot_times); echo_to_message_area(string); return; } } } void anim_stop_anim_cb(Widget widget, XtPointer client_data, XtPointer call_data) { stop_anim = 1; } void anim_save_anim_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void anim_file_type_cb(Widget, XtPointer, XtPointer); void save_pix_anim_cb(Widget, XtPointer, XtPointer); XmString get_current_directory(void); static Widget pix_anim_dialog,anim_file_type_w; XmString title,save_asc; #ifdef XPM XmString save_xpm; #endif if(!pix_anim_dialog){ pix_anim_dialog=XmCreateFileSelectionDialog (toplevel,"pix_anim_sel",NULL,0); title=XmStringCreateLocalized("Save Animation"); XtVaSetValues(pix_anim_dialog, XmNdialogTitle, title, NULL); save_asc=XmStringCreateLocalized("XYZ"); #ifdef XPM save_xpm=XmStringCreateLocalized("XPM"); #endif title=XmStringCreateLocalized("File type"); anim_file_type_w=XmVaCreateSimpleOptionMenu (pix_anim_dialog,"File type",title,'F', 0, anim_file_type_cb, XmVaPUSHBUTTON, save_asc, 'A', NULL, NULL, #ifdef XPM XmVaPUSHBUTTON, save_xpm, 'X', NULL, NULL, #endif NULL); anim_file_type=0; XtManageChild(anim_file_type_w); XmStringFree(save_asc); #ifdef XPM XmStringFree(save_xpm); #endif XmStringFree(title); XtAddCallback (pix_anim_dialog, XmNokCallback, save_pix_anim_cb, NULL); XtAddCallback (pix_anim_dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); /* No help available ... */ XtUnmanageChild (XmFileSelectionBoxGetChild(pix_anim_dialog,XmDIALOG_HELP_BUTTON)); } /* Change to a directory that was just recently operated in any of the file selection dialogs and refresh the file list so that newly created files do show up */ XtVaSetValues (pix_anim_dialog, XmNdirectory, get_current_directory(), NULL); XmFileSelectionDoSearch (pix_anim_dialog, NULL); XtManageChild(pix_anim_dialog); XtPopup(XtParent(pix_anim_dialog),XtGrabNone); } void save_pix_anim_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void set_current_directory (XmString dir); void write_anim_file(char *); char *file_name; XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data; if (cbs) { if (!XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &file_name)) return; /* internal error */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); write_anim_file(file_name); XtFree(file_name); /* free allocated data from XmStringGetLtoR() */ } XtUnmanageChild(widget); } void write_anim_file(char *anim_file_name) { void write_anim_asc_file(char *); #ifdef XPM void write_anim_xpm_files(char *); #endif if(anim_file_type == 0){ write_anim_asc_file(anim_file_name); #ifdef XPM }else if(anim_file_type == 1){ write_anim_xpm_files(anim_file_name); #endif } } void write_anim_asc_file(char *anim_file_name) { void change_frame (int, Boolean, Boolean); void rotate_atoms (double *, double, Boolean, Boolean); struct frame * get_selected_frame (void); int count_visible_atoms_in_frame (struct frame *); int i, j, frame_visible_atoms; char buf[BUFSIZ]; double phi = rot_angle * PI / 180.0; FILE *out_file; struct frame *this_frame; if ((out_file = fopen (anim_file_name, "w")) == NULL) { sprintf (buf, "Cannot open %s for write", anim_file_name); echo_to_message_area (buf); return; } this_frame = get_selected_frame (); frame_visible_atoms = count_visible_atoms_in_frame (this_frame); for (i = 0; i < rot_times; i++) { atoms_sorted = 0; /* Depths _may_ have changed */ rotate_atoms (rot_axis, phi, False, True); fprintf (out_file, "%d\n", frame_visible_atoms); fprintf (out_file, "Frame %d\n", i + 1); for (j = 0; j < no_atoms; j++) { if (atoms[j].visi == 1) { fprintf (out_file, "%2s %12.6f %12.6f %12.6f\n", atoms[j].label, atoms[j].x,atoms[j].y, atoms[j].z); } } XmUpdateDisplay (toplevel); /* handle all expose events during loop */ } fclose (out_file); if (rot_times == 1) { sprintf (buf, "File %s written: %d frame (XYZ)", gnu_basename(anim_file_name), rot_times); } else { sprintf (buf, "File %s written: %d frames (XYZ)", gnu_basename(anim_file_name), rot_times); } echo_to_message_area (buf); /* Change back to where we were before */ change_frame (frame_no, False, False); } #ifdef XPM void write_anim_xpm_files(char *anim_file_name) { #ifdef GL void set_gl_copy_canvas (int); #endif int write_xpm(char *, int); void rotate_atoms(double *, double, Boolean, Boolean); int i, success = 1; char buf[BUFSIZ], pixmap_file[1024]; double phi = rot_angle * PI / 180.0; #ifdef GL set_gl_copy_canvas (1); #endif for(i = 0; i < rot_times; i++) { redraw = 1; atoms_sorted = 0; /* Depths _may_ have changed */ rotate_atoms(rot_axis, phi, 1, True); XmUpdateDisplay(toplevel); /* handle all expose events during loop */ sprintf(pixmap_file, "%s.%d.xpm", anim_file_name, (i + 1)); /* Write the `canvas_pm' to the file. */ if (write_xpm(pixmap_file, 1) == /*failure*/0) { /* There was not enough memory for writing the file or the file did not open. Luckily, the error message has been already printed to the message area so we do not need to known which was it. We just flag the error so that the upcoming status message does not make the error message disappear from the message area. */ success = /*failure*/0; } } #ifdef GL set_gl_copy_canvas (0); #endif if (success) { if(rot_times == 1) { sprintf(buf, "File %s.1.xpm written", gnu_basename(anim_file_name)); } else { sprintf(buf, "Files %s.1..%d.xpm written", gnu_basename(anim_file_name), rot_times); } echo_to_message_area(buf); } } #endif void anim_file_type_cb(Widget widget, XtPointer client_data, XtPointer call_data) { anim_file_type= (int) client_data; } xmakemol-5.16/basename.c0000644000175000017500000000243107362530724012132 00000000000000/* Return the name-within-directory of a file name. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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.1 of the License, or (at your option) any later version. The GNU C 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 the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #ifndef _LIBC /* We cannot generally use the name `basename' since XPG defines an unusable variant of the function but we cannot use it. */ # define basename gnu_basename #endif char * basename (filename) const char *filename; { char *p = strrchr (filename, '/'); return p ? p + 1 : (char *) filename; } xmakemol-5.16/bbox.c0000644000175000017500000003327310664010201011277 00000000000000/* Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __BBOX_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" #include "bbox.h" #include "defs.h" #ifdef GL #include "gl_funcs.h" /* aro - for visinfo */ #endif /* GL */ #include "view.h" static int top_point_index; static Boolean bbox_above_flag; void draw_bbox(Boolean dbb_arg) { void draw_bbox_line(int, int); int i; double top_point; bbox_above_flag = dbb_arg; /* Find the point of the bounding box with the greatest value of z */ top_point = 0; for(i = 0; i < 8 ; i++) { if(bbox.v[i][2] > top_point) { top_point = bbox.v[i][2]; top_point_index = i; } } /* Look at the comment in draw_bbox_faces to see what the lines refer to */ draw_bbox_line(0,1); draw_bbox_line(0,2); draw_bbox_line(0,4); draw_bbox_line(1,3); draw_bbox_line(1,5); draw_bbox_line(2,3); draw_bbox_line(2,6); draw_bbox_line(3,7); draw_bbox_line(4,5); draw_bbox_line(4,6); draw_bbox_line(5,7); draw_bbox_line(6,7); } void draw_bbox_line(int i, int j) { void convert_to_canvas_coords(double *, double *, Boolean); double get_z_depth(void); int bbox_x1, bbox_x2, bbox_y1, bbox_y2; double local_z_depth; local_z_depth = get_z_depth(); /* Check that we can draw the points */ if(depth_is_on == 1) { if(((local_z_depth - bbox.v[i][2]) < Z_TOL) || ((local_z_depth - bbox.v[j][2]) < Z_TOL)) { return; } } if(bbox_above_flag == 1) { /* Draw any lines to the topmost point -- these are drawn _after_ atoms and bonds */ if((i != top_point_index) && (j != top_point_index)) { /* Do nothing */ return; } } else { /* Draw any lines not to the topmost point -- these are drawn _before_ atoms and bonds */ if((i == top_point_index) || (j == top_point_index)) { return; } } { int k; double xyz_in[3]; double xy_out[2]; /* Convert the Cartesian coordinates from the ith point to canvas coordinates */ for(k = 0; k < 3; k++) { xyz_in[k] = bbox.v[i][k]; } convert_to_canvas_coords(xyz_in, xy_out, 0); bbox_x1 = (int) xy_out[0]; bbox_y1 = (int) xy_out[1]; /* Convert the Cartesian coordinates from the jth point to canvas coordinates */ for(k = 0; k < 3; k++) { xyz_in[k] = bbox.v[j][k]; } convert_to_canvas_coords(xyz_in, xy_out, 0); bbox_x2 = (int) xy_out[0]; bbox_y2 = (int) xy_out[1]; } gcv.foreground=8; gcv.line_width=2; gcv.line_style=LineSolid; XChangeGC(display,gc,GCForeground|GCLineWidth|GCLineStyle,&gcv); XDrawLine(display,canvas_pm,gc,bbox_x1,bbox_y1,bbox_x2,bbox_y2); } void draw_bbox_faces(void) { void draw_bbox_face(int, int, int, int); /* * The points on the square refer to a numbering scheme as * illustrated below --- this should make it easier to see which * face is being drawn by which call to draw_bbox_face. * * 4------------------5 * /| /| * / | / | * 0------------------1 | * | | | | * | | | | * | | | | * | | | | * | 6---------------|--7 * | / | / * |/ |/ * 2------------------3 */ draw_bbox_face(0,1,3,2); draw_bbox_face(4,5,7,6); draw_bbox_face(0,2,6,4); draw_bbox_face(1,3,7,5); draw_bbox_face(0,1,5,4); draw_bbox_face(2,3,7,6); } void draw_bbox_face(int i, int j, int k, int l) { void convert_to_canvas_coords(double *, double *, Boolean); double get_z_depth(void); static int color_parsed; double local_z_depth, xyz_out[2]; Colormap cmap; static XColor xcolor; XPoint box_points[4]; local_z_depth = get_z_depth(); /* Check that we can draw the points */ if(depth_is_on == 1) { if(((local_z_depth - bbox.v[i][2]) < Z_TOL) || ((local_z_depth - bbox.v[j][2]) < Z_TOL) || ((local_z_depth - bbox.v[k][2]) < Z_TOL) || ((local_z_depth - bbox.v[l][2]) < Z_TOL)) { return; } } /* aro - use colormap specific to canvas and visual, default colormap may give inaccurate colors on some displays */ #ifdef GL cmap = XCreateColormap(display, XtWindow(canvas), visinfo->visual, AllocNone); #else /* GL */ cmap = DefaultColormap(display,screen_num); #endif /* GL */ if((color_parsed==0)&&(strcmp(bb_color,"")!=0)){ XParseColor(display,cmap,bb_color,&xcolor); if(!XAllocColor(display,cmap,&xcolor)){ printf("Could not allocate colour %20s (draw_bbox_face)\n", bb_color); } color_parsed=1; } gcv.foreground=xcolor.pixel; XChangeGC(display,gc,GCForeground,&gcv); convert_to_canvas_coords(bbox.v[i], xyz_out, 0); box_points[0].x = (int) xyz_out[0]; box_points[0].y = (int) xyz_out[1]; convert_to_canvas_coords(bbox.v[j], xyz_out, 0); box_points[1].x = (int) xyz_out[0]; box_points[1].y = (int) xyz_out[1]; convert_to_canvas_coords(bbox.v[k], xyz_out, 0); box_points[2].x = (int) xyz_out[0]; box_points[2].y = (int) xyz_out[1]; convert_to_canvas_coords(bbox.v[l], xyz_out, 0); box_points[3].x = (int) xyz_out[0]; box_points[3].y = (int) xyz_out[1]; XFillPolygon(display,canvas_pm,gc,box_points,4,Complex,CoordModeOrigin); #ifdef GL XFreeColormap(display, cmap); #endif /* GL */ } void rotate_bbox(double *axis, double phi) { void rotate(double *); void set_rotate_axis(double *); void set_rotate_angle(double); void set_rotate_origin(double *); struct frame * get_selected_frame (); int count_visible_atoms_in_frame (struct frame *); int i, frame_visible_atoms; struct frame *this_frame; this_frame = get_selected_frame (); frame_visible_atoms = count_visible_atoms_in_frame (this_frame); if((frame_visible_atoms == 0) || (bbox_flag == 0)) { return; } set_rotate_axis (axis); set_rotate_angle (phi); set_rotate_origin (NULL); for(i = 0; i < 8; i++) { rotate (bbox.v[i]); } } void update_bbox (void) { void update_normal_bbox (void); #ifdef GL int crystal_p (void); int render_using_gl_p (void); void update_crystal_bbox (bounding_box *bbox); #endif if (bbox_flag == 0) { return; } #ifdef GL if ((! render_using_gl_p ()) || (! crystal_p ())) { update_normal_bbox (); } else { /* We only render crystal cell bbox when rendering w/ OpenGL */ update_crystal_bbox (&bbox); } #else /* GL */ update_normal_bbox (); #endif /* GL */ } /* wjq --> */ void get_automatic_bbox (void) { double get_atom_scale (void); #ifdef GL double gl_get_rendered_atom_size (int); int render_using_gl_p (void); #endif /* GL */ void get_gx_coords (void); struct frame * get_selected_frame (void); int count_visible_atoms_in_frame (struct frame *); int i, frame_visible_atoms; struct frame *this_frame; Boolean first_values_set; /* Get the gx coordinates */ get_gx_coords (); /* Get the bbox coords in the global axis frame */ this_frame = get_selected_frame (); frame_visible_atoms = count_visible_atoms_in_frame (this_frame); if (frame_visible_atoms == 0) { bbox.x_max = 0; bbox.x_min = 0; bbox.y_max = 0; bbox.y_min = 0; bbox.z_max = 0; bbox.z_min = 0; } first_values_set = 0; for (i = 0; i < no_atoms; i++) { double atom_size = 0; if (atoms[i].visi == 1) { /* Bound only *visible* atoms */ #ifdef GL if (render_using_gl_p ()) { atom_size = gl_get_rendered_atom_size (i); } else { if (atom_flag == 1) { atom_size = atoms[i].cov_rad * get_atom_scale (); } else { atom_size = 0; } } #else if (atom_flag == 1) { atom_size = atoms[i].cov_rad * get_atom_scale (); } else { atom_size = 0; } #endif /* GL */ if (first_values_set == 0) { bbox.x_max = atoms[i].g[0] + atom_size; bbox.y_max = atoms[i].g[1] + atom_size; bbox.z_max = atoms[i].g[2] + atom_size; bbox.x_min = atoms[i].g[0] - atom_size; bbox.y_min = atoms[i].g[1] - atom_size; bbox.z_min = atoms[i].g[2] - atom_size; first_values_set = 1; } if ((atoms[i].g[0] - atom_size) < bbox.x_min) { bbox.x_min = (atoms[i].g[0] - atom_size); } else if ((atoms[i].g[0] + atom_size) > bbox.x_max) { bbox.x_max = (atoms[i].g[0] + atom_size); } if ((atoms[i].g[1] - atom_size) < bbox.y_min) { bbox.y_min = (atoms[i].g[1] - atom_size); } else if ((atoms[i].g[1] + atom_size) > bbox.y_max) { bbox.y_max = (atoms[i].g[1] + atom_size); } if ((atoms[i].g[2] - atom_size) < bbox.z_min) { bbox.z_min = (atoms[i].g[2] - atom_size); } else if ((atoms[i].g[2] + atom_size) > bbox.z_max) { bbox.z_max = (atoms[i].g[2] + atom_size); } } } bbox.x_min += bbox_by_hand.x_min; bbox.x_max += bbox_by_hand.x_max; bbox.y_min += bbox_by_hand.y_min; bbox.y_max += bbox_by_hand.y_max; bbox.z_min += bbox_by_hand.z_min; bbox.z_max += bbox_by_hand.z_max; bbox.v[0][0] = bbox.x_max; bbox.v[0][1] = bbox.y_min; bbox.v[0][2] = bbox.z_max; bbox.v[1][0] = bbox.x_max; bbox.v[1][1] = bbox.y_max; bbox.v[1][2] = bbox.z_max; bbox.v[2][0] = bbox.x_max; bbox.v[2][1] = bbox.y_min; bbox.v[2][2] = bbox.z_min; bbox.v[3][0] = bbox.x_max; bbox.v[3][1] = bbox.y_max; bbox.v[3][2] = bbox.z_min; bbox.v[4][0] = bbox.x_min; bbox.v[4][1] = bbox.y_min; bbox.v[4][2] = bbox.z_max; bbox.v[5][0] = bbox.x_min; bbox.v[5][1] = bbox.y_max; bbox.v[5][2] = bbox.z_max; bbox.v[6][0] = bbox.x_min; bbox.v[6][1] = bbox.y_min; bbox.v[6][2] = bbox.z_min; bbox.v[7][0] = bbox.x_min; bbox.v[7][1] = bbox.y_max; bbox.v[7][2] = bbox.z_min; } void get_file_bbox (void) { int i; for (i = 0; i < 8; i++) { bbox.v[i][0] = file_bbox.v[i][0]; bbox.v[i][1] = file_bbox.v[i][1]; bbox.v[i][2] = file_bbox.v[i][2]; } } void update_normal_bbox (void) { /* If this function has been called it means that the relative positions of atoms have changed or that atom visibilities have been toggled or the size of the atoms have changed. We need to convert the current atomic positions back into the fixed axis frame then calculate the coordinate (in this frame) of the bounding box. Then we need to rotate the bbox back into the current axis frame */ double get_angle_axis (double *); void get_automatic_bbox (void); void get_file_bbox (void); struct frame * get_selected_frame (void); void rotate_bbox (double *,double); void set_rotate_origin(double *); int i, j; double axis[3], phi; struct frame *this_frame; this_frame = get_selected_frame (); if ((bbox_type == AUTOMATIC) || (! this_frame->bbox_available)) { get_automatic_bbox (); /* Rotate back into the local axis frame */ for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { angle_axis_matrix[i][j] = global_matrix[i][j]; } } phi = get_angle_axis (axis); rotate_bbox (axis, phi); } else { get_file_bbox (); } } void get_gx_coords(void) { double get_angle_axis(double *); void rotate(double *); void set_rotate_axis(double *); void set_rotate_angle(double); void set_rotate_origin(double *); int i,j; double phi,axis[3]; /* We put the *transpose* of the global_matrix matrix into angle_axis_matrix. Notice that the indices are [j][i], not [i][j] */ for(i = 0; i < 3; i++) { for(j = 0; j < 3; j++) { angle_axis_matrix[j][i] = global_matrix[i][j]; } } phi = get_angle_axis(axis); set_rotate_axis(axis); set_rotate_angle(phi); set_rotate_origin(NULL); /* Put the local axis coords into the global axis variables */ for(i = 0; i < no_atoms; i++) { atoms[i].g[0] = atoms[i].x; atoms[i].g[1] = atoms[i].y; atoms[i].g[2] = atoms[i].z; } /* Now rotate the global coords into the global axis frame */ for(i = 0; i < no_atoms; i++) { rotate(atoms[i].g); } } xmakemol-5.16/canvas.c0000644000175000017500000003430510664010177011631 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "bonds.h" #include "defs.h" #include "draw.h" #ifdef GL #include "gl_funcs.h" /* aro */ #endif /* GL */ #include "globals.h" #include "view.h" #ifdef XPM #include #include "xm_logo.h" #endif static XColor fg_color; #ifdef XPM static int show_logo = 1; static int xm_logo_read = 0; static Pixmap xm_logo_pix; #endif XColor get_bg_color (void) { return (fg_color); } #ifdef XPM void disable_show_logo(void) { show_logo = 0; } #endif void canvas_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void draw_region (void); #ifdef XPM void draw_splash_screen (void); #endif Boolean region_active_p (void); void x_render (void); #ifdef GL Boolean render_using_gl_p (void); void set_render_using_gl (Boolean); void gl_render (void); #endif /* GL */ GC gc; if ((inhibit_canvas_callback) || (! XtIsRealized(canvas))) { /* Do nothing if inhibit_canvas_callback is true or canvas isn't realized */ return; } XtVaGetValues (canvas, XmNuserData, &gc, NULL); if (! canvas_pm) { canvas_pm = XCreatePixmap (display, XtWindow (canvas), canvas_width, canvas_height, #ifdef GL visinfo->depth #else /* GL */ screen_depth #endif ); redraw = 1; } if (redraw) { #ifdef GL if (render_using_gl_p ()) { gl_render (); } else { x_render (); } #else /* GL */ x_render (); #endif /* GL */ redraw = 0; } if (no_atoms > 0) { #ifdef GL /* Under GL, we render directly onto XtWindow (canvas); therefore do nothing if rendering with GL */ if (! render_using_gl_p ()) { /* Copy from pixmap -> window */ XCopyArea (display, canvas_pm, XtWindow (canvas), gc, 0, 0, canvas_width, canvas_height, 0, 0); } #else /* GL */ /* Copy from pixmap -> window */ XCopyArea (display, canvas_pm, XtWindow (canvas), gc, 0, 0, canvas_width, canvas_height, 0, 0); #endif /* GL */ /* Do any drawing which doesn't require atom/bond information */ if (region_active_p() == 1) { draw_region (); } } else /* no_atoms == 0 */ { #ifdef XPM draw_splash_screen (); #else XFillRectangle (display, XtWindow (canvas), gc, 0, 0, canvas_width, canvas_height); #endif } } void x_render (void) { void draw_atom(int); void draw_atom_numbers_and_symbols(int); void draw_axes(void); void draw_bbox(Boolean); void draw_bbox_faces(void); void draw_bbox_face(int, int, int, int); void draw_bond(int, int); void draw_hbond(int, int); void draw_vector(int, int); Boolean mouse_motion_p (void); Boolean outline_mode_p (void); double get_vector_scale(void); double get_z_depth(void); void sort_atoms(void); void bg_color_init(void);/* aro */ /* aro - color_parsed moved to bg_color_parsed in globals.h so the background color can be changed in the program */ int i,j,si,sj; double local_z_depth, vector_scale; struct node *ptr; if((! mouse_motion_p ()) || (! outline_mode_p ())){ sort_atoms(); } /* aro - moved some code to bg_color_init function so we can initialize the background color in gl if we are disabling x-rendering */ if(strcmp(bg_color,"")!=0){ if(bg_color_parsed == 0){ bg_color_init(); bg_color_parsed=1; } XSetForeground(display,gc,fg_color.pixel); }else{ XSetForeground(display,gc,WhitePixelOfScreen(screen_ptr)); } XFillRectangle(display,canvas_pm,gc,0,0,canvas_width,canvas_height); if(bbox_flag && (no_atoms > 0)){ if((! mouse_motion_p ()) || (! outline_mode_p ())){ draw_bbox_faces(); } draw_bbox(0); /* draw stuff 'below' */ } local_z_depth = get_z_depth(); vector_scale = get_vector_scale(); for(i=0;i 0)) { /* Draw the vector if it points below the atom and is drawable */ for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if((atoms[si].v[j][2] < 0) && (local_z_depth - (atoms[si].z + (vector_scale * atoms[si].v[j][2]))) > Z_TOL) { draw_vector(si, j); } } } /* Draw the atom if infront of 'eye' ... */ if(((local_z_depth - atoms[si].z) > Z_TOL) || (depth_is_on == 0)) { if(atom_flag == 1) { /* Draw if visible _or_ if view_ghost_atoms is true */ if((atoms[si].visi == 1) || (view_ghost_atoms == 1) ) { draw_atom(si); } } else { /* Draw if invisible _and_ view_ghost_atoms is true */ if((atoms[si].visi == 0) && (view_ghost_atoms == 1) ) { draw_atom(si); } } } if((vector_flag == 1) && (atoms[si].has_vector > 0)) { /* Draw the vector if it points above the atom and is drawable */ for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if((atoms[si].v[j][2] > 0) && (local_z_depth - (atoms[si].z + (vector_scale * atoms[si].v[j][2]))) > Z_TOL) { draw_vector(si, j); } } } if((! mouse_motion_p ()) || (! outline_mode_p ())){ if(bond_flag == 1) { /* Draw the bonds */ ptr = bond_adjacency_list[si]; while(ptr != NULL) { sj = (ptr->v); if((depth_is_on == 0) || (((local_z_depth - atoms[si].z) > Z_TOL) && ((local_z_depth - atoms[sj].z) > Z_TOL))) { if(atoms[si].visi && atoms[sj].visi) { if(atoms[si].z<=atoms[sj].z) { draw_bond(si,sj); } } } ptr = ptr->next; } } /* Draw the H-bonds ... */ if((any_hydrogen == 1) && (hbond_flag == 1)) { /* ... if there are any */ ptr = hbond_adjacency_list[si]; while(ptr != NULL) { sj = (ptr->v); if((depth_is_on == 0) || (((local_z_depth - atoms[si].z) > Z_TOL) && ((local_z_depth - atoms[sj].z) > Z_TOL))) { if(atoms[si].visi && atoms[sj].visi) { if(atoms[si].z<=atoms[sj].z) { draw_hbond(si,sj); } } } ptr = ptr->next; } } gcv.foreground=BlackPixelOfScreen(XtScreen(canvas)); XChangeGC(display,gc,GCForeground, &gcv); if(atoms[si].visi == 1) { draw_atom_numbers_and_symbols(si); } } } if(axes_flag){ draw_axes(); } if(bbox_flag && (no_atoms > 0)){ draw_bbox(1); /* draw stuff 'above' */ } } /* The scaling of the coordinates on the canvas depends on two factors: (1) canvas_scale - this is determined by the size of the system on reading in the file. Afterwards, this can be modified by changing the size of the canvas or via the perspective dialog (Choose scale). This is a transient (!) constant, ie, is the same for all coordinates (atoms/bond points) in a frame. (2) depth_scale - this is determined by the distance of the eye from the origin (Z_d). This is also set each time a file is read in. Unlike canvas_scale, this is different for each value of z and is given by Z_d/(Z_d - z). */ static double canvas_scale, depth_scale; /* See above */ static double z_depth; /* Referred to as Z_d above */ void set_canvas_scale(double input) { canvas_scale = input; } double get_canvas_scale(void) { return(canvas_scale); } void set_depth_scale(double input) { depth_scale = input; } double get_depth_scale(double z_val) { if(depth_is_on == 1) { depth_scale = z_depth/(z_depth - z_val); } else { depth_scale = 1.0; } return (depth_scale); } void update_depth_scale(double z_val) { if(depth_is_on == 1) { depth_scale = z_depth/(z_depth - z_val); } else { depth_scale = 1.0; } } void set_z_depth(double input) { z_depth = input; } double get_z_depth(void) { return(z_depth); } /* The canvas coordinates (X,Y) start at the top left of the window. For The plotted coordinates (x,y) we want the origin to be at the center. In addition, Y is _antiparallel_ to y. ^ +---------------+---------------+-----> X | | | | | | | | | | | | c | | | a | y ^ | n | | | v | | | a | | | s +---------------+------>--------+ | | x | h | | | e | | | i | | | g | | | h | | | t | | | | | | | v +---------------+ --------------+ | |<--------canvas_width----------> | v Y */ /* This takes as input a pointer to a vector xyz_in[3] representing a point in real space and returns a pointer to a vector xy_out[2] representing a point in canvas space */ void convert_to_canvas_coords(double *xyz_in, double *xy_out, Boolean ps_corr) { void update_depth_scale(double); double overall_scale_factor; /* This sets depth_scale; depends on z */ update_depth_scale(xyz_in[2]); overall_scale_factor = depth_scale * canvas_scale; xy_out[0] = (canvas_width / 2.0) + (overall_scale_factor * xyz_in[0]); if(ps_corr == 0) { xy_out[1] = (canvas_height / 2.0) - (overall_scale_factor * xyz_in[1]); } else { xy_out[1] = (canvas_height / 2.0) + (overall_scale_factor * xyz_in[1]); } } /* aro--> */ void bg_color_init(void) { /* aro - use colormap specific to canvas and visual, default colormap may give inaccurate colors on some displays */ #ifdef GL Colormap cmap = XCreateColormap(display, XtWindow(canvas), visinfo->visual, AllocNone); #else /* GL */ Colormap cmap = DefaultColormap(display,screen_num); #endif /* GL */ XParseColor(display,cmap,bg_color,&fg_color); if(!XAllocColor(display,cmap,&fg_color)){ printf("Could not allocate colour %20s (canvas_cb)\n", bg_color); } XParseColor (display, cmap, sel_color_name, &sel_color); if (! XAllocColor (display,cmap,&sel_color)) { printf("Could not allocate colour %20s (bg_color_init)\n", sel_color_name); } #ifdef GL XFreeColormap(display, cmap); #endif /* GL */ } /* <--aro */ #ifdef XPM void draw_splash_screen (void) { XpmAttributes xpm_attrib; #ifdef GL Colormap cmap = XCreateColormap (display, XtWindow (canvas), visinfo->visual, AllocNone); #else Colormap cmap = DefaultColormap (display, screen_num); #endif xpm_attrib.valuemask = XpmDepth | XpmVisual | XpmColormap; #ifdef GL xpm_attrib.depth = visinfo->depth; xpm_attrib.visual = visinfo->visual; #else xpm_attrib.depth = screen_depth; xpm_attrib.visual = DefaultVisual (display, screen_num); /* Correct? */ #endif xpm_attrib.colormap = cmap; if (xm_logo_read == 0) { xm_logo_read = 1; XpmCreatePixmapFromData (display, XtWindow (canvas), xm_logo, &xm_logo_pix, NULL, &xpm_attrib); if(! xm_logo_pix) { /* We'd better not try and display it */ show_logo = 0; } } if (show_logo) { XCopyArea (display, xm_logo_pix, XtWindow (canvas), gc, 0, 0, canvas_width, canvas_height, 0, 0); } } #endif /* XPM */ xmakemol-5.16/control.c0000644000175000017500000004420710213024624012030 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.h" #include "globals.h" void echo_to_message_area(char *); void place_dialog_cb (Widget, XtPointer, XtPointer); enum perspective_types {PERSPECTIVE_ALL, PERSPECTIVE_CURRENT}; static enum perspective_types perspective_type = PERSPECTIVE_ALL; static Widget d_scale, v_scale; char string[BUFSIZ]; double deg_to_rad=(double)(180.0/PI); void cont_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void animate(Widget); void make_frame_dlg(Widget); void make_pers_dlg(Widget); void measure(Widget); int item_no = (int) client_data; switch(item_no){ case 0: make_frame_dlg(main_w); break; case 1: animate(main_w); break; case 2: measure(main_w); break; case 3: make_pers_dlg(main_w); break; } } void measure(Widget parent) { void meas_dlg_cancel_cb(Widget, XtPointer, XtPointer); void sel_reset_cb(Widget, XtPointer, XtPointer); void select_atom_cb(Widget, XtPointer, XtPointer); void update_lengths_dialog(Boolean); int i,j,k,w,n=0; static Widget meas_rc[6],meas_frame[4]; Widget sep,select_atom_label_w,select_atom_w,sel_reset_w; XmString label=XmStringCreateLocalized("Measure"); if(!meas_dialog){ XtSetArg (args[n],XmNdialogTitle, label); n++; XtSetArg (args[n],XmNautoUnmanage, False); n++; XtSetArg (args[n],XmNdefaultPosition, False); n++; meas_dialog=(Widget)XmCreateMessageDialog(parent, "lengths", args, n); label=XmStringCreateLocalized(" "); meas_rc[0] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_dialog, XmNorientation, XmVERTICAL, NULL); meas_frame[0] = XtVaCreateManagedWidget ("frame1", xmFrameWidgetClass, meas_rc[0], XmNshadowType, XmSHADOW_IN, NULL); meas_rc[1] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_frame[0], XmNorientation, XmVERTICAL, NULL); XtVaCreateManagedWidget ("Label X Y Z Type No.", xmLabelWidgetClass,meas_rc[1], XmNalignment, XmALIGNMENT_BEGINNING, NULL); if(!meas_label_w){ meas_label_w=(Widget *)malloc(15*sizeof(Widget)); } w=0; for(i=0;i<4;i++){ meas_label_w[w] = XtVaCreateManagedWidget ("dim", xmLabelWidgetClass,meas_rc[1], XmNlabelString, label, NULL); w++; } meas_rc[2] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_rc[0], XmNorientation, XmHORIZONTAL, NULL); meas_frame[1] = XtVaCreateManagedWidget ("frame1", xmFrameWidgetClass, meas_rc[2], XmNshadowType, XmSHADOW_IN, NULL); meas_rc[3] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_frame[1], XmNorientation, XmVERTICAL, NULL); XtVaCreateManagedWidget (" Lengths", xmLabelWidgetClass,meas_rc[3], XmNalignment, XmALIGNMENT_BEGINNING, NULL); for(i=0;i<3;i++){ for(j=i+1;j<4;j++){ meas_label_w[w] = XtVaCreateManagedWidget ("dim", xmLabelWidgetClass,meas_rc[3], XmNlabelString, label, NULL); w++; } } meas_rc[4] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_rc[2] , XmNorientation, XmVERTICAL, NULL); meas_frame[2] = XtVaCreateManagedWidget ("frame1", xmFrameWidgetClass, meas_rc[4], XmNshadowType, XmSHADOW_IN, NULL); meas_rc[5] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_frame[2] , XmNorientation, XmVERTICAL, NULL); XtVaCreateManagedWidget (" Angles", xmLabelWidgetClass,meas_rc[5], XmNalignment, XmALIGNMENT_BEGINNING, NULL); for(i=0;i<2;i++){ for(j=i+1;j<3;j++){ for(k=j+1;k<4;k++){ meas_label_w[w] = XtVaCreateManagedWidget ("dim", xmLabelWidgetClass,meas_rc[5], XmNlabelString, label, NULL); w++; } } } meas_frame[3] = XtVaCreateManagedWidget ("frame1", xmFrameWidgetClass, meas_rc[4], XmNshadowType, XmSHADOW_IN, NULL); meas_rc[5] = XtVaCreateManagedWidget ("lengths", xmRowColumnWidgetClass,meas_frame[3] , XmNorientation, XmVERTICAL, NULL); XtVaCreateManagedWidget (" Torsion", xmLabelWidgetClass,meas_rc[5], XmNalignment, XmALIGNMENT_BEGINNING, NULL); meas_label_w[w] = XtVaCreateManagedWidget ("dim", xmLabelWidgetClass,meas_rc[5], XmNlabelString, label, NULL); XmStringFree(label); sep=XmCreateSeparator(meas_rc[0],"sep",NULL,0); XtManageChild(sep); select_atom_label_w=XtVaCreateManagedWidget ("Select atom:", xmLabelWidgetClass,meas_rc[0], XmNalignment, XmALIGNMENT_BEGINNING, NULL); select_atom_w=XtVaCreateManagedWidget ("select",xmTextFieldWidgetClass,meas_rc[0], NULL); XtAddCallback(select_atom_w,XmNactivateCallback,select_atom_cb,NULL); sep=XmCreateSeparator(meas_rc[0],"sep",NULL,0); XtManageChild(sep); sel_reset_w=XtVaCreateManagedWidget ("Unselect all atoms",xmPushButtonWidgetClass,meas_rc[0],NULL); XtAddCallback(sel_reset_w,XmNactivateCallback,sel_reset_cb,NULL); /* If the user selects cancel, just destroy the meas_dialog */ XtAddCallback((Widget)meas_dialog, XmNcancelCallback, meas_dlg_cancel_cb, NULL); /* XtUnmanageChild (XmMessageBoxGetChild(meas_dialog,XmDIALOG_OK_BUTTON)); */ /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(meas_dialog,XmDIALOG_HELP_BUTTON)); update_lengths_dialog(True); } XtAddCallback (meas_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(meas_dialog); XtPopup(XtParent(meas_dialog), XtGrabNone); } void meas_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(meas_dialog); meas_dialog=NULL; } double get_length(int l, int m) { double x, y, z, distance; x = atoms[l].x - atoms[m].x; y = atoms[l].y - atoms[m].y; z = atoms[l].z - atoms[m].z; distance = sqrt ((x * x) + (y * y) + (z * z)); return (distance); } double get_angle(int l, int m, int n) { double dot_product(double *, double *); void normalize_vec(double *); double a[3],b[3],angle; /* work out angle */ a[0]=atoms[l].x-atoms[m].x; a[1]=atoms[l].y-atoms[m].y; a[2]=atoms[l].z-atoms[m].z; normalize_vec(a); b[0]=atoms[n].x-atoms[m].x; b[1]=atoms[n].y-atoms[m].y; b[2]=atoms[n].z-atoms[m].z; normalize_vec(b); angle=dot_product(a,b); angle=acos(angle)*deg_to_rad; return(angle); } double get_torsion(int l, int m, int n, int o) { double dot_product(double *, double *); void normalize_vec(double *); void vector_product(double *, double *, double *); double lm[3], mn[3], no[3], p[3], q[3], temp[3], torsion; /* work out torsion angle: there are four atoms (l,m,n,o). Two planes are defined - the first contains atoms l, m and n and the second contains atoms m, n and o. The angle between these two planes (actually plane normals) is the torsion angle. Additionally, we need to assign a sign - the cross product of the two plane normals is either parallel or antiparallel to the vector between atoms m and n. Parallel -> +ve torsion angle and antiparallel -> -ve torsion angle. */ /* The l->m vector */ lm[0] = atoms[m].x - atoms[l].x; lm[1] = atoms[m].y - atoms[l].y; lm[2] = atoms[m].z - atoms[l].z; normalize_vec(lm); /* The m->n vector */ mn[0] = atoms[n].x - atoms[m].x; mn[1] = atoms[n].y - atoms[m].y; mn[2] = atoms[n].z - atoms[m].z; normalize_vec(mn); /* The n->o vector */ no[0] = atoms[o].x - atoms[n].x; no[1] = atoms[o].y - atoms[n].y; no[2] = atoms[o].z - atoms[n].z; normalize_vec(no); /* The plane normal of (l,m,n) */ vector_product(p, lm, mn); /* p = lm x mn */ normalize_vec(p); /* The plane normal of (m,n,o) */ vector_product(q, mn, no); /* q = mn x no */ normalize_vec(q); /* The torsion angle is the angle between the two plane normals - the next step gives cos(torsion) */ torsion = dot_product(p, q); /* some systems don't like acos(1.0) and return nan0x7fffffff */ if(fabs((torsion - 1.0)) < 1e-10) { torsion = 0.0; } else { torsion = acos(torsion) * deg_to_rad; } /* Now determine the sign - determined from mn . (p x q) */ vector_product(temp, p, q); /* temp = p x q */ if(dot_product(mn, temp) < 0.0) { torsion *= -1.0; /* Negate */ } return(torsion); } void make_pers_dlg(Widget parent) { void d_scale_cb(Widget, XtPointer, XtPointer); void depth_on_cb(Widget, XtPointer, XtPointer); void pers_dlg_cancel_cb(Widget, XtPointer, XtPointer); void perspective_type_cb (Widget, XtPointer, XtPointer); void reset_pers_scales(void); void v_scale_cb(Widget, XtPointer, XtPointer); int n=0; Widget depth_on, rc1, radio, button; XmString title; if(!pers_dialog){ title=XmStringCreateLocalized("Perspective"); n=0; XtSetArg (args[n],XmNdialogTitle,title); n++; XtSetArg (args[n],XmNwidth,300); n++; pers_dialog=XmCreateMessageDialog(parent,"v_scale",args,n); rc1=XtVaCreateManagedWidget ("rc1",xmRowColumnWidgetClass,pers_dialog,NULL); title=XmStringCreateLocalized("Alter scale"); v_scale = XtVaCreateManagedWidget ("v_scale", xmScaleWidgetClass, rc1, XmNmaximum, 1000, XmNminimum, 0, XmNvalue, 0, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(v_scale, XmNdragCallback, v_scale_cb, NULL); XtAddCallback(v_scale, XmNvalueChangedCallback, v_scale_cb, NULL); title=XmStringCreateLocalized("Choose depth"); d_scale = XtVaCreateManagedWidget ("d_scale", xmScaleWidgetClass, rc1, XmNmaximum, 100, XmNminimum, 0, XmNvalue, 1, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); /* This sets the value correctly from the current canvas_scale */ reset_pers_scales(); XmStringFree(title); XtAddCallback(d_scale, XmNdragCallback, d_scale_cb, NULL); XtAddCallback(d_scale, XmNvalueChangedCallback, d_scale_cb, NULL); depth_on=XtVaCreateManagedWidget ("Toggle depth",xmToggleButtonGadgetClass, rc1, NULL); if(depth_is_on){ XtVaSetValues(depth_on,XmNset,True,NULL); } XtAddCallback(depth_on,XmNvalueChangedCallback, depth_on_cb,(XtPointer)1); XtManageChild (XmCreateSeparator (rc1, "sep", NULL, 0)); radio = XmCreateRadioBox (rc1, "pers_radio", NULL, 0); button = XtVaCreateManagedWidget ("Act on all frames", xmToggleButtonGadgetClass, radio, NULL); if (perspective_type == PERSPECTIVE_ALL) { XtVaSetValues (button, XmNset, True, NULL); } XtAddCallback (button, XmNvalueChangedCallback, perspective_type_cb, (XtPointer) PERSPECTIVE_ALL); button = XtVaCreateManagedWidget ("Act on current frame", xmToggleButtonGadgetClass, radio, NULL); if (perspective_type == PERSPECTIVE_CURRENT) { XtVaSetValues (button, XmNset, True, NULL); } XtAddCallback (button, XmNvalueChangedCallback, perspective_type_cb, (XtPointer) PERSPECTIVE_CURRENT); XtManageChild (radio); XtAddCallback(pers_dialog, XmNcancelCallback, pers_dlg_cancel_cb,NULL); XtUnmanageChild (XmMessageBoxGetChild(pers_dialog,XmDIALOG_OK_BUTTON)); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(pers_dialog,XmDIALOG_HELP_BUTTON)); } XtAddCallback (pers_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(pers_dialog); } void pers_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(pers_dialog); pers_dialog=NULL; d_scale = NULL; v_scale = NULL; } void v_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); struct frame * get_selected_frame (void); void set_canvas_scale (double); void set_scale_all_frames (int); double scale; struct frame *this_frame; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; int cb_value; cb_value = cbs->value; if (no_frames != 0) { if (perspective_type == PERSPECTIVE_CURRENT) { /* Update current frame */ this_frame = get_selected_frame (); this_frame->perspective_scale = cb_value; } else { /* Update all frames */ set_scale_all_frames (cb_value); } } /* cb_value can vary between 0 and 1000 so we can vary the scale between 0 and 1023 */ scale = pow (2.0, cb_value / 100.0) - 1; set_canvas_scale (scale); redraw = 1; canvas_cb (canvas, NULL, NULL); } void set_scale_all_frames (int value) { struct frame * get_first_frame (); struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { this_frame->perspective_scale = value; this_frame = this_frame->next; } } void d_scale_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); struct frame * get_selected_frame (void); void set_depth_all_frames (int); void set_z_depth (double); struct frame *this_frame; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; int cb_value; cb_value = cbs->value; depth = cb_value; if (no_frames != 0) { if (perspective_type == PERSPECTIVE_CURRENT) { /* Update current frame */ this_frame = get_selected_frame (); this_frame->perspective_depth = cb_value; } else { /* Update all frames */ set_depth_all_frames (cb_value); } } set_z_depth (depth); redraw = 1; canvas_cb (canvas, NULL, NULL); } void set_depth_all_frames (int value) { struct frame * get_first_frame (); struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { this_frame->perspective_depth = value; this_frame = this_frame->next; } } void depth_on_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); if(depth_is_on==0){ depth_is_on=1; }else{ depth_is_on=0; } redraw=1; canvas_cb(canvas,NULL,NULL); /* update display */ } void perspective_type_cb (Widget widget, XtPointer client_data, XtPointer call_data) { perspective_type = (enum perspective_types) client_data; } void select_atom_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void update_selected(int); int selected_atom; char* selected_atom_str,string[100]; XtVaGetValues(widget,XmNvalue,&selected_atom_str,NULL); if ((strlen (selected_atom_str) == 0) || (sscanf (selected_atom_str, "%d", &selected_atom) <= 0)) { echo_to_message_area("Cannot parse string!"); return; } selected_atom--; /* 0..no_atoms-1 */ if((selected_atom>no_atoms-1)||(selected_atom<0)){ echo_to_message_area("Choice of atom out of bounds!"); return; }else{ update_selected(selected_atom); sprintf(string,"Atom %d selected",selected_atom+1); echo_to_message_area(string); } } void sel_reset_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_lengths_dialog(Boolean); int i; for(i = 0; i < 4; i++) { if(selected[i] != -1) { atoms[selected[i]].sel = 0; selected[i] = -1; } } redraw = 1; canvas_cb(canvas, NULL, NULL); update_lengths_dialog(True); } void reset_pers_scales(void) { double get_z_depth(void); double get_canvas_scale(void); int xm_nint (double); int v_scale_int, local_z_depth; v_scale_int = xm_nint (100.0 * log (get_canvas_scale() + 1) / log(2.0)); if(d_scale != NULL) { local_z_depth = (int) get_z_depth(); XtVaSetValues(d_scale, XmNvalue, local_z_depth, NULL); } if(v_scale != NULL) { XtVaSetValues(v_scale, XmNvalue, v_scale_int, NULL); } } xmakemol-5.16/crystal.c0000644000175000017500000000676410664010177012047 00000000000000/* Copyright (C) 2001, 2002, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "globals.h" #include "bbox.h" static int crystal_origin_set = 0; static int crystal_vector_set[3] = {0, 0, 0}; static int crystal_images_set = 0; static double crystal_origin[3]; static double crystal_vector[9]; static int crystal_images[3]; void set_crystal_origin (double *x) { int i; for (i = 0; i < 3; i++) { crystal_origin[i] = x[i]; } crystal_origin_set = 1; } void set_crystal_vector (int i, double *x) { int j; for (j = 0; j < 3; j++) { crystal_vector[((i - 1) * 3) + j] = x[j]; } crystal_vector_set[i - 1] = 1; } double * get_crystal_vector (void) { return (crystal_vector); } void set_crystal_images (int *p) { int i; for (i = 0; i < 3; i++) { crystal_images[i] = p[i]; } crystal_images_set = 1; } int * get_crystal_images (void) { return (crystal_images); } int crystal_p (void) { if (crystal_origin_set && crystal_images_set && crystal_vector_set[0] && crystal_vector_set[1] && crystal_vector_set[2]) { return (1); } else { return (0); } } void reset_crystal_status (void) { crystal_origin_set = 0; crystal_images_set = 0; crystal_vector_set[0] = 0; crystal_vector_set[1] = 0; crystal_vector_set[2] = 0; } void update_crystal_bbox (bounding_box *bbox) { double get_angle_axis (double *); void rotate (double *); void set_rotate_axis (double *); void set_rotate_angle (double); void set_rotate_origin (double *); int i, j; double axis[3], phi, rotated_vector[9]; /* Copy the vectors */ for (i = 0; i < 9; i++) { rotated_vector[i] = crystal_vector[i]; } /* Set up rotation */ for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { angle_axis_matrix[i][j] = global_matrix[i][j]; } } phi = get_angle_axis (axis); set_rotate_axis (axis); set_rotate_angle (phi); set_rotate_origin (NULL); /* Rotate the vectors */ rotate (rotated_vector); rotate (rotated_vector + 3); rotate (rotated_vector + 6); /* Build the bounding box */ /* TODO: this won't work if we don't have the crystal origin coincident with the first atom */ bbox->v[2][0] = atoms[0].x; bbox->v[2][1] = atoms[0].y; bbox->v[2][2] = atoms[0].z; for (i = 0; i < 3; i++) { bbox->v[3][i] = bbox->v[2][i] + rotated_vector[i]; bbox->v[6][i] = bbox->v[2][i] + rotated_vector[3 + i]; bbox->v[7][i] = bbox->v[6][i] + rotated_vector[i]; bbox->v[0][i] = bbox->v[2][i] + rotated_vector[6 + i]; bbox->v[1][i] = bbox->v[0][i] + rotated_vector[i]; bbox->v[4][i] = bbox->v[0][i] + rotated_vector[3 + i]; bbox->v[5][i] = bbox->v[4][i] + rotated_vector[i]; } } xmakemol-5.16/draw.c0000644000175000017500000005361310664010177011316 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __DRAW_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "bonds.h" #include "defs.h" #include "draw.h" #include "globals.h" #include "vectors.h" #include "view.h" static double atom_scale = 0.5; static double bond_scale = 0.5; static double hbond_scale = 0.5; static double smallest_cov_rad; void draw_atom(int si) { void convert_to_canvas_coords(double *, double *, Boolean); double get_atom_radius(int); Boolean mouse_motion_p (void); Boolean outline_mode_p (void); double radius; double atom_coord[3], canvas_coord[2]; radius = get_atom_radius(si); gcv.foreground=atoms[si].pixel; gcv.line_width=0; gcv.line_style=LineSolid; XChangeGC(display,gc,GCForeground|GCLineWidth|GCLineStyle,&gcv); /* get the canvas coords of the atom */ atom_coord[0] = atoms[si].x; atom_coord[1] = atoms[si].y; atom_coord[2] = atoms[si].z; convert_to_canvas_coords(atom_coord, canvas_coord, 0); if((! mouse_motion_p ()) || (! outline_mode_p ())){ XFillArc (display, canvas_pm, gc, (int) (canvas_coord[0] - radius), (int) (canvas_coord[1] - radius), (int) (2.0 * radius), (int) (2.0 * radius), 0, 360*64); if(atoms[si].sel == 1) { } } if (atoms[si].sel == 1) { gcv.foreground = sel_color.pixel; } else { gcv.foreground = BlackPixelOfScreen (screen_ptr); } XChangeGC (display, gc, GCForeground, &gcv); XDrawArc (display, canvas_pm, gc, (int) (canvas_coord[0] - radius), (int) (canvas_coord[1] - radius), (int) (2.0 * radius), (int) (2.0 * radius), 0, 360*64); /* Distinguish atoms not selected for rotation/translation */ if(atoms[si].edit == 0) { XDrawLine(display, canvas_pm, gc, (int) (canvas_coord[0]), (int) (canvas_coord[1] - (radius / 2)), (int) (canvas_coord[0]), (int) (canvas_coord[1] + (radius / 2))); XDrawLine(display, canvas_pm, gc, (int) (canvas_coord[0] - (radius / 2)), (int) (canvas_coord[1]), (int) (canvas_coord[0] + (radius / 2)), (int) (canvas_coord[1])); } } void draw_bond(int si, int sj) { double get_atom_radius(int); void update_canvas_bond_points(int, int, Boolean, double); XPoint bond_points[5]; update_canvas_bond_points(si, sj, 0, 0.0); gcv.line_width=0; gcv.foreground=atoms[si].pixel; gcv.line_style=LineSolid; XChangeGC(display,gc,GCLineWidth|GCForeground|GCLineStyle,&gcv); /* Draw polygon 0-1-4-5 */ bond_points[0].x = canvas_bond_points[0].x; bond_points[0].y = canvas_bond_points[0].y; bond_points[1].x = canvas_bond_points[1].x; bond_points[1].y = canvas_bond_points[1].y; bond_points[2].x = canvas_bond_points[4].x; bond_points[2].y = canvas_bond_points[4].y; bond_points[3].x = canvas_bond_points[5].x; bond_points[3].y = canvas_bond_points[5].y; XFillPolygon(display, canvas_pm, gc, bond_points, 4, Complex,CoordModeOrigin); gcv.foreground=BlackPixelOfScreen(screen_ptr); XChangeGC(display,gc,GCForeground,&gcv); gcv.foreground=atoms[sj].pixel; XChangeGC(display,gc,GCForeground,&gcv); /* Draw polygon 2-1-4-3 */ bond_points[0].x = canvas_bond_points[2].x; bond_points[0].y = canvas_bond_points[2].y; bond_points[1].x = canvas_bond_points[1].x; bond_points[1].y = canvas_bond_points[1].y; bond_points[2].x = canvas_bond_points[4].x; bond_points[2].y = canvas_bond_points[4].y; bond_points[3].x = canvas_bond_points[3].x; bond_points[3].y = canvas_bond_points[3].y; XFillPolygon(display, canvas_pm, gc, bond_points, 4, Complex, CoordModeOrigin); gcv.foreground=BlackPixelOfScreen(screen_ptr); XChangeGC(display,gc,GCForeground,&gcv); /* Draw the lines 0-2-3-5-0 */ bond_points[0].x = canvas_bond_points[0].x; bond_points[0].y = canvas_bond_points[0].y; bond_points[1].x = canvas_bond_points[2].x; bond_points[1].y = canvas_bond_points[2].y; bond_points[2].x = canvas_bond_points[3].x; bond_points[2].y = canvas_bond_points[3].y; bond_points[3].x = canvas_bond_points[5].x; bond_points[3].y = canvas_bond_points[5].y; bond_points[4].x = canvas_bond_points[0].x; bond_points[4].y = canvas_bond_points[0].y; XDrawLines(display, canvas_pm, gc, bond_points, 5, CoordModeOrigin); /* Draw the line 1-4 */ bond_points[0].x = canvas_bond_points[1].x; bond_points[0].y = canvas_bond_points[1].y; bond_points[1].x = canvas_bond_points[4].x; bond_points[1].y = canvas_bond_points[4].y; XDrawLines(display, canvas_pm, gc, bond_points, 2, CoordModeOrigin); } static int no_dashes = 5; int get_no_dashes(void) { return(no_dashes); } void draw_hbond(int si, int sj) { double get_h_bond_width(int, int); int get_no_dashes(void); void update_canvas_hbond_points(int, int, Boolean); int xm_nint(double); int offset, no_slots, ihbond_length, dash_length; char dash_list[2]; /* So range is 0-255 */ double x, y, hbond_length; update_canvas_hbond_points(si, sj, 0); /* Get the H-bond length (on the canvas) */ x = canvas_hbond_points[0].x - canvas_hbond_points[1].x; y = canvas_hbond_points[0].y - canvas_hbond_points[1].y; hbond_length = sqrt ((x * x) + (y * y)); /* Integer value of hbond_length */ ihbond_length = xm_nint(hbond_length); /* for no_dashes dashes, there are ((2 * no_dashes) - 1) slots: \ / ||| ||| ||| ||| ||| A ||| ||| ||| ||| ||| B ||| ||| ||| ||| ||| / \ */ no_slots = (2 * get_no_dashes()) - 1; dash_length = xm_nint(hbond_length/no_slots); offset = (2 * dash_length) - ((ihbond_length - (no_slots * dash_length)) / 2); if(dash_length == 0) { /* Must be non-zero */ return; } else if(dash_length > 255) { /* stored in type char */ return; } dash_list[0] = dash_length; dash_list[1] = dash_list[0]; /* Set the dashes */ XSetDashes(display, gc, offset, dash_list, 2); /* Change the GC */ gcv.line_width = (int) get_h_bond_width(si, sj); gcv.foreground=BlackPixelOfScreen(screen_ptr); gcv.line_style=LineOnOffDash; XChangeGC(display,gc,GCForeground | GCLineWidth | GCLineStyle, &gcv); /* Draw the lines 0-1 */ XDrawLine(display, canvas_pm, gc, canvas_hbond_points[0].x, canvas_hbond_points[0].y, canvas_hbond_points[1].x, canvas_hbond_points[1].y); } void draw_atom_numbers_and_symbols(int si) { void convert_to_canvas_coords(double *, double *, Boolean); int i; char *labels = "ABCD", label_string[10], temp_string[10]; double atom_coord[3], label_coord[2]; atom_coord[0] = atoms[si].x; atom_coord[1] = atoms[si].y; atom_coord[2] = atoms[si].z; convert_to_canvas_coords(atom_coord, label_coord, 0); /* Add atom number if appropriate */ strcpy(label_string, ""); /* Initialize */ if(at_nos_flag == 1) { sprintf(label_string, "%d ", si + 1); } /* Add atom symbol if appropriate */ if(at_sym_flag == 1) { sprintf(temp_string, "%s ", atoms[si].label); strcat(label_string, temp_string); } /* Add the measure label if appropriate */ for(i = 0; i < 4; i++) { if(si == selected[i]) { sprintf(temp_string, "%c", labels[i]); strcat(label_string, temp_string); } } XDrawString(display, canvas_pm, gc, (int) label_coord[0], (int) label_coord[1], label_string, strlen(label_string)); } void draw_axes(void) { char axis_lab[2]; int x_pos,y_pos; gcv.foreground=BlackPixelOfScreen(screen_ptr); gcv.line_style=LineSolid; gcv.line_width=0; x_pos = (int)(canvas_width-50); y_pos = 50; XChangeGC(display,gc,GCForeground|GCLineStyle|GCLineWidth, &gcv); XDrawLine(display,canvas_pm,gc, x_pos, y_pos, (int)(x_pos+global_matrix[0][0]*30), (int)(y_pos-global_matrix[0][1]*30)); strcpy(axis_lab,"X"); XDrawString(display,canvas_pm,gc, (int)(x_pos+global_matrix[0][0]*40), (int)(y_pos-global_matrix[0][1]*40), axis_lab, strlen(axis_lab)); XDrawLine(display,canvas_pm,gc, x_pos, y_pos, (int)(x_pos+global_matrix[1][0]*30), (int)(y_pos-global_matrix[1][1]*30)); strcpy(axis_lab,"Y"); XDrawString(display,canvas_pm,gc, (int)(x_pos+global_matrix[1][0]*40), (int)(y_pos-global_matrix[1][1]*40), axis_lab, strlen(axis_lab)); XDrawLine(display,canvas_pm,gc, x_pos, y_pos, (int)(x_pos+global_matrix[2][0]*30), (int)(y_pos-global_matrix[2][1]*30)); strcpy(axis_lab,"Z"); XDrawString(display,canvas_pm,gc, (int)(x_pos+global_matrix[2][0]*40), (int)(y_pos-global_matrix[2][1]*40), axis_lab, strlen(axis_lab)); } void draw_vector(int si, int j) { void update_canvas_vector_points (int, int); update_canvas_vector_points (si, j); gcv.line_width = 2; gcv.line_style=LineSolid; gcv.foreground=BlackPixelOfScreen(screen_ptr); XChangeGC(display, gc, GCLineWidth | GCLineStyle | GCForeground, &gcv); switch (arrow_type) { case ARROW_OPEN: XDrawLine(display, canvas_pm, gc, canvas_vector_points[0].x, canvas_vector_points[0].y, canvas_vector_points[1].x, canvas_vector_points[1].y); XDrawLine(display, canvas_pm, gc, canvas_vector_points[1].x, canvas_vector_points[1].y, canvas_vector_points[3].x, canvas_vector_points[3].y); XDrawLine(display, canvas_pm, gc, canvas_vector_points[1].x, canvas_vector_points[1].y, canvas_vector_points[4].x, canvas_vector_points[4].y); break; case ARROW_CLOSED: XDrawLine(display, canvas_pm, gc, canvas_vector_points[0].x, canvas_vector_points[0].y, canvas_vector_points[2].x, canvas_vector_points[2].y); XDrawLine(display, canvas_pm, gc, canvas_vector_points[1].x, canvas_vector_points[1].y, canvas_vector_points[3].x, canvas_vector_points[3].y); XDrawLine(display, canvas_pm, gc, canvas_vector_points[3].x, canvas_vector_points[3].y, canvas_vector_points[4].x, canvas_vector_points[4].y); XDrawLine(display, canvas_pm, gc, canvas_vector_points[4].x, canvas_vector_points[4].y, canvas_vector_points[1].x, canvas_vector_points[1].y); break; case ARROW_FILLED: XDrawLine(display, canvas_pm, gc, canvas_vector_points[0].x, canvas_vector_points[0].y, canvas_vector_points[2].x, canvas_vector_points[2].y); { XPoint xpoints[3]; xpoints[0].x = canvas_vector_points[1].x; xpoints[0].y = canvas_vector_points[1].y; xpoints[1].x = canvas_vector_points[3].x; xpoints[1].y = canvas_vector_points[3].y; xpoints[2].x = canvas_vector_points[4].x; xpoints[2].y = canvas_vector_points[4].y; XFillPolygon (display, canvas_pm, gc, xpoints, 3, Complex, CoordModeOrigin); } break; } } void draw_region(void) { XPoint region_get_start(void); XPoint region_get_end(void); int x1, y1, x2, y2, temp, width, height; XPoint start, end; start = region_get_start(); end = region_get_end(); x1 = start.x; y1 = start.y; x2 = end.x; y2 = end.y; if(x1 > x2) { temp = x1; x1 = x2; x2 = temp; } if(y1 > y2) { temp = y1; y1 = y2; y2 = temp; } width = x2 - x1; height = y2 - y1; gcv.line_width = 2; XChangeGC(display, gc, GCLineWidth, &gcv); XDrawRectangle(display, XtWindow(canvas), gc, x1, y1, width, height); } double get_atom_radius(int i) { double get_atom_scale(void); double get_canvas_scale(void); double get_depth_scale(double); double radius; radius = get_atom_scale() * /* which is interactively scalable */ get_canvas_scale() * /* scale factor due to size of canvas */ get_depth_scale(atoms[i].z); /* scale factor due to depth of atom */ /* Scale by covalent of van der Waals radius, depending on whether the atom is bonded to anything else */ if ((bond_adjacency_list[i] == NULL) && (never_use_vdw == 0)) { radius *= atoms[i].vdw_rad; } else { radius *= atoms[i].cov_rad; } return (radius); } /* What a bond looks like: \ / 5--------------------4--------------------3 | | | A l m n B | | | 0--------------------1--------------------2 / \ A and B are the atom centres. The bond length is the distance between A and B. The bond is separated at the midpoint (vertical line above). This is defined as follows. If the radii of a and b are r_a and r_b respectively, the point m is at a + r_a/(r_a + r_b) * r - this is the proportion of the bond that "belongs" to atom a. Likewise, the proportion of the bond that "belongs" to atom b is given by r_b/(r_a + r_b). a = 0 -> A b = 0 -> b r = b - a p = z x r (bond perpendicular, parallel 23 and 05) l = a + radius(a) * r m = a + r_a/(r_a + r_b) * r n = b - radius(b) * r */ /* Note that for PostScript output, the Y axis is in the opposite direction, so that y must be replaced with (canvas_width - y). This is covered using the Boolean variable ps_corr */ void update_canvas_bond_points(int si, int sj, Boolean ps_corr, double offset) { void convert_to_canvas_coords(double *, double *, Boolean); double get_atom_scale(void); double get_bond_width(void); double mod_of_vec(double *); void normalize_vec(double *); int i; double mod_r, a_prop, sb_wid, local_at_scale, half_bond_width; double a[3], b[3], r[3], p[3], l[3], m[3], n[3]; a[0] = atoms[si].x; a[1] = atoms[si].y; a[2] = atoms[si].z; b[0] = atoms[sj].x; b[1] = atoms[sj].y; b[2] = atoms[sj].z; for(i = 0; i < 3; i++) { r[i] = b[i] - a[i]; } /* We need to keep the modulus of r for later */ mod_r = mod_of_vec(r); normalize_vec(r); /* This satisfies the condition that p is perpendicular to both the vector r and the z direction */ p[0] = -1.0 * r[1]; p[1] = 1.0 * r[0]; p[2] = 0.0; normalize_vec(p); /* Calculate intermediate quantities */ a_prop = atoms[si].cov_rad/(atoms[si].cov_rad + atoms[sj].cov_rad); /* Fudge: switching off atoms is equivalent to having atoms of zero radius */ if(atom_flag == 0) { local_at_scale = 0.0; } else { local_at_scale = get_atom_scale(); /* The "canonical" value */ } for(i=0; i < 3; i++) { if (local_at_scale != 0) { l[i] = a[i] + (atoms[si].cov_rad * local_at_scale + offset) * r[i]; } else { l[i] = a[i] + (offset * r[i]); } m[i] = a[i] + a_prop * (mod_r - offset) * r[i]; n[i] = b[i] - (atoms[sj].cov_rad * local_at_scale * r[i]); } /* Calculate bond coordinates (cartesian) */ /* The maximum bond width is the covalent radius of the smallest atom */ sb_wid = get_bond_width (); for(i = 0; i < 3; i++) { if ((i == 0) || (i == 1)) { half_bond_width = ((sb_wid - (2.0 * offset)) * p[i] / 2.0); } else { half_bond_width = (sb_wid * p[i] / 2.0); } cartesian_bond_points[0][i] = l[i] - half_bond_width; cartesian_bond_points[1][i] = m[i] - half_bond_width; cartesian_bond_points[2][i] = n[i] - half_bond_width; cartesian_bond_points[3][i] = n[i] + half_bond_width; cartesian_bond_points[4][i] = m[i] + half_bond_width; cartesian_bond_points[5][i] = l[i] + half_bond_width; } /* Loop over the bond coordinates and get canvas coordinates */ for(i = 0; i < 6; i++) { double xy_temp[2]; convert_to_canvas_coords(cartesian_bond_points[i], xy_temp, ps_corr); canvas_bond_points[i].x = xy_temp[0]; canvas_bond_points[i].y = xy_temp[1]; } } void update_canvas_hbond_points(int si, int sj, Boolean ps_corr) { double get_atom_scale(void); void convert_to_canvas_coords(double *, double *, Boolean); double mod_of_vec(double *); void normalize_vec(double *); int i; double mod_r, local_at_scale; double a[3], b[3], r[3]; a[0] = atoms[si].x; a[1] = atoms[si].y; a[2] = atoms[si].z; b[0] = atoms[sj].x; b[1] = atoms[sj].y; b[2] = atoms[sj].z; for(i = 0; i < 3; i++) { r[i] = b[i] - a[i]; } /* We need to keep the modulus of r for later */ mod_r = mod_of_vec(r); normalize_vec(r); /* Fudge: switching off atoms is equivalent to having atoms of zero radius */ if(atom_flag == 0) { local_at_scale = 0.0; } else { local_at_scale = get_atom_scale(); /* The "global" value */ } for(i=0; i < 3; i++) { double radius[2]; /* If bonded use covalent radius, otherwise van der Waals */ if ((bond_adjacency_list[si] == NULL) && (never_use_vdw == 0)) { radius[0] = atoms[si].vdw_rad; } else { radius[0] = atoms[si].cov_rad; } if ((bond_adjacency_list[sj] == NULL) && (never_use_vdw == 0)) { radius[1] = atoms[sj].vdw_rad; } else { radius[1] = atoms[sj].cov_rad; } cartesian_hbond_points[0][i] = a[i] + (radius[0] * local_at_scale * r[i]); cartesian_hbond_points[1][i] = b[i] - (radius[1] * local_at_scale * r[i]); } /* Loop over the bond coordinates and get canvas coordinates */ for(i = 0; i < 2; i++) { double xy_temp[2]; convert_to_canvas_coords(cartesian_hbond_points[i], xy_temp, ps_corr); canvas_hbond_points[i].x = xy_temp[0]; canvas_hbond_points[i].y = xy_temp[1]; } } double get_h_bond_width(int si, int sj) { double get_atom_radius(int); double get_canvas_scale(void); double get_depth_scale(double); double get_hbond_scale(void); int hi; /* hydrogen index */ double h_bond_width; /* Determine which atom is hydrogen */ if(atoms[si].is_hydrogen == 1) { hi = si; } else { hi = sj; } /* This is set to the radius of a hydrogen atom. This is dependent on the depth - cf get_atom_radius (we don't want this to be dependent on atom_scale */ h_bond_width = atoms[hi].cov_rad * get_canvas_scale() * get_depth_scale(atoms[hi].z); /* Scale according the adjustable H-bond factor (0->1) */ h_bond_width *= get_hbond_scale(); return(h_bond_width); } double get_atom_scale(void) { return(atom_scale); } void set_atom_scale(double new_scale) { atom_scale = new_scale; } double get_hbond_scale(void) { return(hbond_scale); } void set_hbond_scale(double new_scale) { hbond_scale = new_scale; } double get_bond_scale(void) { return(bond_scale); } void set_bond_scale(double new_scale) { bond_scale = new_scale; } double get_bond_width (void) { return (bond_scale * smallest_cov_rad); } void set_smallest_cov_rad(double new) { smallest_cov_rad = new; } double get_smallest_cov_rad(void) { return(smallest_cov_rad); } xmakemol-5.16/edit.c0000644000175000017500000042116610213024624011300 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* aro - added */ #include #include "globals.h" #include "bbox.h" /* included by wjq */ #include "defs.h" #include "draw.h" #include "vectors.h" #include "view.h" #define WHOLE_CANVAS 1 #define INSIDE_REGION 2 #define OUTSIDE_REGION 3 void echo_to_message_area(char *); void place_dialog_cb (Widget, XtPointer, XtPointer); /* These allow us to keep track of the edit_visi_dialog */ static int visi_act_on = 1; static int posn_act_on = 1; static Boolean edit_visi_dialog_pos_are_avail; static Position edit_visi_dialog_xpos, edit_visi_dialog_ypos; /* These allow us to keep track of the edit_posn_dialog */ static Boolean edit_posn_dialog_pos_are_avail; static Position edit_posn_dialog_xpos, edit_posn_dialog_ypos; static Widget bdfd_scale_w, hbdfd_scale_w, ibdfd_scale_w, ihbdfd_scale_w; static Widget at_scale_w,bd_scale_w,hbd_scale_w,never_use_vdw_w; static Widget vector_display_dialog = NULL; static int last_value=0; static double phi,axis[3]; struct atom_group { char label[4]; }; struct atom_group *atom_group; static Widget x_rot,y_rot,z_rot; Widget x_trans,y_trans,z_trans; /* aro--> */ /* Widgets for use in edit_posn_dialog */ Widget rot_text_label, trans_text_label; Widget x_rot_text,y_rot_text,z_rot_text, x_trans_text,y_trans_text,z_trans_text; Widget x_rot_button,y_rot_button,z_rot_button,x_trans_button,y_trans_button,z_trans_button; /* Structs used to create and keep track of linked list of widgets that have been changed in edit_element_props_dialog (i.e. text of a TextField changed by user) */ struct widgets { Widget id; struct widgets *next; }; struct widget_list { struct widgets *curr; struct widgets *head; } widgets_changed; /* Struct for keeping track of the state of edit_element_props_dialog */ struct dialog_state { Boolean show_all_elements; Boolean show_customized_elements; Boolean file_loaded; } elem_props_dialog_state = {False, False, False}; /* <--aro */ Widget *edit_visi_type_btn=NULL; Widget *edit_posn_type_btn=NULL; void edit_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void make_edit_atbd_sizes_dialog(Widget); void make_edit_bond_fudges_dialog(Widget); void make_edit_bond_sizes_dialog(Widget); void make_edit_element_props_dialog(Widget); void make_edit_posn_dialog(Widget); void make_scale_coords_dialog (Widget); void make_edit_visi_dialog(Widget); void make_vector_display_dialog(Widget); void make_bbox_dialog(Widget); #ifdef GL void make_gl_render_dialog (Widget); #endif /* GL */ int item_no = (int) client_data; switch(item_no){ case 0: make_edit_visi_dialog(main_w); break; case 1: make_edit_posn_dialog(main_w); break; case 2: make_scale_coords_dialog (main_w); break; case 3: make_edit_atbd_sizes_dialog(main_w); break; case 4: make_edit_bond_fudges_dialog(main_w); break; case 5: make_vector_display_dialog(main_w); break; case 6: make_bbox_dialog(main_w); break; case 7: make_edit_element_props_dialog(main_w); break; #ifdef GL case 8: make_gl_render_dialog (main_w); #endif /* GL */ } } void make_edit_visi_dialog(Widget parent) { void edit_visi_cancel_cb(Widget, XtPointer, XtPointer); void get_edit_visi_dialog_position(void); int get_no_elements (void); void visi_act_on_cb(Widget, XtPointer, XtPointer); void visi_atoms_type_cb(Widget, XtPointer, XtPointer); void visi_invert_cb(Widget, XtPointer, XtPointer); void visi_reset_cb(Widget, XtPointer, XtPointer); void visi_propagate_cb (Widget, XtPointer, XtPointer); int i,n,count; char istring[16]; XmString title; Widget rc, region, button, invert, reset, propagate; if(!edit_visi_dialog){ title = XmStringCreateLocalized("Edit visible atoms"); n=0; XtSetArg (args[n],XmNautoUnmanage, False); n++; XtSetArg (args[n],XmNdialogTitle,title); n++; edit_visi_dialog= XmCreateMessageDialog(parent,"edit",args,n); rc = XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,edit_visi_dialog,NULL); XtVaCreateManagedWidget ("Actions act on:", xmLabelWidgetClass,rc, XmNalignment, XmALIGNMENT_BEGINNING, NULL); region = XmCreateRadioBox(rc, "toggle", NULL, 0); button = XtVaCreateManagedWidget("all atoms", xmToggleButtonGadgetClass, region, NULL); if(visi_act_on == WHOLE_CANVAS) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, visi_act_on_cb, (XtPointer) WHOLE_CANVAS); button = XtVaCreateManagedWidget("atoms inside region", xmToggleButtonGadgetClass, region, NULL); if(visi_act_on == INSIDE_REGION) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, visi_act_on_cb, (XtPointer) INSIDE_REGION); button = XtVaCreateManagedWidget("atoms outside region", xmToggleButtonGadgetClass, region, NULL); if(visi_act_on == OUTSIDE_REGION) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, visi_act_on_cb, (XtPointer) OUTSIDE_REGION); XtManageChild(region); if(edit_visi_type_btn) { free(edit_visi_type_btn); } edit_visi_type_btn=malloc(no_atom_types*sizeof(Widget)); if(atom_group) { free(atom_group); } atom_group=malloc(no_atom_types*sizeof(struct atom_group)); count=0; for (i = 0; i < get_no_elements (); i++) { if (element[i].any_atoms) { sprintf(istring,"Toggle %s atoms",element[i].label); edit_visi_type_btn[count]=XtVaCreateManagedWidget (istring,xmPushButtonWidgetClass,rc,NULL); XtAddCallback(edit_visi_type_btn[count],XmNactivateCallback, visi_atoms_type_cb,(XtPointer)count); strcpy(atom_group[count].label,element[i].label); count++; } } invert=XtVaCreateManagedWidget ("Invert selection",xmPushButtonWidgetClass,rc,NULL); XtAddCallback(invert,XmNactivateCallback,visi_invert_cb,NULL); reset=XtVaCreateManagedWidget ("Reselect all",xmPushButtonWidgetClass,rc,NULL); XtAddCallback(reset,XmNactivateCallback,visi_reset_cb,NULL); /* Determine whether visibility toggles act on a single frame or all frames */ XtManageChild (XmCreateSeparator (rc, "sep", NULL, 0)); propagate = XtVaCreateManagedWidget ("Propagate visibilities to all frames", xmPushButtonWidgetClass, rc, NULL); XtAddCallback (propagate, XmNactivateCallback, visi_propagate_cb, NULL); /* Deal with Cancel */ XtAddCallback(edit_visi_dialog,XmNcancelCallback,edit_visi_cancel_cb,NULL); XtUnmanageChild (XmMessageBoxGetChild(edit_visi_dialog,XmDIALOG_OK_BUTTON)); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(edit_visi_dialog,XmDIALOG_HELP_BUTTON)); } XtAddCallback (edit_visi_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(edit_visi_dialog); /* set the position if it is available - else just get the position */ if(edit_visi_dialog_pos_are_avail == 1) { XtVaSetValues(edit_visi_dialog, XmNx, edit_visi_dialog_xpos, XmNy, edit_visi_dialog_ypos, NULL); } else { get_edit_visi_dialog_position(); } } void visi_atoms_type_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int count_visible_atoms (void); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); void update_bbox (void); struct frame * get_selected_frame (void); int i, at_type, no_visible_atoms; int *atoms_in_region = NULL; struct frame *this_frame; at_type = (int) client_data; if((visi_act_on == INSIDE_REGION) || (visi_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } this_frame = get_selected_frame (); for(i = 0; i < no_atoms; i++) { if(strcmp(atom_group[at_type].label, atoms[i].uppercase_label) == 0) { /* Act on an atom if: (1) The whole canvas is active (2) Inside the region is active and the atom is inside (3) Outside the region is active and the atom is outside */ if((visi_act_on == WHOLE_CANVAS) || ((visi_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((visi_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { if(atoms[i].visi == 0) { atoms[i].visi = 1; /* Could be a crystal */ if (i < this_frame->no_atoms) { this_frame->atom[i].visi = 1; } } else { atoms[i].visi = 0; /* Could be a crystal */ if (i < this_frame->no_atoms) { this_frame->atom[i].visi = 0; } } } } } update_bbox (); no_visible_atoms = count_visible_atoms (); redraw=1; canvas_cb(canvas,NULL,NULL); } void visi_invert_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int count_visible_atoms(void); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); void update_bbox (void); struct frame * get_selected_frame (void); int i, no_visible_atoms; int *atoms_in_region = NULL; struct frame *this_frame; if((visi_act_on == INSIDE_REGION) || (visi_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } this_frame = get_selected_frame (); for(i = 0; i < no_atoms; i++) { if((visi_act_on == WHOLE_CANVAS) || ((visi_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((visi_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { if(atoms[i].visi == 0) { atoms[i].visi = 1; /* Could be a crystal */ if (i < this_frame->no_atoms) { this_frame->atom[i].visi = 1; } } else { atoms[i].visi = 0; /* Could be a crystal */ if (i < this_frame->no_atoms) { this_frame->atom[i].visi = 0; } } } } no_visible_atoms = count_visible_atoms(); update_bbox (); redraw=1; canvas_cb(canvas,NULL,NULL); } void visi_reset_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int count_visible_atoms (void); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); void update_bbox (void); struct frame * get_selected_frame (void); int i, no_visible_atoms; int *atoms_in_region = NULL; struct frame *this_frame; if((visi_act_on == INSIDE_REGION) || (visi_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } this_frame = get_selected_frame (); for(i = 0; i < no_atoms; i++) { if((visi_act_on == WHOLE_CANVAS) || ((visi_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((visi_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { atoms[i].visi = 1; /* Could be a crystal */ if (i < this_frame->no_atoms) { this_frame->atom[i].visi = 1; } } } no_visible_atoms = count_visible_atoms(); update_bbox (); redraw=1; canvas_cb(canvas,NULL,NULL); } void visi_propagate_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void echo_to_message_area (char *); int get_all_frames_same_size (void); struct frame * get_first_frame (void); int i; char string[128]; struct frame *this_frame; if (no_frames == 1) { sprintf (string, "No other frames to propagate visibilities to"); } else { if (get_all_frames_same_size () == 1) { this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].visi = atoms[i].visi; } this_frame = this_frame->next; } sprintf (string, "Visibilites have been propagated to all frames"); } else { sprintf (string, "Action not permitted: variable number of atoms per frame"); } } echo_to_message_area (string); } int count_visible_atoms (void) { void update_bbox (void); void update_selected (int); int i, no_visible_atoms; char string[128]; no_visible_atoms = 0; for (i = 0; i < no_atoms; i++) { if (atoms[i].visi == 1) { no_visible_atoms++; } } sprintf (string, "There are %d visible atoms", no_visible_atoms); echo_to_message_area (string); return (no_visible_atoms); } void edit_visi_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void get_edit_visi_dialog_position(void); /* Get the position of the widget before killing it */ get_edit_visi_dialog_position(); XtDestroyWidget(edit_visi_dialog); edit_visi_dialog=NULL; free(edit_visi_type_btn); edit_visi_type_btn = NULL; } void get_edit_visi_dialog_position(void) { /* Get the position of the widget */ XtVaGetValues(edit_visi_dialog, XmNx, &edit_visi_dialog_xpos, XmNy, &edit_visi_dialog_ypos, NULL); edit_visi_dialog_pos_are_avail = 1; } void make_edit_posn_dialog(Widget parent) { void edit_posn_discard_cb(Widget, XtPointer, XtPointer); void edit_posn_cancel_cb(Widget, XtPointer, XtPointer); void edit_posn_make_perm_cb(Widget, XtPointer, XtPointer); void edit_posn_invert_cb(Widget, XtPointer, XtPointer); void edit_posn_reset_cb(Widget, XtPointer, XtPointer); void get_edit_posn_dialog_position(void); int get_no_elements (void); void posn_act_on_cb(Widget, XtPointer, XtPointer); void posn_atoms_type_cb(Widget, XtPointer, XtPointer); void rot_store_geom(Widget, XtPointer, XtPointer); void toggle_global_cb(Widget, XtPointer, XtPointer); void trans_store_geom_cb(Widget, XtPointer, XtPointer); void x_rot_cb(Widget, XtPointer, XtPointer); void x_trans_cb(Widget, XtPointer, XtPointer); void y_rot_cb(Widget, XtPointer, XtPointer); void y_trans_cb(Widget, XtPointer, XtPointer); void z_rot_cb(Widget, XtPointer, XtPointer); void z_trans_cb(Widget, XtPointer, XtPointer); /* aro--> */ /* Callback functions for PushButtons and TextFields added for use in rotation and translation*/ void x_rot_button_cb(Widget, XtPointer, XtPointer); void y_rot_button_cb(Widget, XtPointer, XtPointer); void z_rot_button_cb(Widget, XtPointer, XtPointer); void x_trans_button_cb(Widget, XtPointer, XtPointer); void y_trans_button_cb(Widget, XtPointer, XtPointer); void z_trans_button_cb(Widget, XtPointer, XtPointer); void x_rot_text_focus_cb(Widget, XtPointer, XtPointer); void y_rot_text_focus_cb(Widget, XtPointer, XtPointer); void z_rot_text_focus_cb(Widget, XtPointer, XtPointer); void x_trans_text_focus_cb(Widget, XtPointer, XtPointer); void y_trans_text_focus_cb(Widget, XtPointer, XtPointer); void z_trans_text_focus_cb(Widget, XtPointer, XtPointer); /* <--aro */ int i,n,count; char istring[16]; Widget rc[2], frame, atoms_label, region, button, invert, reset; Widget discard,make_perm; XmString title; if(!edit_posn_dialog){ title=XmStringCreateLocalized("Edit relative positions"); n=0; XtSetArg (args[n],XmNautoUnmanage, False); n++; XtSetArg (args[n],XmNdialogTitle,title); n++; edit_posn_dialog=XmCreateMessageDialog(parent,"edit_posn",args,n); rc[0]=XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,edit_posn_dialog,NULL); /* aro--> */ /* PushButton and TextField Widgets are created for use in rotation and translation, callbacks added to each */ rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); rot_text_label = XtVaCreateManagedWidget ("Enter value for rotation about X, Y, or Z", xmLabelWidgetClass, rc[1], NULL); rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); x_rot_text = XtVaCreateManagedWidget ("x_rot_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(x_rot_text, XmNfocusCallback, x_rot_text_focus_cb, NULL); x_rot_button = XtVaCreateManagedWidget ("X", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(x_rot_button, XmNactivateCallback, x_rot_button_cb, NULL); y_rot_text = XtVaCreateManagedWidget ("y_rot_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(y_rot_text, XmNfocusCallback, y_rot_text_focus_cb, NULL); y_rot_button = XtVaCreateManagedWidget ("Y", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(y_rot_button, XmNactivateCallback, y_rot_button_cb, NULL); z_rot_text = XtVaCreateManagedWidget ("z_rot_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(z_rot_text, XmNfocusCallback, z_rot_text_focus_cb, NULL); z_rot_button = XtVaCreateManagedWidget ("Z", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(z_rot_button, XmNactivateCallback, z_rot_button_cb, NULL); /* Create translation PushButtons and TextFields */ rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); trans_text_label = XtVaCreateManagedWidget ("Enter value for translation along X, Y, or Z", xmLabelWidgetClass, rc[1], NULL); rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); x_trans_text = XtVaCreateManagedWidget ("x_trans_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(x_trans_text, XmNfocusCallback, x_trans_text_focus_cb, NULL); x_trans_button = XtVaCreateManagedWidget ("X", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(x_trans_button, XmNactivateCallback, x_trans_button_cb, NULL); y_trans_text = XtVaCreateManagedWidget ("y_trans_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(y_trans_text, XmNfocusCallback, y_trans_text_focus_cb, NULL); y_trans_button = XtVaCreateManagedWidget ("Y", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(y_trans_button, XmNactivateCallback, y_trans_button_cb, NULL); z_trans_text = XtVaCreateManagedWidget ("z_trans_text", xmTextFieldWidgetClass, rc[1], XmNcolumns, 8, NULL); XtAddCallback(z_trans_text, XmNfocusCallback, z_trans_text_focus_cb, NULL); z_trans_button = XtVaCreateManagedWidget ("Z", xmPushButtonWidgetClass, rc[1], NULL); XtAddCallback(z_trans_button, XmNactivateCallback, z_trans_button_cb, NULL); /* <--aro */ rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); title = XmStringCreateLocalized("Rotate atoms about X"); x_rot = XtVaCreateManagedWidget ("x_rot",xmScaleWidgetClass, rc[1], XmNmaximum, 180, XmNminimum, -180, XmNvalue, 0, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(x_rot, XmNvalueChangedCallback, rot_store_geom, NULL); XtAddCallback(x_rot, XmNdragCallback, x_rot_cb, NULL); title = XmStringCreateLocalized("Translate atoms along X"); x_trans = XtVaCreateManagedWidget ("x_trans",xmScaleWidgetClass, rc[1], XmNmaximum, 100, XmNminimum, -100, XmNvalue, 0, XmNshowValue, False, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(x_trans,XmNvalueChangedCallback,trans_store_geom_cb, NULL); XtAddCallback(x_trans, XmNdragCallback, x_trans_cb, NULL); rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); title = XmStringCreateLocalized("Rotate atoms about Y"); y_rot = XtVaCreateManagedWidget ("y_rot",xmScaleWidgetClass, rc[1], XmNmaximum, 180, XmNminimum, -180, XmNvalue, 0, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(y_rot, XmNvalueChangedCallback, rot_store_geom, NULL); XtAddCallback(y_rot, XmNdragCallback, y_rot_cb, NULL); title = XmStringCreateLocalized("Translate atoms along Y"); y_trans = XtVaCreateManagedWidget ("y_trans",xmScaleWidgetClass, rc[1], XmNmaximum, 100, XmNminimum, -100, XmNvalue, 0, XmNshowValue, False, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(y_trans,XmNvalueChangedCallback, trans_store_geom_cb, NULL); XtAddCallback(y_trans,XmNdragCallback, y_trans_cb, NULL); rc[1]=XtVaCreateManagedWidget ("epd_rc1", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); title = XmStringCreateLocalized("Rotate atoms about Z"); z_rot = XtVaCreateManagedWidget ("z_rot",xmScaleWidgetClass, rc[1], XmNmaximum, 180, XmNminimum, -180, XmNvalue, 0, XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(z_rot, XmNvalueChangedCallback, rot_store_geom, NULL); XtAddCallback(z_rot, XmNdragCallback, z_rot_cb, NULL); title = XmStringCreateLocalized("Translate atoms along Z"); z_trans = XtVaCreateManagedWidget ("z_trans",xmScaleWidgetClass, rc[1], XmNmaximum, 100, XmNminimum, -100, XmNvalue, 0, XmNshowValue, False, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(z_trans,XmNvalueChangedCallback,trans_store_geom_cb, NULL); XtAddCallback(z_trans,XmNdragCallback,z_trans_cb, NULL); frame=XtVaCreateManagedWidget ("frame1", xmFrameWidgetClass, rc[0], XmNshadowType, XmSHADOW_IN, NULL); rc[1]=XtVaCreateManagedWidget ("types", xmRowColumnWidgetClass,frame, XmNorientation, XmVERTICAL, NULL); atoms_label= XtVaCreateManagedWidget ("Manipulate which atoms?", xmLabelWidgetClass,rc[1], XmNalignment, XmALIGNMENT_BEGINNING, NULL); region = XmCreateRadioBox(rc[1], "Act in:", NULL, 0); button = XtVaCreateManagedWidget("Act on everything", xmToggleButtonGadgetClass, region, NULL); if(posn_act_on == WHOLE_CANVAS) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, posn_act_on_cb, (XtPointer) WHOLE_CANVAS); button = XtVaCreateManagedWidget("Act inside region", xmToggleButtonGadgetClass, region, NULL); if(posn_act_on == INSIDE_REGION) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, posn_act_on_cb, (XtPointer) INSIDE_REGION); button = XtVaCreateManagedWidget("Act outside region", xmToggleButtonGadgetClass, region, NULL); if(posn_act_on == OUTSIDE_REGION) { XtVaSetValues(button, XmNset, True, NULL); } XtAddCallback(button, XmNvalueChangedCallback, posn_act_on_cb, (XtPointer) OUTSIDE_REGION); XtManageChild(region); if(edit_posn_type_btn){ free(edit_posn_type_btn); free(atom_group); } edit_posn_type_btn=malloc(no_atom_types*sizeof(Widget)); atom_group=malloc(no_atom_types*sizeof(struct atom_group)); count=0; for (i = 0; i < get_no_elements(); i++) { if(element[i].any_atoms) { sprintf(istring,"Toggle %s atoms",element[i].label); edit_posn_type_btn[count]=XtVaCreateManagedWidget (istring,xmPushButtonWidgetClass,rc[1],NULL); XtAddCallback(edit_posn_type_btn[count],XmNactivateCallback, posn_atoms_type_cb,(XtPointer)count); strcpy(atom_group[count].label,element[i].label); count++; } } invert=XtVaCreateManagedWidget ("Invert selection",xmPushButtonWidgetClass,rc[1],NULL); XtAddCallback(invert,XmNactivateCallback,edit_posn_invert_cb,NULL); reset=XtVaCreateManagedWidget ("Reselect all",xmPushButtonWidgetClass,rc[1],NULL); XtAddCallback(reset,XmNactivateCallback,edit_posn_reset_cb,NULL); rc[1]=XtVaCreateManagedWidget ("types", xmRowColumnWidgetClass,rc[0], XmNorientation, XmHORIZONTAL, NULL); discard=XtVaCreateManagedWidget ("Discard changes",xmPushButtonWidgetClass,rc[1],NULL); XtAddCallback(discard,XmNactivateCallback,edit_posn_discard_cb, NULL); make_perm=XtVaCreateManagedWidget ("Make changes permanent",xmPushButtonWidgetClass,rc[1],NULL); XtAddCallback(make_perm,XmNactivateCallback,edit_posn_make_perm_cb,NULL); XtAddCallback(edit_posn_dialog,XmNcancelCallback,edit_posn_cancel_cb,NULL); XtUnmanageChild (XmMessageBoxGetChild(edit_posn_dialog,XmDIALOG_OK_BUTTON)); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(edit_posn_dialog,XmDIALOG_HELP_BUTTON)); } XtAddCallback (edit_posn_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(edit_posn_dialog); /* set the position if it is available - else just egtthe position */ if(edit_posn_dialog_pos_are_avail == 1) { XtVaSetValues(edit_posn_dialog, XmNx, edit_posn_dialog_xpos, XmNy, edit_posn_dialog_ypos, NULL); } else { get_edit_posn_dialog_position(); } } void edit_posn_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void change_frame(int, Boolean, Boolean); void get_edit_posn_dialog_position(void); int i; /* Get the position of the widget before killing it */ get_edit_posn_dialog_position(); XtDestroyWidget(edit_posn_dialog); edit_posn_dialog=NULL; free(edit_posn_type_btn); edit_posn_type_btn = NULL; /* Reset the translation and rotation attributes of the atoms */ for(i = 0; i < no_atoms; i++) { atoms[i].edit = 1; } change_frame(frame_no,False,False); } void get_edit_posn_dialog_position(void) { /* Get the position of the widget */ XtVaGetValues(edit_posn_dialog, XmNx, &edit_posn_dialog_xpos, XmNy, &edit_posn_dialog_ypos, NULL); edit_posn_dialog_pos_are_avail = 1; } void edit_posn_invert_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); int i; int *atoms_in_region = NULL; if((posn_act_on == INSIDE_REGION) || (posn_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } for(i = 0; i < no_atoms; i++) { if((posn_act_on == WHOLE_CANVAS) || ((posn_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((posn_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { if(atoms[i].edit == 0) { atoms[i].edit = 1; } else { atoms[i].edit = 0; } } } redraw = 1; canvas_cb(canvas, NULL, NULL); } void edit_posn_reset_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); int i; int *atoms_in_region = NULL; if((posn_act_on == INSIDE_REGION) || (posn_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } for(i = 0; i < no_atoms; i++) { if((posn_act_on == WHOLE_CANVAS) || ((posn_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((posn_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { atoms[i].edit = 1; } } redraw = 1; canvas_cb(canvas, NULL, NULL); } void x_trans_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void translate_atoms(double *); double vec[3]; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; vec[0] = (double) cbs->value/100; vec[1] = 0; vec[2] = 0; restore_geom(); translate_atoms(vec); } void y_trans_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void translate_atoms(double *); double vec[3]; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; vec[0] = 0; vec[1] = (double) cbs->value/100; vec[2] = 0; restore_geom(); translate_atoms(vec); } void z_trans_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void translate_atoms(double *); double vec[3]; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; vec[0] = 0; vec[1] = 0; vec[2] = (double) cbs->value/100; restore_geom(); translate_atoms(vec); } void trans_store_geom_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void store_coords(void); store_coords(); /* Reset scale bars after each translation */ if(edit_posn_dialog){ XtVaSetValues(x_trans,XmNvalue,0,NULL); XtVaSetValues(y_trans,XmNvalue,0,NULL); XtVaSetValues(z_trans,XmNvalue,0,NULL); } } void x_rot_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); int x_rot; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; x_rot = cbs->value-last_value; last_value=cbs->value; phi=x_rot*PI/180.0; axis[0] = 1.0; axis[1] = 0.0; axis[2] = 0.0; atoms_sorted=0; /* Depths have changed */ redraw=1; rotate_atoms(axis,phi,1,True); } void y_rot_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); int y_rot; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; y_rot = cbs->value-last_value; last_value=cbs->value; phi=y_rot*PI/180.0; axis[0] = 0.0; axis[1] = 1.0; axis[2] = 0.0; atoms_sorted=0; /* Depths have changed */ redraw=1; rotate_atoms(axis,phi,1,True); } void z_rot_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); int z_rot; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; z_rot = cbs->value-last_value; last_value=cbs->value; phi=z_rot*PI/180.0; axis[0] = 0.0; axis[1] = 0.0; axis[2] = 1.0; redraw=1; rotate_atoms(axis,phi,1,True); } void rot_store_geom(Widget widget, XtPointer client_data, XtPointer call_data) { last_value=0; /* Reset scale bars after each rotation */ if(edit_posn_dialog != NULL){ XtVaSetValues(x_rot,XmNvalue,0,NULL); XtVaSetValues(y_rot,XmNvalue,0,NULL); XtVaSetValues(z_rot,XmNvalue,0,NULL); } } /* aro--> */ /* Callbacks for PushButtons and TextFields implemented. Most code to do rotations copied from x_rot_cb, y_rot_cb, z_rot_cb, , and most code to do translations copied from x_trans_cb, y_trans_cb, z_trans_cb above */ void x_rot_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); char *text; double rot_x; XtVaGetValues(x_rot_text, XmNvalue, &text, NULL); rot_x = atof(text); phi=rot_x*PI/180.0; axis[0] = 1.0; axis[1] = 0.0; axis[2] = 0.0; atoms_sorted=0; /* Depths have changed */ redraw=1; rotate_atoms(axis,phi,1,True); } void y_rot_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); char *text; double rot_y; XtVaGetValues(y_rot_text, XmNvalue, &text, NULL); rot_y = atof(text); phi=rot_y*PI/180.0; axis[0] = 0.0; axis[1] = 1.0; axis[2] = 0.0; atoms_sorted=0; /* Depths have changed */ redraw=1; rotate_atoms(axis,phi,1,True); } void z_rot_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void rotate_atoms(double *,double,Boolean,Boolean); char *text; double rot_z; XtVaGetValues(z_rot_text, XmNvalue, &text, NULL); rot_z = atof(text); phi=rot_z*PI/180.0; axis[0] = 0.0; axis[1] = 0.0; axis[2] = 1.0; atoms_sorted=0; /* Depths have changed */ redraw=1; rotate_atoms(axis,phi,1,True); } void x_trans_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void store_coords(void); void translate_atoms(double *); char *text; double vec[3]; XtVaGetValues(x_trans_text, XmNvalue, &text, NULL); vec[0] = atof(text); vec[1] = 0; vec[2] = 0; restore_geom(); translate_atoms(vec); store_coords(); } void y_trans_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void store_coords(void); void translate_atoms(double *); char *text; double vec[3]; XtVaGetValues(y_trans_text, XmNvalue, &text, NULL); vec[0] = 0; vec[1] = atof(text); vec[2] = 0; restore_geom(); translate_atoms(vec); store_coords(); } void z_trans_button_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void restore_geom(void); void store_coords(void); void translate_atoms(double *); char *text; double vec[3]; XtVaGetValues(z_trans_text, XmNvalue, &text, NULL); vec[0] = 0; vec[1] = 0; vec[2] = atof(text); restore_geom(); translate_atoms(vec); store_coords(); } /* TextField callbacks simply set default button to be the corresponding button to the TextField (if TextField for x-axis gets focus, set default button to be the button that applies the change to the x-axis, etc...) */ void x_rot_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, x_rot_button, NULL); } void y_rot_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, y_rot_button, NULL); } void z_rot_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, z_rot_button, NULL); } void x_trans_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, x_trans_button, NULL); } void y_trans_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, y_trans_button, NULL); } void z_trans_text_focus_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues(edit_posn_dialog, XmNdefaultButton, z_trans_button, NULL); } /* <--aro */ void posn_atoms_type_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int * get_atoms_in_region(void); Boolean region_active_p(void); void update_atoms_in_region(Boolean); int i,at_type; int *atoms_in_region = NULL; at_type = (int) client_data; if((posn_act_on == INSIDE_REGION) || (posn_act_on == OUTSIDE_REGION)) { if(region_active_p() == 1) { update_atoms_in_region(1); atoms_in_region = get_atoms_in_region(); } else { echo_to_message_area("Region is not active"); return; } } for(i = 0; i < no_atoms; i++) { if(strcmp(atom_group[at_type].label, atoms[i].uppercase_label) == 0) { if((posn_act_on == WHOLE_CANVAS) || ((posn_act_on == INSIDE_REGION) && (atoms_in_region[i] == 1)) || ((posn_act_on == OUTSIDE_REGION) && (atoms_in_region[i] == 0))) { if(atoms[i].edit == 0) { atoms[i].edit = 1; } else { atoms[i].edit = 0; } } } } redraw = 1; canvas_cb(canvas, NULL, NULL); } void edit_posn_discard_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void change_frame(int,Boolean,Boolean); change_frame(frame_no,True,False); } void edit_posn_make_perm_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void get_gx_coords (void); struct frame * get_selected_frame (); int i; struct frame *this_frame; /* To make the changes permanent, get the gx coordinates (the coordintates in the global axis frame, and write them to frame[frame_no] */ this_frame = get_selected_frame (); if (this_frame == NULL) { echo_to_message_area ("No data loaded"); return; } get_gx_coords (); for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].x = atoms[i].g[0]; this_frame->atom[i].y = atoms[i].g[1]; this_frame->atom[i].z = atoms[i].g[2]; } } void make_scale_coords_dialog (Widget parent) { void scale_coords_atob_cb (Widget, XtPointer, XtPointer); void scale_coords_btoa_cb (Widget, XtPointer, XtPointer); void scale_coords_cancel_cb (Widget, XtPointer, XtPointer); void scale_coords_ok_cb (Widget, XtPointer, XtPointer); int n = 0; Widget atob, btoa, child, rc; XmString label = ""; if (! scale_coords_dialog) { label = XmStringCreateLocalized ("Scale Coordinates"); XtSetArg (args[n], XmNautoUnmanage, False); n++; XtSetArg (args[n], XmNdialogTitle, label); n++; scale_coords_dialog = (Widget) XmCreateMessageDialog (parent, "scale_coords", args, n); XtAddCallback (scale_coords_dialog, XmNcancelCallback, scale_coords_cancel_cb, NULL); rc = XtVaCreateManagedWidget ("rc", xmRowColumnWidgetClass, scale_coords_dialog, NULL); btoa = XtVaCreateManagedWidget ("Bohr->Angstrom", xmPushButtonWidgetClass, rc, NULL); atob = XtVaCreateManagedWidget ("Angstrom->Bohr", xmPushButtonWidgetClass, rc, NULL); XtVaCreateManagedWidget ("Scale factor:", xmLabelWidgetClass, rc, XmNalignment, XmALIGNMENT_BEGINNING, NULL); child = XtVaCreateManagedWidget ("scale_factor", xmTextFieldWidgetClass, rc, NULL); XtVaSetValues (child, XmNvalue, "1.0", NULL); XtAddCallback (atob, XmNactivateCallback, scale_coords_atob_cb, child); XtAddCallback (btoa, XmNactivateCallback, scale_coords_btoa_cb, child); XtAddCallback (scale_coords_dialog, XmNokCallback, scale_coords_ok_cb, child); XtUnmanageChild (XmMessageBoxGetChild (scale_coords_dialog, XmDIALOG_HELP_BUTTON)); } XtAddCallback (scale_coords_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (scale_coords_dialog); XmStringFree (label); } void scale_coords_atob_cb (Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues (client_data, XmNvalue, "1.88972613392", NULL); } void scale_coords_btoa_cb (Widget widget, XtPointer client_data, XtPointer call_data) { XtVaSetValues (client_data, XmNvalue, "0.5291772083", NULL); } void scale_coords_cancel_cb (Widget widget, XtPointer client_data, XtPointer call_data) { XtUnmanageChild (scale_coords_dialog); } void scale_coords_ok_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void scale_coords (char *); char *scale_factor_string; XtVaGetValues (client_data, XmNvalue, &scale_factor_string, NULL); scale_coords (scale_factor_string); } void scale_coords (char *scale_factor_string) { void change_frame (int, Boolean, Boolean); struct frame * get_first_frame (); int i, j; char message[32]; double scale_factor; struct frame *this_frame; if ((strlen (scale_factor_string) == 0) || (sscanf (scale_factor_string, "%lf", &scale_factor) <= 0)) { echo_to_message_area ("Cannot parse string!"); return; } this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].x *= scale_factor; this_frame->atom[i].y *= scale_factor; this_frame->atom[i].z *= scale_factor; for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if (this_frame->atom[i].has_vector > j) { this_frame->atom[i].vx[j] *= scale_factor; this_frame->atom[i].vy[j] *= scale_factor; this_frame->atom[i].vz[j] *= scale_factor; } } } this_frame = this_frame->next; } change_frame(frame_no, False, False); sprintf (message, "Coordinates scaled by %lf", scale_factor); echo_to_message_area (message); } void make_edit_atbd_sizes_dialog(Widget parent) { void at_scale_cb(Widget, XtPointer, XtPointer); void bd_scale_cb(Widget, XtPointer, XtPointer); void edit_atbd_sizes_dlg_cancel_cb(Widget, XtPointer, XtPointer); double get_atom_scale(void); double get_bond_scale(void); double get_hbond_scale(void); void hbd_scale_cb(Widget, XtPointer, XtPointer); void never_use_vdw_cb (Widget, XtPointer, XtPointer); int n=0; Widget rc; XmString title; if(!edit_atbd_sizes_dialog){ title=XmStringCreateLocalized("Edit atom/bond sizes"); n=0; XtSetArg(args[n],XmNdialogTitle,title); n++; edit_atbd_sizes_dialog= XmCreateMessageDialog(parent,"edit",args,n); rc=XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,edit_atbd_sizes_dialog,NULL); title=XmStringCreateLocalized("Atoms: % covalent radius"); at_scale_w=XtVaCreateManagedWidget ("at_scale_w", xmScaleWidgetClass, rc, XmNmaximum, 200, XmNminimum, 0, XmNvalue, (int) (get_atom_scale() * 100), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(at_scale_w,XmNdragCallback, at_scale_cb,NULL); XtAddCallback(at_scale_w,XmNvalueChangedCallback, at_scale_cb,NULL); title=XmStringCreateLocalized("Bonds: % smallest covalent radius"); bd_scale_w=XtVaCreateManagedWidget ("bd_scale_w", xmScaleWidgetClass, rc, XmNmaximum, 100, XmNminimum, 0, XmNvalue, (int) (get_bond_scale() * 100), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(bd_scale_w,XmNdragCallback, bd_scale_cb,NULL); XtAddCallback(bd_scale_w,XmNvalueChangedCallback, bd_scale_cb,NULL); title=XmStringCreateLocalized("H-bonds: % H covalent radius"); hbd_scale_w=XtVaCreateManagedWidget ("hbd_scale_w", xmScaleWidgetClass, rc, XmNmaximum, 100, XmNminimum, 0, XmNvalue, (int) (get_hbond_scale() * 100), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(hbd_scale_w,XmNdragCallback, hbd_scale_cb,NULL); XtAddCallback(hbd_scale_w,XmNvalueChangedCallback, hbd_scale_cb,NULL); XtUnmanageChild (XmMessageBoxGetChild(edit_atbd_sizes_dialog,XmDIALOG_OK_BUTTON)); XtAddCallback(edit_atbd_sizes_dialog, XmNcancelCallback, edit_atbd_sizes_dlg_cancel_cb,NULL); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(edit_atbd_sizes_dialog,XmDIALOG_HELP_BUTTON)); XtManageChild (XmCreateSeparator (rc, "sep", NULL, 0)); never_use_vdw_w = XtVaCreateManagedWidget ("Never use van der Waals radii", xmToggleButtonGadgetClass, rc, NULL); if (never_use_vdw) { XtVaSetValues (never_use_vdw_w, XmNset, True, NULL); } XtAddCallback (never_use_vdw_w, XmNvalueChangedCallback, never_use_vdw_cb, (XtPointer) 1); } XtAddCallback (edit_atbd_sizes_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(edit_atbd_sizes_dialog); } void edit_atbd_sizes_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(edit_atbd_sizes_dialog); edit_atbd_sizes_dialog=NULL; } void at_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_atom_scale(double); void update_bbox(void); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; set_atom_scale((double) (scale/100.0)); /* Because the bounding box incorporates the atoms, it may need updating */ if((atom_flag == 1) && (bbox_flag == 1)) { update_bbox(); } redraw=1; canvas_cb(canvas,NULL,NULL); } void bd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_bond_scale(double); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; set_bond_scale((double) (scale / 100.0)); redraw=1; canvas_cb(canvas,NULL,NULL); } void hbd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_hbond_scale(double); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; set_hbond_scale((double) (scale / 100.0)); redraw=1; canvas_cb(canvas,NULL,NULL); } void never_use_vdw_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); if (never_use_vdw == 0) { never_use_vdw = 1; } else { never_use_vdw = 0; } redraw = 1; canvas_cb (canvas, NULL, NULL); /* update display */ } void make_edit_bond_fudges_dialog(Widget parent) { void bdfd_scale_cb(Widget,XtPointer,XtPointer); void edit_bond_fudges_dlg_cancel_cb(Widget,XtPointer,XtPointer); void hbdfd_scale_cb(Widget,XtPointer,XtPointer); /* Intramolecular */ void ibdfd_scale_cb (Widget, XtPointer, XtPointer); void ihbdfd_scale_cb (Widget, XtPointer, XtPointer); int n=0; Widget rc; XmString title; if(!edit_bond_fudges_dialog){ title=XmStringCreateLocalized("Bond factors"); n=0; XtSetArg(args[n],XmNdialogTitle,title); n++; edit_bond_fudges_dialog= XmCreateMessageDialog(parent,"edit",args,n); rc=XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,edit_bond_fudges_dialog,NULL); title=XmStringCreateLocalized("Intermolecular bond factor"); bdfd_scale_w=XtVaCreateManagedWidget ("bdfd_scale_w",xmScaleWidgetClass, rc, XmNmaximum, 200, XmNminimum, 0, XmNvalue, (int)(bdfd_factor * 50), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(bdfd_scale_w,XmNdragCallback,bdfd_scale_cb,NULL); XtAddCallback(bdfd_scale_w,XmNvalueChangedCallback,bdfd_scale_cb,NULL); title = XmStringCreateLocalized ("Intramolecular bond factor"); ibdfd_scale_w = XtVaCreateManagedWidget ("ibdfd_scale_w", xmScaleWidgetClass, rc, XmNmaximum, 200, XmNminimum, 0, XmNvalue, (int)(ibdfd_factor * 50), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback (ibdfd_scale_w, XmNdragCallback, ibdfd_scale_cb, NULL); XtAddCallback (ibdfd_scale_w, XmNvalueChangedCallback, ibdfd_scale_cb, NULL); XtManageChild (XmCreateSeparator (rc, "sep", NULL, 0)); title=XmStringCreateLocalized("Intermolecular H-bond factor"); hbdfd_scale_w=XtVaCreateManagedWidget ("hbdfd_scale_w",xmScaleWidgetClass, rc, XmNmaximum, 100, XmNminimum, 0, XmNvalue, (int)(hbdfd_factor * 50), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback(hbdfd_scale_w,XmNdragCallback,hbdfd_scale_cb,NULL); XtAddCallback(hbdfd_scale_w,XmNvalueChangedCallback,hbdfd_scale_cb,NULL); title = XmStringCreateLocalized ("Intramolecular H-bond factor"); ihbdfd_scale_w = XtVaCreateManagedWidget ("ihbdfd_scale_w", xmScaleWidgetClass, rc, XmNmaximum, 100, XmNminimum, 0, XmNvalue, (int)(ihbdfd_factor * 50), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); XtAddCallback (ihbdfd_scale_w, XmNdragCallback, ihbdfd_scale_cb, NULL); XtAddCallback (ihbdfd_scale_w, XmNvalueChangedCallback, ihbdfd_scale_cb, NULL); XtAddCallback(edit_bond_fudges_dialog, XmNcancelCallback, edit_bond_fudges_dlg_cancel_cb,NULL); XtUnmanageChild (XmMessageBoxGetChild(edit_bond_fudges_dialog,XmDIALOG_OK_BUTTON)); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(edit_bond_fudges_dialog,XmDIALOG_HELP_BUTTON)); } XtAddCallback (edit_bond_fudges_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(edit_bond_fudges_dialog); } void edit_bond_fudges_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(edit_bond_fudges_dialog); edit_bond_fudges_dialog=NULL; } void bdfd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bond_matrix(Boolean); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; bdfd_factor = (double) (scale/50.0); update_bond_matrix(False); redraw=1; canvas_cb(canvas,NULL,NULL); } void hbdfd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bond_matrix(Boolean); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; hbdfd_factor = (double) (scale/50.0); update_bond_matrix(False); redraw=1; canvas_cb(canvas,NULL,NULL); } void ibdfd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bond_matrix(Boolean); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; ibdfd_factor = (double) (scale/50.0); update_bond_matrix(False); redraw=1; canvas_cb(canvas,NULL,NULL); } void ihbdfd_scale_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bond_matrix(Boolean); int scale; XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; scale = cbs->value; ihbdfd_factor = (double) (scale/50.0); update_bond_matrix(False); redraw=1; canvas_cb(canvas,NULL,NULL); } void make_vector_display_dialog(Widget main_window) { void arrow_angle_scale_cb (Widget, XtPointer, XtPointer); void arrow_scale_scale_cb (Widget, XtPointer, XtPointer); void arrow_type_cb (Widget, XtPointer, XtPointer); double get_vector_arrow_angle (void); double get_vector_arrow_scale (void); double get_vector_scale (void); void vector_scale_scale_cb (Widget, XtPointer, XtPointer); void vector_display_dialog_cancel_cb (Widget, XtPointer, XtPointer); int n; Widget row_column, arrow_angle_scale, arrow_scale_scale, vector_scale_scale; Widget arrow_type_RadioBox, radio_button; XmString title; if(vector_display_dialog == NULL) { title = XmStringCreateLocalized("Edit vector display"); n = 0; XtSetArg(args[n], XmNautoUnmanage, False); n++; XtSetArg(args[n], XmNdialogTitle, title); n++; vector_display_dialog = XmCreateMessageDialog(main_window, "vector_display", args, n); row_column = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, vector_display_dialog, NULL); title = XmStringCreateLocalized("Vector scale (* 10)"); vector_scale_scale = XtVaCreateManagedWidget("vector_scale_scale", xmScaleWidgetClass, row_column, XmNminimum, -100, XmNmaximum, 100, XmNvalue, (int) (10 * get_vector_scale ()), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); /* Add callbacks */ XtAddCallback(vector_scale_scale, XmNvalueChangedCallback, vector_scale_scale_cb, NULL); XtAddCallback(vector_scale_scale, XmNdragCallback, vector_scale_scale_cb, NULL); title = XmStringCreateLocalized("Vector arrow angle"); arrow_angle_scale = XtVaCreateManagedWidget("arrow_angle_scale", xmScaleWidgetClass, row_column, XmNminimum, 0, XmNmaximum, 80, XmNvalue, (int) get_vector_arrow_angle (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); /* Add callbacks */ XtAddCallback(arrow_angle_scale, XmNvalueChangedCallback, arrow_angle_scale_cb, NULL); XtAddCallback(arrow_angle_scale, XmNdragCallback, arrow_angle_scale_cb, NULL); title = XmStringCreateLocalized ("Vector arrow scale (% of total vector length)"); arrow_scale_scale = XtVaCreateManagedWidget("arrow_scale_scale", xmScaleWidgetClass, row_column, XmNminimum, 0, XmNmaximum, 50, XmNvalue, (int) (100 * get_vector_arrow_scale ()), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, title, NULL); /* Add callbacks */ XtAddCallback(arrow_scale_scale, XmNvalueChangedCallback, arrow_scale_scale_cb, NULL); XtAddCallback(arrow_scale_scale, XmNdragCallback, arrow_scale_scale_cb, NULL); /* Type of arrow rendering */ XtManageChild (XmCreateSeparator (row_column, "sep", NULL, 0)); XtVaCreateManagedWidget ("Type of arrow:", xmLabelWidgetClass, row_column, XmNalignment, XmALIGNMENT_BEGINNING, NULL); arrow_type_RadioBox = XmCreateRadioBox (row_column, "arrow_type", NULL, 0); radio_button = XtVaCreateManagedWidget ("Open", xmToggleButtonGadgetClass, arrow_type_RadioBox, NULL); if (arrow_type == ARROW_OPEN) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback(radio_button, XmNvalueChangedCallback, arrow_type_cb, (XtPointer) ARROW_OPEN); radio_button = XtVaCreateManagedWidget ("Closed", xmToggleButtonGadgetClass, arrow_type_RadioBox, NULL); if (arrow_type == ARROW_CLOSED) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback(radio_button, XmNvalueChangedCallback, arrow_type_cb, (XtPointer) ARROW_CLOSED); radio_button = XtVaCreateManagedWidget ("Filled", xmToggleButtonGadgetClass, arrow_type_RadioBox, NULL); if (arrow_type == ARROW_FILLED) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback(radio_button, XmNvalueChangedCallback, arrow_type_cb, (XtPointer) ARROW_FILLED); XtManageChild (arrow_type_RadioBox); /* Cancel callback */ XtAddCallback(vector_display_dialog, XmNcancelCallback, vector_display_dialog_cancel_cb, NULL); /* Unmanage the OK button */ XtUnmanageChild(XmMessageBoxGetChild(vector_display_dialog, XmDIALOG_OK_BUTTON)); /* Unmanage the HELP button */ XtUnmanageChild(XmMessageBoxGetChild(vector_display_dialog, XmDIALOG_HELP_BUTTON)); /* Free title */ XmStringFree(title); } XtAddCallback (vector_display_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(vector_display_dialog); } void arrow_type_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); arrow_type = (enum arrow_types) client_data; redraw = 1; canvas_cb (canvas, NULL, NULL); } void vector_display_dialog_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(vector_display_dialog); vector_display_dialog = NULL; } void vector_scale_scale_cb(Widget vector_scale_scale, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_vector_scale(double); int scale; static int last_scale; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; scale = cbs->value; if(scale == last_scale) { return; } last_scale = scale; set_vector_scale(scale/10.0); if (vector_flag == 1) { redraw = 1; canvas_cb (main_w, NULL, NULL); } } void arrow_angle_scale_cb(Widget arrow_angle_scale, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void set_vector_arrow_angle (double); int scale; static int last_scale; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; scale = cbs->value; if(scale == last_scale) { return; } last_scale = scale; set_vector_arrow_angle ((double) scale); if (vector_flag == 1) { redraw = 1; canvas_cb (main_w, NULL, NULL); } } void arrow_scale_scale_cb(Widget arrow_scale_scale, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void set_vector_arrow_scale (double); int scale; static int last_scale; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; scale = cbs->value; if(scale == last_scale) { return; } last_scale = scale; set_vector_arrow_scale (scale / 100.0); if (vector_flag == 1) { redraw = 1; canvas_cb (main_w, NULL, NULL); } } void visi_act_on_cb(Widget widget, XtPointer client_data, XtPointer call_data) { int which = (int) client_data; visi_act_on = which; } void posn_act_on_cb(Widget widget, XtPointer client_data, XtPointer call_data) { int which = (int) client_data; posn_act_on = which; } /* wjq--> */ void make_bbox_dialog(Widget parent) { void bbox_dlg_cancel_cb(Widget, XtPointer, XtPointer); void bbox_ok_cb(Widget, XtPointer, XtPointer); void bbox_reset_cb(Widget, XtPointer, XtPointer); void echo_to_message_area (char *); /* It's rubish to do it the following way, but due to my inexperience it is the easiest. * At least it works now. I hope to correct it during the next weeks */ void Xmin_cb(Widget, XtPointer, XtPointer); void Ymin_cb(Widget, XtPointer, XtPointer); void Zmin_cb(Widget, XtPointer, XtPointer); void Xmax_cb(Widget, XtPointer, XtPointer); void Ymax_cb(Widget, XtPointer, XtPointer); void Zmax_cb(Widget, XtPointer, XtPointer); void bbox_determine_cb (Widget, XtPointer, XtPointer); void update_bbox (void); int n; char Value_str[10]; Widget widget,rc,bbLabel; Widget bbox_RadioBox, radio_button; Widget bbox_reset_button; /* If no file is loaded we give a message and exit. */ if (no_frames == 0) { echo_to_message_area("It is only possible to edit the bounding box if a file is loaded!"); return; } /* If this window is opened, we show the bounding box. Who wants to edit something he can't see. If it is not needed, the user can switch off the bbox via the menu. */ bbox_flag = 1; if((widget = XtNameToWidget(nth_menu[4], "button_7"))) XtVaSetValues(widget, XmNset, True, NULL); update_bbox(); if(!bbox_dialog){ XmString title; XmString cancel_str; title=XmStringCreateLocalized("Edit Bounding Box"); cancel_str=XmStringCreateLocalized("Close"); n=0; XtSetArg (args[n],XmNautoUnmanage, False); n++; XtSetArg (args[n],XmNdialogTitle,title); n++; XtSetArg (args[n],XmNwidth,320); n++; XtSetArg (args[n],XmNcancelLabelString, cancel_str); n++; XtSetArg (args[n],XmNentryAlignment, XmALIGNMENT_CENTER); n++; bbox_dialog=XmCreateMessageDialog(parent,"Bounding Box",args,n); XmStringFree(cancel_str); XmStringFree(title); rc=XtVaCreateManagedWidget ("rc",xmRowColumnWidgetClass,bbox_dialog, NULL); /* Determine borders of bounding box automatically or by hand? */ XtVaCreateManagedWidget ("Determine size of bounding box...", xmLabelWidgetClass, rc, XmNalignment, XmALIGNMENT_CENTER, NULL); bbox_RadioBox = XmCreateRadioBox (rc, "bbox_type", NULL, 0); XtVaSetValues (bbox_RadioBox, XmNorientation, XmHORIZONTAL, XmNalignment, XmALIGNMENT_CENTER, NULL); radio_button = XtVaCreateManagedWidget ("automatically ", xmToggleButtonGadgetClass, bbox_RadioBox, NULL); if (bbox_type == AUTOMATIC) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback(radio_button, XmNvalueChangedCallback, bbox_determine_cb, (XtPointer) AUTOMATIC); radio_button = XtVaCreateManagedWidget ("from file", xmToggleButtonGadgetClass, bbox_RadioBox, NULL); if (bbox_type == FROM_FILE) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback(radio_button, XmNvalueChangedCallback, bbox_determine_cb, (XtPointer) FROM_FILE); XtManageChild (bbox_RadioBox); XtManageChild (XmCreateSeparator (rc, "sep", NULL, 0)); /* Here we enter the borders of the bounding box */ bbMin[0] = XmCreateRowColumn (rc, "bbMin", NULL, 0); XtVaSetValues (bbMin[0], /*XmNpacking, XmPACK_COLUMN, */ XmNnumColumns, 6, XmNorientation, XmHORIZONTAL, XmNisAligned, True, XmNentryAlignment, XmALIGNMENT_END, NULL); /* Xmin starts here */ bbLabel = XtVaCreateManagedWidget ("Xmin:", xmLabelWidgetClass,bbMin[0], NULL); XtManageChild(bbLabel); bbMin[1]=XtVaCreateManagedWidget("Xmin",xmTextFieldWidgetClass, bbMin[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.x_min); XtVaSetValues(bbMin[1], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMin[1]); XtAddCallback(bbMin[1],XmNvalueChangedCallback,Xmin_cb,NULL); /* Ymin starts here */ bbLabel = XtVaCreateManagedWidget (" Ymin:", xmLabelWidgetClass,bbMin[0], NULL); XtManageChild(bbLabel); bbMin[2]=XtVaCreateManagedWidget("Ymin",xmTextFieldWidgetClass, bbMin[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.y_min); XtVaSetValues(bbMin[2], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMin[2]); XtAddCallback(bbMin[2],XmNvalueChangedCallback,Ymin_cb,NULL); /* Zmin starts here */ bbLabel = XtVaCreateManagedWidget (" Zmin:", xmLabelWidgetClass,bbMin[0], NULL); XtManageChild(bbLabel); bbMin[3]=XtVaCreateManagedWidget("Zmin",xmTextFieldWidgetClass, bbMin[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.z_min); XtVaSetValues(bbMin[3], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMin[3]); XtAddCallback(bbMin[3],XmNvalueChangedCallback,Zmin_cb,NULL); XtManageChild(bbMin[0]); /* Here the entry of max values starts */ bbMax[0] = XmCreateRowColumn (rc, "bbMax", NULL, 0); XtVaSetValues (bbMax[0], /*XmNpacking, XmPACK_COLUMN, */ XmNnumColumns, 6, XmNorientation, XmHORIZONTAL, XmNisAligned, True, XmNentryAlignment, XmALIGNMENT_END, NULL); /* Xmax starts here */ bbLabel = XtVaCreateManagedWidget ("Xmax:", xmLabelWidgetClass,bbMax[0], NULL); XtManageChild(bbLabel); bbMax[1]=XtVaCreateManagedWidget("Xmax",xmTextFieldWidgetClass, bbMax[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.x_max); XtVaSetValues(bbMax[1], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMax[1]); XtAddCallback(bbMax[1],XmNvalueChangedCallback,Xmax_cb,NULL); /* Ymax starts here */ bbLabel = XtVaCreateManagedWidget (" Ymax:", xmLabelWidgetClass,bbMax[0], NULL); XtManageChild(bbLabel); bbMax[2]=XtVaCreateManagedWidget("Ymax",xmTextFieldWidgetClass, bbMax[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.y_max); XtVaSetValues(bbMax[2], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMax[2]); XtAddCallback(bbMax[2],XmNvalueChangedCallback,Ymax_cb,NULL); /* Zmax starts here */ bbLabel = XtVaCreateManagedWidget (" Zmax:", xmLabelWidgetClass,bbMax[0], NULL); XtManageChild(bbLabel); bbMax[3]=XtVaCreateManagedWidget("Zmax",xmTextFieldWidgetClass, bbMax[0], NULL); sprintf(Value_str,"%.2f",bbox_by_hand.z_max); XtVaSetValues(bbMax[3], XmNvalue, Value_str, XmNcolumns, 5, NULL); XtManageChild(bbMax[3]); XtAddCallback(bbMax[3],XmNvalueChangedCallback,Zmax_cb,NULL); XtManageChild(bbMax[0]); /* Add Button to reset the bounding box to the automatically * calculated values. */ bbox_reset_button = XtVaCreateManagedWidget ("Reset", xmPushButtonWidgetClass, bbox_dialog, NULL); XtAddCallback(bbox_reset_button, XmNactivateCallback, bbox_reset_cb, NULL); /* We use the Cancel-Button to close the dialog... */ XtAddCallback(bbox_dialog, XmNcancelCallback, bbox_dlg_cancel_cb,NULL); /* The OK-Button isn't used in this dialog and help is not yet available */ XtUnmanageChild (XmMessageBoxGetChild(bbox_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(bbox_dialog, XmDIALOG_HELP_BUTTON)); } XtAddCallback (bbox_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(bbox_dialog); } void bbox_dlg_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtDestroyWidget(bbox_dialog); bbox_dialog=NULL; } void bbox_ok_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void update_bbox_dialog(void); char *line=NULL; XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *) call_data; update_bbox_dialog(); XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &line); } void bbox_reset_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void update_bbox (void); void update_bbox_dialog(void); bbox_by_hand.x_max = 0.0; bbox_by_hand.y_max = 0.0; bbox_by_hand.z_max = 0.0; bbox_by_hand.x_min = 0.0; bbox_by_hand.y_min = 0.0; bbox_by_hand.z_min = 0.0; update_bbox_dialog (); } void Xmin_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.x_min = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void Ymin_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.y_min = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void Zmin_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.z_min = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void Xmax_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.x_max = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void Ymax_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.y_max = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void Zmax_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void update_bbox (void); char* Value_str; XtVaGetValues(widget,XmNvalue,&Value_str,NULL); bbox_by_hand.z_max = strtod(Value_str,NULL); update_bbox(); redraw = 1; canvas_cb(canvas,NULL,NULL); } void bbox_determine_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void update_bbox (void); void canvas_cb (Widget, XtPointer, XtPointer); bbox_type = (enum bbox_type) client_data; update_bbox(); redraw = 1; canvas_cb (canvas, NULL, NULL); } void update_bbox_dialog(void){ char Value_str[10]; if (bbox_dialog != NULL){ sprintf(Value_str,"%.2f",bbox_by_hand.x_min); XtVaSetValues(bbMin[1], XmNvalue, Value_str, XmNcolumns, 5, NULL); sprintf(Value_str,"%.2f",bbox_by_hand.y_min); XtVaSetValues(bbMin[2], XmNvalue, Value_str, XmNcolumns, 5, NULL); sprintf(Value_str,"%.2f",bbox_by_hand.z_min); XtVaSetValues(bbMin[3], XmNvalue, Value_str, XmNcolumns, 5, NULL); sprintf(Value_str,"%.2f",bbox_by_hand.x_max); XtVaSetValues(bbMax[1], XmNvalue, Value_str, XmNcolumns, 5, NULL); sprintf(Value_str,"%.2f",bbox_by_hand.y_max); XtVaSetValues(bbMax[2], XmNvalue, Value_str, XmNcolumns, 5, NULL); sprintf(Value_str,"%.2f",bbox_by_hand.z_max); XtVaSetValues(bbMax[3], XmNvalue, Value_str, XmNcolumns, 5, NULL); } } /* <--wjq */ void make_edit_element_props_dialog(Widget parent) { int get_no_elements(void); /* aro--> */ void edit_elements_apply_cb(Widget, XtPointer, XtPointer); void edit_elements_cancel_cb(Widget, XtPointer, XtPointer); void edit_elements_discard_cb(Widget, XtPointer, XtPointer); void edit_elements_record_id_cb(Widget, XtPointer, XtPointer); void edit_elements_save_cb(Widget, XtPointer, XtPointer); void free_widget_list_memory_cb(Widget, XtPointer, XtPointer); void revert_to_defaults_cb(Widget, XtPointer, XtPointer); void show_elements_cb(Widget, XtPointer, XtPointer); void update_edit_element_props_dialog(); Dimension dimension_width, dimension_height; int width; Widget v_scroll, temp_widget, radio_box; Widget header_label[6]; WidgetList rc_wlist; int i, n; /* aro - Moved edit_element_props_dialog to globabls.h so it can be used in update_some_dialogs() */ Widget scrolled_w, row_column[2]; XmString title, current, all, custom; if (edit_element_props_dialog == NULL) { /* aro - make sure head pointer is NULL at beginning */ widgets_changed.head = NULL; /* aro - changed from "View edit element properties" */ title = XmStringCreateLocalized("Edit element properties"); n = 0; XtSetArg (args[n], XmNautoUnmanage, False); n++; XtSetArg (args[n], XmNdialogTitle, title); n++; /* aro--> */ /* Set default button to none, so user can apply changes simply by pressing */ XtSetArg (args[n], XmNdefaultButtonType, XmDIALOG_NONE); n++; /* <--aro */ edit_element_props_dialog = XmCreateMessageDialog (parent, "edit_elements", args, n); scrolled_w = XtVaCreateManagedWidget ("frame", xmScrolledWindowWidgetClass, edit_element_props_dialog, XmNscrollingPolicy, XmAUTOMATIC, NULL); row_column[0] = XtVaCreateManagedWidget ("rc_element_props", xmRowColumnWidgetClass, scrolled_w, NULL); /* aro--> */ /* Add headings for element property fields; Need to create temporary TextField widget first so we can get appropiate XmNwidth for each field as it will appear onscreen, and use these values to set the XmNwidth of the widgets for the Labels used as headers, then destroy temp widget. Also create another label to display when no file is loaded and no elements are being displayed. */ row_column[1] = XtVaCreateManagedWidget ("rc", xmRowColumnWidgetClass, row_column[0], XmNorientation, XmHORIZONTAL, NULL); temp_widget = XtVaCreateWidget("temp", xmTextFieldWidgetClass, edit_element_props_dialog, XmNcolumns, 2, NULL); XtVaGetValues(temp_widget, XmNwidth, &dimension_width, NULL); XtVaGetValues(temp_widget, XmNheight, &dimension_height, NULL); /* We want to be able to see approximately 10 rows in scrolled_w, so taking into account the spacing between rows, we multiply dimension_height by 15 */ XtVaSetValues(scrolled_w, XmNheight, dimension_height * 15, NULL); header_label[0] = XtVaCreateWidget ("elem", xmLabelWidgetClass, row_column[1], XmNrecomputeSize, False, XmNwidth, dimension_width, NULL); XtVaSetValues(temp_widget, XmNcolumns, 7, NULL); XtVaGetValues(temp_widget, XmNwidth, &dimension_width, NULL); header_label[1] = XtVaCreateWidget ("atom mass", xmLabelWidgetClass, row_column[1], XmNrecomputeSize, False, XmNwidth, dimension_width, NULL); XtVaSetValues(temp_widget, XmNcolumns, 20, NULL); XtVaGetValues(temp_widget, XmNwidth, &dimension_width, NULL); header_label[2] = XtVaCreateWidget ("xmakemol color", xmLabelWidgetClass, row_column[1], XmNrecomputeSize, False, XmNwidth, dimension_width, NULL); XtVaSetValues(temp_widget, XmNcolumns, 5, NULL); XtVaGetValues(temp_widget, XmNwidth, &dimension_width, NULL); header_label[3] = XtVaCreateWidget ("cov rad", xmLabelWidgetClass, row_column[1], XmNrecomputeSize, False, XmNwidth, dimension_width, NULL); header_label[4] = XtVaCreateWidget ("vdw rad", xmLabelWidgetClass, row_column[1], XmNrecomputeSize, False, XmNwidth, dimension_width, NULL); header_label[5] = XtVaCreateWidget("No file loaded. To see all " "elements, click \"Show All\"", xmLabelWidgetClass, row_column[1], NULL); XtDestroyWidget(temp_widget); /* <--aro */ for(i = 0; i < get_no_elements(); i++) { char color[20], mass[8], cov_rad[6], vdw_rad[6]; if (strlen (element[i].label) > 0) { /* aro - each RowColumn containing property TextFields is not managed right away because first we check if element[i].any_atoms or elem_props_dialog_state.show_all_elements is true. If either is true, then we manage row_column later in update_edit_element_props_dialog */ row_column[1] = XtVaCreateWidget ("rc", xmRowColumnWidgetClass, row_column[0], XmNorientation, XmHORIZONTAL, NULL); XtVaCreateManagedWidget ("label", xmTextFieldWidgetClass, row_column[1], XmNvalue, element[i].label, XmNeditable, False, XmNcolumns, 2, NULL); sprintf(mass, "%7.3f", element[i].mass); XtVaCreateManagedWidget ("label", xmTextFieldWidgetClass, row_column[1], XmNvalue, mass, XmNeditable, False, XmNcolumns, strlen(mass), NULL); sprintf(color, "%s", element[i].color); /* aro - We assign temp_widget the id of the TextField widgets so we can add callbacks, and we change XmNeditable to True so the fields are editable. We also give widgets unique names that are descriptive of the element property each displays so we will be able to access them using XtNameToWidget in other functions */ temp_widget = XtVaCreateManagedWidget ("color", xmTextFieldWidgetClass, row_column[1], XmNvalue, color, XmNeditable, True, XmNcolumns, 20, XmNuserData, i, NULL); /* aro--> */ XtAddCallback(temp_widget, XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(temp_widget, XmNactivateCallback, edit_elements_apply_cb, NULL); /* <--aro */ sprintf(cov_rad, "%5.3f", element[i].cov_rad); temp_widget = XtVaCreateManagedWidget ("cov_rad", xmTextFieldWidgetClass, row_column[1], XmNvalue, cov_rad, XmNeditable, True, XmNcolumns, strlen(cov_rad), XmNuserData, i, NULL); /* aro--> */ XtAddCallback(temp_widget, XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(temp_widget, XmNactivateCallback, edit_elements_apply_cb, NULL); /* <--aro */ sprintf(vdw_rad, "%5.3f", element[i].vdw_rad); temp_widget = XtVaCreateManagedWidget ("vdw_rad", xmTextFieldWidgetClass, row_column[1], XmNvalue, vdw_rad, XmNeditable, True, XmNcolumns, strlen(vdw_rad), XmNuserData, i, NULL); /* aro--> */ XtAddCallback(temp_widget, XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(temp_widget, XmNactivateCallback, edit_elements_apply_cb, NULL); /* <--aro */ } } /* aro--> */ /* I could not figure out how, if it is possible, to have a scrolled window set its own width dimension such that no horizontal scroll bar would be required to see the entire width of the scrolled window's contents. So below we roughly approximate the width required by adding up the widths of each TextField, each TextField's margin, the spacing in the RowColumn between each TextField, etc, plus a small amount more for padding, and then we set the XmNwidth of the scrolled window to this value. */ XtVaGetValues(row_column[1], XmNchildren, &rc_wlist, NULL); if(rc_wlist) { /* rc_wlist corresponds to header labels: rc_wlist[0] = element abbreviation label rc_wlist[1] = element mass label rc_wlist[2] = element color in XMakemol label rc_wlist[3] = element covalent radius label rc_wlist[4] = element van der Waals radius label */ XtVaGetValues(rc_wlist[0], XmNwidth, &dimension_width, NULL); width = (int)dimension_width; XtVaGetValues(rc_wlist[1], XmNwidth, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(rc_wlist[2], XmNwidth, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(rc_wlist[3], XmNwidth, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(rc_wlist[4], XmNwidth, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(row_column[1], XmNmarginWidth, &dimension_width, NULL); width += 2 * (int)dimension_width;/* take into account two margins */ XtVaGetValues(row_column[1], XmNspacing, &dimension_width, NULL); width += 6 * (int)dimension_width;/* six spaces in a row */ XtVaGetValues(scrolled_w, XmNshadowThickness, &dimension_width, NULL); width += 2 * (int)dimension_width;/* take into account two shadows */ XtVaGetValues(scrolled_w, XmNmarginWidth, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(scrolled_w, XmNwidth, &dimension_width, NULL); XtVaGetValues(scrolled_w, XmNspacing, &dimension_width, NULL); width += (int)dimension_width; XtVaGetValues(scrolled_w, XmNverticalScrollBar, &v_scroll, NULL); XtVaGetValues(v_scroll, XmNwidth, &dimension_width, NULL); width += (int)dimension_width; /* extra padding to ensure no horizontal scroll bar needed in scrolled window */ width += 50; XtVaSetValues(edit_element_props_dialog, XmNwidth, width, NULL); } /* <--aro */ /* aro--> */ /* Here we create a radio box at the top of the dialog to select which elements are shown, and 5 buttons at the bottom of dialog: Save Customizations, Apply Customizations, Delete All Customizations, Revert to Saved Customizations, Cancel (we don't use the default cancel button because it appears in different dimensions) */ current = XmStringCreateLocalized("Current Elements"); all = XmStringCreateLocalized("All Elements"); custom = XmStringCreateLocalized("Customized Elements"); radio_box = XmCreateRadioBox(edit_element_props_dialog,"show elements", args,0); XtVaSetValues(radio_box, XmNorientation, XmHORIZONTAL, XmNradioAlwaysOne, True, NULL); temp_widget = XtVaCreateManagedWidget("button1", xmToggleButtonGadgetClass, radio_box, XmNlabelString, current, XmNset, True, NULL); XtAddCallback(temp_widget, XmNvalueChangedCallback, show_elements_cb, row_column[0]); temp_widget = XtVaCreateManagedWidget("button2", xmToggleButtonGadgetClass, radio_box, XmNlabelString, all, NULL); XtAddCallback(temp_widget, XmNvalueChangedCallback, show_elements_cb, row_column[0]); temp_widget = XtVaCreateManagedWidget("button3", xmToggleButtonGadgetClass, radio_box, XmNlabelString, custom, NULL); XtAddCallback(temp_widget, XmNvalueChangedCallback, show_elements_cb, row_column[0]); XtManageChild(radio_box); XmStringFree(current); XmStringFree(all); XmStringFree(custom); title = XmStringCreateLocalized("Save Customizations"); temp_widget = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, edit_element_props_dialog, XmNlabelString, title, NULL); XtAddCallback (temp_widget, XmNactivateCallback, edit_elements_save_cb, NULL); title = XmStringCreateLocalized("Apply Customizations"); temp_widget = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, edit_element_props_dialog, XmNlabelString, title, NULL); XtAddCallback (temp_widget, XmNactivateCallback, edit_elements_apply_cb, NULL); title = XmStringCreateLocalized("Delete All Customizations"); temp_widget = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, edit_element_props_dialog, XmNlabelString, title, NULL); XtAddCallback (temp_widget, XmNactivateCallback, (XtCallbackProc) revert_to_defaults_cb, row_column[0]); title = XmStringCreateLocalized("Revert to Saved Customizations"); temp_widget = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, edit_element_props_dialog, XmNlabelString, title, NULL); XtAddCallback(temp_widget, XmNactivateCallback, edit_elements_discard_cb, NULL); title = XmStringCreateLocalized("Cancel"); temp_widget = XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, edit_element_props_dialog, XmNlabelString, title, NULL); /* Unmanage dialog when user clicks "Cancel" */ XtAddCallback(temp_widget, XmNactivateCallback, edit_elements_cancel_cb, NULL); /* When edit_element_props_dialog is unmapped (which should happen when it is unmanaged), call edit_elements_discard_cb to discard changes and free memory used by widgets_changed list */ XtAddCallback(edit_element_props_dialog, XmNunmapCallback, edit_elements_discard_cb, NULL); /* <--aro */ /* Don't provide any help */ XtUnmanageChild (XmMessageBoxGetChild(edit_element_props_dialog, XmDIALOG_HELP_BUTTON)); /* Don't need OK button */ XtUnmanageChild (XmMessageBoxGetChild(edit_element_props_dialog, XmDIALOG_OK_BUTTON)); /* aro - Don't need Cancel button */ XtUnmanageChild (XmMessageBoxGetChild(edit_element_props_dialog, XmDIALOG_CANCEL_BUTTON)); } /* aro - We need to check which elements are currently loaded and manage and unmanage the rows in the elements dialog accordingly */ update_edit_element_props_dialog(); XtAddCallback (edit_element_props_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(edit_element_props_dialog); } /* aro--> */ void update_edit_element_props_dialog() { /* Since edit_element_props_dialog is only managed and unmanaged, we need to update the elements and the header label displayed each time it is open. First we check if a file has been loaded by checking whether element[i].any_atoms is true for all elements. If no file loaded, and user is not showing all elements, then a label indicating that no file is loaded will appear. Otherwise the header containing labels for each property field appears. Next we check whether a row containing an element's properties should be visible based on whether the user is showing all customized, or current elements, and if current elements then whether an element has any atoms loaded */ int get_no_elements(); int i, numChildren; Widget temp_w, rc; WidgetList w_list, sub_w_list; temp_w = XtNameToWidget(edit_element_props_dialog, "frame"); XtVaGetValues(temp_w, XmNworkWindow, &rc, NULL); /* Temporarily hide row_column[0] while we make changes */ XtUnmanageChild(rc); /* Get children and number of children of row_column[0] */ XtVaGetValues(rc, XmNchildren, &w_list, NULL); XtVaGetValues(rc, XmNnumChildren, &numChildren, NULL); /* Get children of first row child of row_column[0] (header labels) */ XtVaGetValues(w_list[0], XmNchildren, &sub_w_list, NULL); for(i = 0; elem_props_dialog_state.file_loaded == False && i < get_no_elements(); i++) { if(element[i].any_atoms == True) elem_props_dialog_state.file_loaded = True; } /* Doesn't matter if we try to manage a label already managed, XtManageChild will just ignore it */ /* If file is not loaded and we're not showing all or customized elements, display no-file-loaded label. */ if(elem_props_dialog_state.file_loaded == False && elem_props_dialog_state.show_all_elements == False && elem_props_dialog_state.show_customized_elements == False) { XtUnmanageChildren(sub_w_list, 5);/* element properties headers */ XtManageChild(sub_w_list[5]);/* no-file-loaded label */ } else { XtUnmanageChild(sub_w_list[5]);/* no-file-loaded label */ XtManageChildren(sub_w_list, 5);/* element properties headers */ } /* Start with i = 1 becuase w_list[0] is header label. */ for(i = 1; i < numChildren; i++) { /* Display appropiate elements */ if(elem_props_dialog_state.show_all_elements || (!elem_props_dialog_state.show_customized_elements && element[i-1].any_atoms) || (elem_props_dialog_state.show_customized_elements && element[i-1].customized)) XtManageChild(w_list[i]); else XtUnmanageChild(w_list[i]); } /* Make row_column[0] visible again */ XtManageChild(rc); } void edit_elements_record_id_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* We record the id of the widget that called this callback in a linked list */ if(widgets_changed.head == NULL)/* if NULL then it's first call to edit_elements_record_cb */ { widgets_changed.head = malloc(sizeof(struct widgets)); widgets_changed.curr = widgets_changed.head; widgets_changed.curr->next = NULL; } else/* if not NULL then edit_elements_record_cb has already been called */ { widgets_changed.curr->next = malloc(sizeof(struct widgets)); widgets_changed.curr = widgets_changed.curr->next; widgets_changed.curr->next = NULL; } widgets_changed.curr->id = widget;/* add this widget's id to changed widgets list */ /* Once we've recorded a widget's id, we don't need to get it again */ XtRemoveCallback(widget, XmNvalueChangedCallback, (XtCallbackProc) edit_elements_record_id_cb, NULL); } void edit_elements_apply_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* To apply changes made in edit_element_props_dialog, we traverse the widgets_changed linked list, and for each node we check whether it is the widget id of a "color", "cov_rad", or "vdw_rad" property TextField. We then change the property of the corresponding element and make the effects take place immediately by calling change_frame. Lastly we free the memory used by widgets_changed list */ void canvas_cb(Widget, XtPointer, XtPointer); void change_frame(int, Boolean, Boolean); void free_widget_list_memory_cb(Widget, XtPointer, XtPointer); void update_bond_matrix(Boolean); int index, i, j; double cov_rad, vdw_rad; char *color, *num_string, *widget_name; if(widgets_changed.head != NULL)/* if head is not NULL then some value(s) changed */ { for(widgets_changed.curr = widgets_changed.head; widgets_changed.curr != NULL; widgets_changed.curr = widgets_changed.curr->next) { widget_name = XtName(widgets_changed.curr->id); /* get index of element to update */ XtVaGetValues(widgets_changed.curr->id, XmNuserData, &index, NULL); /* if field edited was color field, do this */ if(strcmp(widget_name, "color") == 0) { XtVaGetValues(widgets_changed.curr->id, XmNvalue, &color, NULL); /* We want to save colors without whitespace (e.g. "DarkGreen" instead of "Dark Green") because we read them in using whitespace delimited fields, so we go through character array and remove whitespace */ for(i = 0; color[i] != '\0'; i++) { if(color[i] == ' ') for(j = i; color[j] != '\0'; j++) color[j] = color[j+1]; } /* Update text field with new string */ XtVaSetValues(widgets_changed.curr->id, XmNvalue, color, NULL); strcpy(element[index].color, color); element[index].color_allocated = 0; element[index].customized = 1; } /* if field edited was covalent radius field, do this */ else if(strcmp(widget_name, "cov_rad") == 0) { XtVaGetValues(widgets_changed.curr->id, XmNvalue, &num_string, NULL); cov_rad = atof(num_string);/* convert string to double */ element[index].cov_rad = cov_rad; element[index].customized = 1; update_bond_matrix(False); } /* if field edited was van der Waals radius field, do this */ else if(strcmp(widget_name, "vdw_rad") == 0) { XtVaGetValues(widgets_changed.curr->id, XmNvalue, &num_string, NULL); vdw_rad = atof(num_string);/* convert string to double */ element[index].vdw_rad = vdw_rad; element[index].customized = 1; update_bond_matrix(False); } /* Once we've applied changes corresponding to widget, we need to add valueChangedCallback back so if user changes value again the widget's id will be recorded */ XtAddCallback(widgets_changed.curr->id, XmNvalueChangedCallback, (XtCallbackProc) edit_elements_record_id_cb, NULL); } /* update display */ change_frame(frame_no, False, False); /* free widget_list memory */ free_widget_list_memory_cb(widget, NULL, NULL); } update_edit_element_props_dialog(); } void edit_elements_cancel_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XtUnmanageChild(edit_element_props_dialog); } void edit_elements_save_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* To save all changes user has made in edit_element_props_dialog, we first call edit_elements_apply_cb so the changes will take effect in main window and element array immediately, then open .xmakemol.elements in user's home dir. For each element that has been customized, we record all of its properties in .xmakemol.elements */ int get_no_elements(); int i; char *users_home_dir_path, *user_elements_file_name, temp[80]; FILE * out_file; edit_elements_apply_cb(widget, client_data, call_data); users_home_dir_path = getenv("HOME"); /* We're not supposed to modify char * pointer returned by getenv, so we copy it to a character array */ strcpy(temp, users_home_dir_path); user_elements_file_name = strcat(temp, "/.xmakemol.elements"); out_file = fopen(user_elements_file_name, "w"); /* If element is customized, save properties in .xmakemol.elements */ for(i = 0; i < get_no_elements(); i++) { if(element[i].customized == 1) { fprintf(out_file, "%2s%9.3f %-12s %5.3f %5.3f\n", element[i].label, element[i].mass, element[i].color, element[i].cov_rad, element[i].vdw_rad); } } fclose(out_file); update_edit_element_props_dialog(); } void edit_elements_discard_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* To discard any changes that were made in edit_element_props_dialog before they have been saved, free memory allocated for element array, read in elements file, then read in .xmakemol.elements file, and call change_frame to make element colors appear as elements array now indicates. We also free memory used by widgets_changed list. *Note* this only discards changes made after the last time the user selected "Save Customizations" or "Delete All Customizations" in edit_element_props_dialog */ void change_frame(int, Boolean, Boolean); void free_widget_list_memory_cb(Widget, XtPointer, XtPointer); void read_elements_file(); void read_user_elements_file(); void update_bond_matrix(Boolean); Boolean wasManaged = False; char cov_rad[6], vdw_rad[6]; int i, numChildren; Widget rc, scrolled_window; WidgetList sub_w_list, w_list; free(element); element = NULL; read_elements_file();/* refresh element array with original elements file */ read_user_elements_file();/* update element array with entries in .xmakemol.elements */ update_bond_matrix(False); change_frame(frame_no, False, False); /* Work down through widget hierarchy in edit_element_props_dialog to get children and number of children of row_column[0] */ scrolled_window = XtNameToWidget(edit_element_props_dialog, "frame"); XtVaGetValues(scrolled_window, XmNworkWindow, &rc, NULL); XtVaGetValues(rc, XmNchildren, &w_list, NULL); XtVaGetValues(rc, XmNnumChildren, &numChildren, NULL); /* If dialog is managed, unmanage scrolled_window's workWindow while making changes */ if(XtIsManaged(edit_element_props_dialog)) { wasManaged = True; XtUnmanageChild(rc); } /* w_list[0] = header labels, so we start at w_list[1] */ for(i = 1; i < numChildren; i++) { XtVaGetValues(w_list[i], XmNchildren, &sub_w_list, NULL); /* Remove callbacks */ XtRemoveCallback(sub_w_list[2], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtRemoveCallback(sub_w_list[3], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtRemoveCallback(sub_w_list[4], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); /* Update values */ XtVaSetValues(sub_w_list[2], XmNvalue, element[i-1].color, NULL); sprintf(cov_rad, "%5.3f", element[i-1].cov_rad); XtVaSetValues(sub_w_list[3], XmNvalue, cov_rad, NULL); sprintf(vdw_rad, "%5.3f", element[i-1].vdw_rad); XtVaSetValues(sub_w_list[4], XmNvalue, vdw_rad, NULL); /* Put callbacks back in place */ XtAddCallback(sub_w_list[2], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(sub_w_list[3], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(sub_w_list[4], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); } /* Free memory used by widgets_changed list */ free_widget_list_memory_cb(widget, NULL, NULL); /* Manage scrolled_window's workWindow if dialog was managed upon entry of this function */ if(wasManaged) XtManageChild(rc); update_edit_element_props_dialog(); } /* The functions ask_user and response are for use in the defaults function to ask the user if they really want to continue, not allowing them to do anything else in the application until they respond. This code imitates that in a response by Dan Heller to subject 214 in the Motif FAQ at http://www.rahul.net/kenton/mfaq.html */ int ask_user(Widget parent, char *question) { void response(Widget, XtPointer, XtPointer); XmString message, yes, no; Widget msgBox; int answer = 2; extern XtAppContext app; message = XmStringCreateLocalized(question); msgBox = XmCreateQuestionDialog(edit_element_props_dialog, "dialog", NULL, 0); yes = XmStringCreateLocalized("Yes"); no = XmStringCreateLocalized("No"); XtVaSetValues(msgBox, XmNdialogStyle, XmDIALOG_APPLICATION_MODAL, XmNokLabelString, yes, XmNcancelLabelString, no, XmNmessageString, message, NULL); XmStringFree(message); XtAddCallback(msgBox, XmNokCallback, response, &answer); XtAddCallback(msgBox, XmNcancelCallback, response, &answer); XtUnmanageChild(XmMessageBoxGetChild(msgBox, XmDIALOG_HELP_BUTTON)); XtManageChild(msgBox); while (answer == 2 || XtAppPending(app)) XtAppProcessEvent(app, XtIMAll); return answer; } void response(Widget widget, XtPointer client_data, XtPointer call_data) { int *answer = (int *)client_data; XmAnyCallbackStruct *reason = (XmAnyCallbackStruct *)call_data; switch (reason->reason) { case XmCR_OK: *answer = 1; break; case XmCR_CANCEL: *answer = 0; break; default: *answer = 0; return; } } void revert_to_defaults_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* To revert to default element properties, we remove .xmakemol.elements from user's home dir, read in elements file, update bond information, call change_frame to make changes take effect immediately in main window, and update the properties in edit_element_props_dialog. */ void change_frame(int, Boolean, Boolean); void read_elements_file(); void update_bond_matrix(Boolean); Widget w = (Widget) client_data; WidgetList w_list, sub_w_list; char color[20], mass[8], cov_rad[6], vdw_rad[6]; char *user_elements_file_name, temp[80]; int i, numChildren; /* Make sure the user really wants to continue */ if(ask_user(edit_element_props_dialog, "Are you sure? This will delete all customizations!") == 1) { strcpy(temp, getenv("HOME")); user_elements_file_name = strcat(temp, "/.xmakemol.elements"); remove(user_elements_file_name); /* Free element and set it to NULL so call to read_elements_file() will read in file */ free(element); element = NULL; read_elements_file(); /* Update the bond information as this may have changed from what the user had defined in .xmakemol.elements */ update_bond_matrix(False); /* Make changes appear onscreen */ change_frame(frame_no, False, False); /* Hide row_column[0] while we make changes to edit_element_props_dialog */ XtUnmanageChild(w); /* Get children of row_column[0] and number of children (these will be the rows of properties) */ XtVaGetValues(w, XmNchildren, &w_list, NULL); XtVaGetValues(w, XmNnumChildren, &numChildren, NULL); /* Start loop with i = 1 because 0th child of row_column[0] is row_column widget containing header labels */ for(i = 1; i < numChildren; i++) { XtVaGetValues(w_list[i], XmNchildren, &sub_w_list, NULL); /* When updating the properties we remove the XmNvalueChangedCallback for those widgets that have callbacks registered, because we have no reason to record these widget id's in the widgets_changed list (these changes don't need to be written to .xmakemol.elements) */ XtRemoveCallback(sub_w_list[2], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtRemoveCallback(sub_w_list[3], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtRemoveCallback(sub_w_list[4], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtVaSetValues(sub_w_list[0], XmNvalue, element[i-1].label, NULL); sprintf(mass, "%7.3f", element[i-1].mass); XtVaSetValues(sub_w_list[1], XmNvalue, mass, NULL); sprintf(color, "%s", element[i-1].color); XtVaSetValues(sub_w_list[2], XmNvalue, color, NULL); sprintf(cov_rad, "%5.3f", element[i-1].cov_rad); XtVaSetValues(sub_w_list[3], XmNvalue, cov_rad, NULL); sprintf(vdw_rad, "%5.3f", element[i-1].vdw_rad); XtVaSetValues(sub_w_list[4], XmNvalue, vdw_rad, NULL); /* Put callbacks back in place */ XtAddCallback(sub_w_list[2], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(sub_w_list[3], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); XtAddCallback(sub_w_list[4], XmNvalueChangedCallback, edit_elements_record_id_cb, NULL); } /* Unhide row_column[0] */ XtManageChild(w); } update_edit_element_props_dialog(); } void show_elements_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* This function toggles whether the user sees the properties of all elements, current elements, or customized elements in edit_element_props_dialog */ int i, numChildren; Widget w = (Widget) client_data; XmToggleButtonCallbackStruct *cbs = (XmToggleButtonCallbackStruct *) call_data; WidgetList w_list, sub_w_list; char *button_name = XtName(widget); if(cbs->set == True) { /* Get children of row_column[0] and number of children */ XtVaGetValues(w, XmNchildren, &w_list, NULL); XtVaGetValues(w, XmNnumChildren, &numChildren, NULL); /* Get children of the first row child of row_column[0] (these will be header labels) */ XtVaGetValues(w_list[0], XmNchildren, &sub_w_list, NULL); XtUnmanageChild(w);/* temporarily hide row_column[0] while we make changes */ /* Change state of edit_element_props_dialog */ if(strcmp(button_name, "button3") == 0)/* Customized Elements */ { elem_props_dialog_state.show_all_elements = False; elem_props_dialog_state.show_customized_elements = True; /* sub_w_list[5] == file-not-loaded label */ XtUnmanageChild(sub_w_list[5]); /* sub_w_list[0..4] == header labels */ XtManageChildren(sub_w_list, 5); } else if(strcmp(button_name, "button1") == 0)/* Current Elements */ { elem_props_dialog_state.show_all_elements = False; elem_props_dialog_state.show_customized_elements = False; if(elem_props_dialog_state.file_loaded == False) { /* sub_w_list[0..4] == header labels */ XtUnmanageChildren(sub_w_list, 5); /* sub_w_list[5] == file-not-loaded label */ XtManageChild(sub_w_list[5]); } else { /* sub_w_list[5] == file-not-loaded label */ XtUnmanageChild(sub_w_list[5]); /* sub_w_list[0..4] == header labels */ XtManageChildren(sub_w_list, 5); } } else if(strcmp(button_name, "button2") == 0)/* All Elements */ { elem_props_dialog_state.show_all_elements = True; elem_props_dialog_state.show_customized_elements = False; /* sub_w_list[5] == file-not-loaded label */ XtUnmanageChild(sub_w_list[5]); /* sub_w_list[0..4] == header labels */ XtManageChildren(sub_w_list, 5); } else fprintf(stderr, "Error - edit_element_properties_dialog radio box\n"); for(i = 1; i < numChildren; i++) { /* If (w_list[i] isn't managed, and *show_all_elements is True) or element[i-1] has atoms currently displayed on canvas, then manage w_list[i] to make element[i-1]'s properties visible */ if(elem_props_dialog_state.show_all_elements || (elem_props_dialog_state.show_all_elements == False && elem_props_dialog_state.show_customized_elements == False && element[i-1].any_atoms) || (elem_props_dialog_state.show_customized_elements && element[i-1].customized)) XtManageChild(w_list[i]); else XtUnmanageChild(w_list[i]); } XtManageChild(w);/* changes finished, unhide row_column[0] */ } } void free_widget_list_memory_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* Free the memory used by the widgets_changed linked list */ struct widget_list temp; if(widgets_changed.head != NULL)/* if memory has been allocated, free it */ { widgets_changed.curr = widgets_changed.head; while(widgets_changed.curr != NULL) { temp.curr = widgets_changed.curr->next; free(widgets_changed.curr); widgets_changed.curr = temp.curr; } widgets_changed.head = NULL; } } /* <--aro */ #ifdef GL void make_gl_render_dialog (Widget parent) { Boolean render_using_gl_p (void); int get_gl_render_type (void); void gl_eye_cb (Widget, XtPointer, XtPointer); void gl_fov_cb (Widget, XtPointer, XtPointer); int gl_get_lighting (void); int gl_get_shininess (void); int gl_get_specular_lighting (void); void gl_lighting_cb (Widget, XtPointer, XtPointer); void gl_specular_lighting_cb (Widget, XtPointer, XtPointer); void gl_no_atom_segments_cb (Widget, XtPointer, XtPointer); void gl_no_bond_segments_cb (Widget, XtPointer, XtPointer); void gl_render_cb (Widget, XtPointer, XtPointer); void gl_render_type_button_cb (Widget, XtPointer, XtPointer); void gl_shininess_scale_cb (Widget, XtPointer, XtPointer); double get_gl_eye (void); double get_gl_fov (void); int get_gl_no_atom_segments (void); int get_gl_no_bond_segments (void); void set_gl_render_stereo(enum render_stereo_types); /* aro */ enum render_stereo_types get_gl_render_stereo(void); /* aro */ void render_stereo_cb(Widget, XtPointer, XtPointer); /* aro */ void gl_sep_cb (Widget, XtPointer, XtPointer); /* aro */ int get_gl_sep (void); /* aro */ int n; Widget gl_render, gl_lighting, row_column, radio_box, radio_button, gl_stereo, hor_row_column; Widget no_atom_segments_scale, no_bond_segments_scale, shininess_scale, fov_scale, eye_scale; Widget seperation_scale; /* aro */ /* aro - moved Widget gl_render_dialog to globals.h so we can access it in gl_funcs.c, specifically to change value of eye_scale slider */ XmString xmstring; if (gl_render_dialog == NULL) { xmstring = XmStringCreateLocalized ("Edit GL rendering..."); n = 0; XtSetArg (args[n], XmNautoUnmanage, False); n++; XtSetArg (args[n], XmNdialogTitle, xmstring); n++; gl_render_dialog = XmCreateMessageDialog (parent, "gl_render", args, n); row_column = XtVaCreateManagedWidget ("row_column", xmRowColumnWidgetClass, gl_render_dialog, NULL); gl_render = XtVaCreateManagedWidget ("Render using GL", xmToggleButtonGadgetClass, row_column, NULL); XtVaSetValues (gl_render, XmNset, render_using_gl_p (), NULL); XtAddCallback (gl_render, XmNvalueChangedCallback, gl_render_cb, NULL); /* aro--> */ XtVaCreateManagedWidget ("sep", xmSeparatorGadgetClass, row_column, NULL); radio_box = XmCreateRadioBox (row_column, "radio", NULL, 0); XtVaSetValues(radio_box, XmNorientation, XmHORIZONTAL, NULL); gl_stereo = XtVaCreateManagedWidget ("No Stereo", xmToggleButtonGadgetClass, radio_box, XmNset, True, NULL); XtAddCallback (gl_stereo, XmNvalueChangedCallback, render_stereo_cb, (XtPointer) 0);/* 0 = NO_STEREO */ gl_stereo = XtVaCreateManagedWidget ("Stereo Pair", xmToggleButtonGadgetClass, radio_box, XmNset, False, NULL); XtAddCallback (gl_stereo, XmNvalueChangedCallback, render_stereo_cb, (XtPointer) 1);/* 1 = SIDE_BY_SIDE */ gl_stereo = XtVaCreateManagedWidget ("Red/Blue Stereo", xmToggleButtonGadgetClass, radio_box, XmNset, False, NULL); XtAddCallback (gl_stereo, XmNvalueChangedCallback, render_stereo_cb, (XtPointer) 2);/* 2 = RED/BLUE */ #ifdef SGI_STEREO gl_stereo = XtVaCreateManagedWidget ("SGI Stereo (top)", xmToggleButtonGadgetClass, radio_box, XmNset, False, NULL); XtAddCallback (gl_stereo, XmNvalueChangedCallback, render_stereo_cb, (XtPointer) 3);/* 3 = SGI_HARDWARE */ #endif /* SGI_STEREO */ XtManageChild(radio_box); xmstring = XmStringCreateLocalized ("Stereo seperation"); seperation_scale = XtVaCreateManagedWidget ("sep_scale", xmScaleWidgetClass, row_column, XmNmaximum, 50, XmNminimum, 10, XmNvalue, get_gl_sep (), XmNshowValue, False, XmNprocessingDirection, XmMAX_ON_LEFT, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (seperation_scale, XmNdragCallback, gl_sep_cb, NULL); XtAddCallback (seperation_scale, XmNvalueChangedCallback, gl_sep_cb, NULL); /* Not using XtSetSensitive code for now, causes problems with HP/UX if(get_gl_render_stereo() && render_using_gl_p()) XtSetSensitive (seperation_scale, True); else XtSetSensitive (seperation_scale, False); */ /* <--aro */ XtVaCreateManagedWidget ("sep", xmSeparatorGadgetClass, row_column, NULL); hor_row_column = XtVaCreateManagedWidget ("hor_row_column", xmRowColumnWidgetClass, row_column, XmNorientation, XmHORIZONTAL, NULL); gl_lighting = XtVaCreateManagedWidget ("Lighting", xmToggleButtonGadgetClass, hor_row_column, NULL); XtVaSetValues (gl_lighting, XmNset, gl_get_lighting (), NULL); XtAddCallback (gl_lighting, XmNvalueChangedCallback, gl_lighting_cb, NULL); gl_lighting = XtVaCreateManagedWidget ("Spotlight", xmToggleButtonGadgetClass, hor_row_column, NULL); XtVaSetValues (gl_lighting, XmNset, gl_get_specular_lighting (), NULL); XtAddCallback (gl_lighting, XmNvalueChangedCallback, gl_specular_lighting_cb, NULL); xmstring = XmStringCreateLocalized ("Diffuseness of spotlight"); shininess_scale = XtVaCreateManagedWidget ("shininess_scale", xmScaleWidgetClass, row_column, XmNmaximum, 128, XmNminimum, 0, XmNvalue, gl_get_shininess (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (shininess_scale, XmNdragCallback, gl_shininess_scale_cb, NULL); XtAddCallback (shininess_scale, XmNvalueChangedCallback, gl_shininess_scale_cb, NULL); XtVaCreateManagedWidget ("sep", xmSeparatorGadgetClass, row_column, NULL); radio_box = XmCreateRadioBox (row_column, "radio", NULL, 0); XtVaSetValues(radio_box, XmNorientation, XmHORIZONTAL, NULL); radio_button = XtVaCreateManagedWidget ("Ball and Stick", xmToggleButtonGadgetClass, radio_box, NULL); if (get_gl_render_type () == BALL_AND_STICK) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback (radio_button, XmNvalueChangedCallback, gl_render_type_button_cb, (XtPointer) BALL_AND_STICK); radio_button = XtVaCreateManagedWidget ("Tubes", xmToggleButtonGadgetClass, radio_box, NULL); if (get_gl_render_type () == TUBES) { XtVaSetValues (radio_button, XmNset, True, NULL); } XtAddCallback (radio_button, XmNvalueChangedCallback, gl_render_type_button_cb, (XtPointer) TUBES); XtManageChild (radio_box); XtVaCreateManagedWidget ("sep", xmSeparatorGadgetClass, row_column, NULL); hor_row_column = XtVaCreateManagedWidget ("hor_row_column", xmRowColumnWidgetClass, row_column, XmNorientation, XmHORIZONTAL, NULL); xmstring = XmStringCreateLocalized ("Number of atom segments"); no_atom_segments_scale = XtVaCreateManagedWidget ("no_atom_segments_scale", xmScaleWidgetClass, hor_row_column, XmNmaximum, 36, XmNminimum, 6, XmNvalue, get_gl_no_atom_segments (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (no_atom_segments_scale, XmNdragCallback, gl_no_atom_segments_cb, NULL); XtAddCallback (no_atom_segments_scale, XmNvalueChangedCallback, gl_no_atom_segments_cb, NULL); xmstring = XmStringCreateLocalized ("Number of bond segments"); no_bond_segments_scale = XtVaCreateManagedWidget ("no_bond_segments_scale", xmScaleWidgetClass, hor_row_column, XmNmaximum, 36, XmNminimum, 6, XmNvalue, get_gl_no_bond_segments (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (no_bond_segments_scale, XmNdragCallback, gl_no_bond_segments_cb, NULL); XtAddCallback (no_bond_segments_scale, XmNvalueChangedCallback, gl_no_bond_segments_cb, NULL); XtVaCreateManagedWidget ("sep", xmSeparatorGadgetClass, row_column, NULL); hor_row_column = XtVaCreateManagedWidget ("hor_row_column", xmRowColumnWidgetClass, row_column, XmNorientation, XmHORIZONTAL, NULL); xmstring = XmStringCreateLocalized ("Field of view (degrees)"); fov_scale = XtVaCreateManagedWidget ("fov_scale", xmScaleWidgetClass, hor_row_column, XmNmaximum, 180, XmNminimum, 0, XmNvalue, (int) get_gl_fov (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (fov_scale, XmNdragCallback, gl_fov_cb, NULL); XtAddCallback (fov_scale, XmNvalueChangedCallback, gl_fov_cb, NULL); xmstring = XmStringCreateLocalized ("Position of eye along z"); eye_scale = XtVaCreateManagedWidget ("eye_scale", xmScaleWidgetClass, hor_row_column, XmNmaximum, 1000, XmNminimum, 0, XmNvalue, (int) get_gl_eye (), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, xmstring, NULL); XtAddCallback (eye_scale, XmNdragCallback, gl_eye_cb, NULL); XtAddCallback (eye_scale, XmNvalueChangedCallback, gl_eye_cb, NULL); /* Remove OK/Help buttons */ XtUnmanageChild (XmMessageBoxGetChild (gl_render_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (gl_render_dialog, XmDIALOG_HELP_BUTTON)); /* Manage Cancel button */ XtAddCallback (gl_render_dialog, XmNcancelCallback, (XtCallbackProc) XtUnmanageChild, NULL); XmStringFree (xmstring); } XtAddCallback (gl_render_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (gl_render_dialog); } void gl_render_cb (Widget widget, XtPointer client_data, XtPointer call_data) { enum render_stereo_types get_gl_render_stereo (void); /* aro */ Boolean render_using_gl_p(); /* aro */ void canvas_cb (Widget, XtPointer, XtPointer); int crystal_p (void); void set_render_using_gl (Boolean); void set_gl_render_stereo (enum render_stereo_types); void update_bbox (void); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_render_using_gl (cbs->value); /* The SGI Stereo button may have been selected before GL rendering was turned on. If that's the case, call set_render_stereo to change the monitor to stereo mode */ if(get_gl_render_stereo() == SGI_HARDWARE) { if(cbs->value) { set_gl_render_stereo(SGI_HARDWARE); } else{ set_gl_render_stereo(NO_STEREO); } } /* Not using XtSetSensitive code for now, causes problems with HP/UX if(get_gl_render_stereo() && render_using_gl_p()) XtSetSensitive(XtNameToWidget(XtParent(widget), "sep_scale"), True); else XtSetSensitive(XtNameToWidget(XtParent(widget), "sep_scale"), False); */ update_bbox (); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_lighting_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void gl_set_lighting (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; gl_set_lighting (cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_specular_lighting_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void gl_set_specular_lighting (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; gl_set_specular_lighting (cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_shininess_scale_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void gl_set_shininess (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; gl_set_shininess (cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_no_atom_segments_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void set_gl_no_atom_segments (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_gl_no_atom_segments ((int) cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_no_bond_segments_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void set_gl_no_bond_segments (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_gl_no_bond_segments ((int) cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_fov_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb (Widget, XtPointer, XtPointer); void set_gl_fov (double); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_gl_fov ((double) cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } void gl_eye_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_gl_eye (double); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_gl_eye ((double) cbs->value); redraw = 1; canvas_cb (canvas, NULL, NULL); } /* aro--> */ void gl_sep_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_gl_sep (int); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; set_gl_sep ((int) cbs->value); redraw = 1; canvas_cb(canvas, NULL, NULL); } /* <--aro */ void gl_render_type_button_cb (Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); void set_gl_render_type (int); void update_bbox (void); int type = (int) client_data; static int last_type = -1; if (type == last_type) { return; } else { last_type = type; } set_gl_render_type (type); update_bbox (); redraw = 1; canvas_cb (canvas, NULL, NULL); } /* aro--> */ void render_stereo_cb(Widget widget, XtPointer client_data, XtPointer call_data) { enum render_stereo_types get_gl_render_stereo(); void set_gl_render_stereo(enum render_stereo_types); void canvas_cb(Widget, XtPointer, XtPointer); Boolean render_using_gl_p(); XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; int stereo_type = (enum render_stereo_types) client_data; /* Don't need variable while not using XtSetSensitive code Widget sep_widget = XtNameToWidget(XtParent(XtParent(widget)), "sep_scale"); */ if(cbs->value == True) { if(stereo_type == NO_STEREO) { set_gl_render_stereo(NO_STEREO); } else if(stereo_type == SIDE_BY_SIDE) { set_gl_render_stereo (SIDE_BY_SIDE); } else if(stereo_type == RED_BLUE) { set_gl_render_stereo (RED_BLUE); } else if(stereo_type == SGI_HARDWARE) { set_gl_render_stereo (SGI_HARDWARE); } else { fprintf(stderr, "Error - invalid stereo type in render stereo \n"); } } /* Not using XtSetSensitive code for now, causes problems with HP/UX if(get_gl_render_stereo() && render_using_gl_p()) XtSetSensitive(sep_widget, True); else XtSetSensitive(sep_widget, False); */ redraw = 1; canvas_cb(canvas, NULL, NULL); } /* <--aro */ #endif /* GL */ /* aro--> */ /* aro - Wait until we have facility to save preferences to implement changing of background color... void make_set_bg_color_dialog(Widget parent) { void canvas_cb(Widget, XtPointer, XtPointer); void set_bg_color_cb(Widget, XtPointer, XtPointer); XmString xmstring; Widget rc, label, textField; int n; if(set_bg_color_dialog == NULL) { xmstring = XmStringCreateLocalized ("Set Background Color"); n = 0; XtSetArg (args[n], XmNdefaultButtonType, XmDIALOG_NONE); n++; XtSetArg (args[n], XmNdialogTitle, xmstring); n++; set_bg_color_dialog = XmCreateMessageDialog (parent, "set_bg_color", args, n); rc = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, set_bg_color_dialog, XmNorientation, XmVERTICAL, NULL); label = XtVaCreateManagedWidget("Enter new background color", xmLabelWidgetClass, rc, NULL); textField = XtVaCreateManagedWidget("new_bg_color", xmTextFieldWidgetClass, rc, XmNeditable, True, XmNvalue, bg_color, NULL); XtAddCallback(textField, XmNactivateCallback, set_bg_color_cb, NULL); XtUnmanageChild (XmMessageBoxGetChild (set_bg_color_dialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild (set_bg_color_dialog, XmDIALOG_HELP_BUTTON)); } XtManageChild(set_bg_color_dialog); } void set_bg_color_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); char *new_bg_color; extern int gl_initialized; XtVaGetValues(widget, XmNvalue, &new_bg_color, NULL); strcpy(bg_color, new_bg_color); bg_color_parsed = 0; gl_initialized = 0; redraw = 1; canvas_cb (canvas, NULL, NULL); } */ /* <--aro */ xmakemol-5.16/fig.c0000644000175000017500000003543310664010176011125 00000000000000/* Copyright (C) 2001, 2003, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Needed for globals.h */ #include "globals.h" #include "bonds.h" #include "defs.h" #include "draw.h" #include "view.h" #define FIG_DEPTH_RANGE (995) #define FIG_SCALE (10) #define FIG_USER_COLOR_OFFSET (32) static int use_colour; static double max_depth, min_depth; static FILE *output; void convert_to_canvas_coords (double *, double *, Boolean); double get_atom_radius (int); double get_h_bond_width (int, int); int get_no_dashes (void); double get_z_depth (void); void update_canvas_bond_points (int, int, Boolean, double); void update_canvas_hbond_points (int, int, Boolean); void write_fig_atom (int); void write_fig_bond (int, int); void write_fig_hbond (int, int); void write_fig_preamble (void); void write_fig_file (char *filename, Boolean with_colour) { int i, si, sj; struct node *ptr; use_colour = with_colour; output = fopen (filename, "w"); write_fig_preamble (); /* Get min/max depths */ max_depth = -1e20; min_depth = 1e20; for (i = 0; i < no_atoms; i++) { if (atoms[i].z < min_depth) min_depth = atoms[i].z; if (atoms[i].z > max_depth) max_depth = atoms[i].z; } /* Loop over atoms */ depth = get_z_depth (); for (i = 0; i < no_atoms; i++) { si = sorted_atoms[i]; if (atom_flag && ((! depth_is_on) || (depth - atoms[si].z > Z_TOL)) && atoms[si].visi) { write_fig_atom (si); } /* Loop over bonds */ if (bond_flag) { ptr = bond_adjacency_list[si]; while (ptr != NULL) { sj = (ptr->v); if (((! depth_is_on) || (((depth - atoms[si].z > Z_TOL) && (depth - atoms[sj].z > Z_TOL)))) && atoms[si].visi && atoms[sj].visi && (atoms[si].z <= atoms[sj].z)) { write_fig_bond (si, sj); } ptr = ptr->next; } } /* Loop over H-bonds */ if (any_hydrogen && hbond_flag) { ptr = hbond_adjacency_list[si]; while (ptr != NULL) { sj = (ptr->v); if (((! depth_is_on) || (((depth - atoms[si].z > Z_TOL) && (depth - atoms[sj].z > Z_TOL)))) && atoms[si].visi && atoms[sj].visi && (atoms[si].z <= atoms[sj].z)) { write_fig_hbond (si, sj); } ptr = ptr->next; } } } fclose (output); } void write_fig_preamble () { int i, index = FIG_USER_COLOR_OFFSET; fprintf (output, "#FIG 3.2\n"); fprintf (output, "Landscape\n"); /* orientation */ fprintf (output, "Center\n"); /* justification */ fprintf (output, "Metric\n"); /* units */ fprintf (output, "A4\n"); /* papersize */ fprintf (output, "100.0\n"); /* export/print magnification */ fprintf (output, "Single\n"); /* single page */ fprintf (output, "-2\n"); /* no transparency */ fprintf (output, "# Generated by XMakemol\n"); /* comment */ fprintf (output, "1200 1\n"); /* resolution/origin at lower left corner */ if (use_colour) { for (i = 0; i < no_atom_types; i++) { fprintf (output, "%d %d #%02X%02X%02X\n", 0, /* object code (color) */ index, /* color number */ element[atom_types[i]].red / 256, element[atom_types[i]].green / 256, element[atom_types[i]].blue / 256); index++; } } } void write_fig_atom (int si) { int color; char label[4] = "", number[8] = "", text[12] = ""; double current_depth; double radius; double xyz_in[3], xy_out[2]; radius = get_atom_radius (si); xyz_in[0] = atoms[si].x; xyz_in[1] = atoms[si].y; xyz_in[2] = atoms[si].z; convert_to_canvas_coords (xyz_in, xy_out, 0); /* Calculate depth */ current_depth = 2 + FIG_DEPTH_RANGE * (1.0 - ((atoms[si].z - min_depth) / (max_depth - min_depth))); /* Set the colour */ if (use_colour) { color = FIG_USER_COLOR_OFFSET + atoms[si].type; } else { color = 7; /* white */ } fprintf (output, "%d %d %d %d %d %d %d %d %d %3.1f %d %3.1f %d %d %d %d %d %d %d %d\n", 1, /* object_code (ellipse) */ 3, /* sub_type (ellipse defined by radius) */ 0, /* line_style (solid) */ 1, /* line thickness */ 0, /* pen color */ color, /* fill color */ (int) current_depth, /* depth */ -1, /* pen style (not used) */ 20, /* area fill (full saturation) */ 0.0, /* style val (dash length) */ 0, /* direction (clockwise) */ 0.0, /* angle (full circle) */ (int) (xy_out[0] * FIG_SCALE), /* center_x */ (int) (xy_out[1] * FIG_SCALE), /* center_y */ (int) (radius * FIG_SCALE), /* radius_x */ (int) (radius * FIG_SCALE), /* radius_y */ (int) (xy_out[0] * FIG_SCALE), /* start_x */ (int) (xy_out[1] * FIG_SCALE), /* start_y */ (int) ((xy_out[0] + radius) * FIG_SCALE), /* end_x */ (int) (xy_out[1] * FIG_SCALE) ); /* Write labels and or symbols */ if (at_nos_flag) { sprintf (number, "%d ", si + 1); } if (at_sym_flag) { sprintf (label, "%s", atoms[si].label); } sprintf (text, "%s%s\\001", number, label); if (strlen (text) > 0) { fprintf (output, "%d %d %d %d %d %d %d %f %d %f %f %d %d %s\n", 4, /* object code (text) */ 1, /* center justified */ 0, /* color (black) */ (int) current_depth - 1, /* depth */ -1, /* pen style (not used) */ 0, /* font (default PostScript) */ 12, /* font size in points */ 0.0, /* angle of text */ 1, /* font flags */ 0.0, /* height */ 0.0, /* length */ (int) (xy_out[0] * FIG_SCALE), /* x */ (int) (xy_out[1] * FIG_SCALE), /* y */ text); } } void write_fig_bond (int si, int sj) { int color; double current_depth; update_canvas_bond_points (si, sj, 0, 0.0); current_depth = 2 + FIG_DEPTH_RANGE * (1.0 - ((atoms[sj].z - min_depth) / (max_depth - min_depth))); if (use_colour) { /* Draw polygon 0-1-4-5 (see diagram in draw.c) */ color = FIG_USER_COLOR_OFFSET + atoms[si].type; fprintf (output, "%d %d %d %d %d %d %d %d %d %3.1f %d %d %d %d %d %d\n\t%d %d %d %d %d %d %d %d %d %d\n", 2, /* object_code (polyline) */ 1, /* sub_type (polyline) */ 0, /* line_style (solid) */ 1, /* line_thickness */ 0, /* pen color */ color, /* fill color */ (int) current_depth + 1, /* depth */ -1, /* pen style (not used) */ 20, /* area fill (full saturation) */ 0.0, /* style val (dash length) */ 0, /* join style (not used?) */ 0, /* cap style (not used?) */ -1, /* radius */ 0, /* forward arrow (off) */ 0, /* backward arrow (off) */ 5, /* number of points */ (int) (canvas_bond_points[0].x * FIG_SCALE), (int) (canvas_bond_points[0].y * FIG_SCALE), (int) (canvas_bond_points[1].x * FIG_SCALE), (int) (canvas_bond_points[1].y * FIG_SCALE), (int) (canvas_bond_points[4].x * FIG_SCALE), (int) (canvas_bond_points[4].y * FIG_SCALE), (int) (canvas_bond_points[5].x * FIG_SCALE), (int) (canvas_bond_points[5].y * FIG_SCALE), (int) (canvas_bond_points[0].x * FIG_SCALE), (int) (canvas_bond_points[0].y * FIG_SCALE) ); /* Draw polygon 1-2-3-4 (see diagram in draw.c) */ color = FIG_USER_COLOR_OFFSET + atoms[sj].type; fprintf (output, "%d %d %d %d %d %d %d %d %d %3.1f %d %d %d %d %d %d\n\t%d %d %d %d %d %d %d %d %d %d\n", 2, /* object_code (polyline) */ 1, /* sub_type (polyline) */ 0, /* line_style (solid) */ 1, /* line_thickness */ 0, /* pen color */ color, /* fill color */ (int) current_depth + 1, /* depth */ -1, /* pen style (not used) */ 20, /* area fill (full saturation) */ 0.0, /* style val (dash length) */ 0, /* join style (not used?) */ 0, /* cap style (not used?) */ -1, /* radius */ 0, /* forward arrow (off) */ 0, /* backward arrow (off) */ 5, /* number of points */ (int) (canvas_bond_points[1].x * FIG_SCALE), (int) (canvas_bond_points[1].y * FIG_SCALE), (int) (canvas_bond_points[2].x * FIG_SCALE), (int) (canvas_bond_points[2].y * FIG_SCALE), (int) (canvas_bond_points[3].x * FIG_SCALE), (int) (canvas_bond_points[3].y * FIG_SCALE), (int) (canvas_bond_points[4].x * FIG_SCALE), (int) (canvas_bond_points[4].y * FIG_SCALE), (int) (canvas_bond_points[1].x * FIG_SCALE), (int) (canvas_bond_points[1].y * FIG_SCALE) ); } else { /* Draw polygon 0-2-3-5 (see diagram in draw.c) */ fprintf (output, "%d %d %d %d %d %d %d %d %d %3.1f %d %d %d %d %d %d\n\t%d %d %d %d %d %d %d %d %d %d\n", 2, /* object_code (polyline) */ 1, /* sub_type (polyline) */ 0, /* line_style (solid) */ 1, /* line_thickness */ 0, /* pen color */ 7, /* fill color (white) */ (int) current_depth + 1, /* depth */ -1, /* pen style (not used) */ 20, /* area fill (full saturation) */ 0.0, /* style val (dash length) */ 0, /* join style (not used?) */ 0, /* cap style (not used?) */ -1, /* radius */ 0, /* forward arrow (off) */ 0, /* backward arrow (off) */ 5, /* number of points */ (int) (canvas_bond_points[0].x * FIG_SCALE), (int) (canvas_bond_points[0].y * FIG_SCALE), (int) (canvas_bond_points[2].x * FIG_SCALE), (int) (canvas_bond_points[2].y * FIG_SCALE), (int) (canvas_bond_points[3].x * FIG_SCALE), (int) (canvas_bond_points[3].y * FIG_SCALE), (int) (canvas_bond_points[5].x * FIG_SCALE), (int) (canvas_bond_points[5].y * FIG_SCALE), (int) (canvas_bond_points[0].x * FIG_SCALE), (int) (canvas_bond_points[0].y * FIG_SCALE) ); } } void write_fig_hbond (int si, int sj) { double current_depth, current_width; double hbond_length, dash_length; double x, y; update_canvas_hbond_points (si, sj, 0); x = canvas_hbond_points[0].x - canvas_hbond_points[1].x; y = canvas_hbond_points[0].y - canvas_hbond_points[1].y; hbond_length = sqrt ((x * x) + (y * y)); dash_length = (int) (hbond_length / (2 * get_no_dashes() - 1)); dash_length *= 2.0 / 3.0; /* Why */ /* Draw polygon 0-2-3-5 (see diagram in draw.c) */ current_depth = 2 + FIG_DEPTH_RANGE * (1.0 - ((atoms[sj].z - min_depth) / (max_depth - min_depth))); current_width = get_h_bond_width (si, sj); current_width *= 2.0 / 3.0; /* Why? */ fprintf (output, "%d %d %d %d %d %d %d %d %d %3.1f %d %d %d %d %d %d\n\t%d %d %d %d\n", 2, /* object_code (polyline) */ 1, /* sub_type (polyline) */ 1, /* line_style (dashed) */ (int) current_width, /* line_thickness */ 0, /* pen color */ 7, /* fill color (white) */ (int) current_depth + 1, /* depth */ -1, /* pen style (not used) */ 20, /* area fill (full saturation) */ dash_length, /* style val (dash length) */ 0, /* join style (not used?) */ 0, /* cap style (not used?) */ -1, /* radius */ 0, /* forward arrow (off) */ 0, /* backward arrow (off) */ 2, /* number of points */ (int) (canvas_hbond_points[0].x * FIG_SCALE), (int) (canvas_hbond_points[0].y * FIG_SCALE), (int) (canvas_hbond_points[1].x * FIG_SCALE), (int) (canvas_hbond_points[1].y * FIG_SCALE) ); } xmakemol-5.16/file.c0000644000175000017500000031621610664010176011300 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __FILE_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #if HAVE_ALLOCA_H #include #endif #include /* aro - needed for isalnum() */ #include #include #include #include #include #include /* #include */ char * gnu_basename (char *); #include #include #include #include /* aro */ #include /* aro */ #include /* aro */ #include /* aro */ #include /* aro */ #include "globals.h" #include "bonds.h" #include "defs.h" #include "draw.h" #ifdef GL #include "gl_funcs.h" /* aro - for visinfo */ #include "gl2ps.h" #endif /* GL */ #include "view.h" #include "bbox.h" /* wjq - for bbox_xyz */ #ifdef XPM #include #endif void echo_to_message_area(char *); struct frame * get_first_frame (void); XmString get_current_directory (void); void set_current_directory (XmString dir); void place_dialog_cb (Widget, XtPointer, XtPointer); static int no_elements; static int bond_adjacency_lists_allocated_size; static int file_type = 0; static int export_type = 0; enum merge_types {MERGE_FRAME, MERGE_ALL}; static enum merge_types merge_type = MERGE_FRAME; static Boolean aux_file_exists_p; static Boolean aux_file_error_p; Widget p_dialog = NULL;/* aro */ static struct frame *first_frame, *current_frame; struct type { int elem; /* corresponding element */ char label[4]; struct type *next; }; static struct type *first_type, *current_type; /* directory that was accessed in any of the file selection dialogs */ static XmString current_directory = NULL; void file_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void open_file(char *, Boolean); /* aro: Updates here: added print_file callback for selection box containing list of printers. Also added: int i, j; all char * and arrays; FILE *printcap_file; Widgets p_dialog, print_printer, temp_widget; XmStringTable printer_xmstrings. */ void export_type_cb(Widget, XtPointer, XtPointer); void file_type_cb(Widget, XtPointer, XtPointer); void load_file_cb(Widget, XtPointer, XtPointer); void save_file_cb(Widget, XtPointer, XtPointer); void merge_file_cb(Widget, XtPointer, XtPointer); void export_file_cb(Widget, XtPointer, XtPointer); void print_file_cb(Widget, XtPointer, XtPointer);/* aro */ void print_file_select_cb(Widget, XtPointer, XtPointer);/* aro */ void cleanup_cb(Widget, XtPointer, XtPointer);/* aro */ int item_no=(int) client_data, i, j;/* aro */ char *printer_name, *line_ptr, line[1024], printer_strings[MAX_PRINTERS+1][80], print_command_string[1024];/* aro */ FILE *printcap_file;/* aro */ static Widget o_dialog,s_dialog,m_dialog,e_dialog; Widget rc[2], export_type_w, file_type_w, print_printer, print_command, temp_widget;/* aro */ XmString title, bw_fig, col_fig, as_all, as_fra, con_fra, eps_bw, eps_co, aux; XmStringTable printer_xmstrings[MAX_PRINTERS];/* aro */ #ifdef XPM XmString xpm; #endif #ifdef GL XmString gl2ps_eps, gl2ps_pdf, gl2ps_svg; #endif switch(item_no){ case 0: if (!o_dialog) { o_dialog = XmCreateFileSelectionDialog (toplevel, "file_sel", NULL, 0); title=XmStringCreateLocalized ("Open File"); XtVaSetValues(o_dialog, XmNdialogTitle, title, NULL); title = XmStringCreateLocalized("*.xyz"); XtVaSetValues(o_dialog, XmNpattern, title, NULL); XmStringFree (title); /* okCallback calls load_file_cb(), cancelCallback unmanages the FileSelectionDialog widget */ XtAddCallback (o_dialog, XmNokCallback, load_file_cb, NULL); XtAddCallback (o_dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); /* No help available ... */ XtUnmanageChild (XmFileSelectionBoxGetChild(o_dialog,XmDIALOG_HELP_BUTTON)); } /* Change to a directory that was just recently operated in any of the file selection dialogs and refresh the file list so that newly created files do show up */ XtVaSetValues (o_dialog, XmNdirectory, get_current_directory (), NULL); XmFileSelectionDoSearch (o_dialog, NULL); XtAddCallback (o_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (o_dialog); XtPopup (XtParent (o_dialog), XtGrabNone); break; case 1: open_file(current_file_name, TRUE); break; case 2: if (!s_dialog) { s_dialog = XmCreateFileSelectionDialog (toplevel, "file_sel", NULL, 0); title=XmStringCreateLocalized ("Save File"); XtVaSetValues(s_dialog, XmNdialogTitle, title, NULL); /* okCallback calls save_file(), cancelCallback unmanages the FileSelectionDialog widget */ as_all = XmStringCreateLocalized("XYZ (all)"); as_fra = XmStringCreateLocalized("XYZ (frame)"); con_fra = XmStringCreateLocalized("XYZ + connectivities (frame)"); aux = XmStringCreateLocalized ("Auxiliary info"); title=XmStringCreateLocalized ("File type"); file_type_w=XmVaCreateSimpleOptionMenu (s_dialog,"File type",title,'F', 0, file_type_cb, XmVaPUSHBUTTON, as_all, 'X', NULL, NULL, XmVaPUSHBUTTON, as_fra, 'Y', NULL, NULL, XmVaPUSHBUTTON, con_fra, 'Z', NULL, NULL, XmVaPUSHBUTTON, aux, 'A', NULL, NULL, NULL); XtManageChild(file_type_w); XmStringFree(as_all); XmStringFree(as_fra); XmStringFree(con_fra); XmStringFree (aux); XmStringFree(title); XtAddCallback(s_dialog, XmNokCallback, save_file_cb, NULL); XtAddCallback(s_dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); /* No help available ... */ XtUnmanageChild (XmFileSelectionBoxGetChild(s_dialog,XmDIALOG_HELP_BUTTON)); } /* Change to a directory that was just recently operated in any of the file selection dialogs and refresh the file list so that newly created files do show up */ XtVaSetValues (s_dialog, XmNdirectory, get_current_directory (), NULL); XmFileSelectionDoSearch (s_dialog, NULL); XtAddCallback (s_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (s_dialog); XtPopup (XtParent (s_dialog), XtGrabNone); break; case 3: if (!m_dialog) { m_dialog = XmCreateFileSelectionDialog (toplevel, "file_sel", NULL, 0); title=XmStringCreateLocalized ("Merge With File"); XtVaSetValues (m_dialog, XmNdialogTitle, title, NULL); title = XmStringCreateLocalized ("*.xyz"); XtVaSetValues (m_dialog, XmNpattern, title, NULL); { void merge_type_cb (Widget, XtPointer, XtPointer); Widget merge_type_w; XmString merge_frame, merge_all; merge_frame = XmStringCreateLocalized ("Use first frame"); merge_all = XmStringCreateLocalized ("Use all frames"); title = XmStringCreateLocalized ("Merge type"); merge_type_w = XmVaCreateSimpleOptionMenu (m_dialog, "Merge type", title, 'M', 0, merge_type_cb, XmVaPUSHBUTTON, merge_frame, 'f', NULL, NULL, XmVaPUSHBUTTON, merge_all, 'a', NULL, NULL, NULL); XtManageChild (merge_type_w); XmStringFree (merge_frame); XmStringFree (merge_all); } XmStringFree (title); XtAddCallback (m_dialog, XmNokCallback, merge_file_cb, NULL); XtAddCallback (m_dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); /* No help available ... */ XtUnmanageChild (XmFileSelectionBoxGetChild(m_dialog,XmDIALOG_HELP_BUTTON)); } /* Change to a directory that was just recently operated in any of the file selection dialogs and refresh the file list so that newly created files do show up */ XtVaSetValues (m_dialog, XmNdirectory, get_current_directory (), NULL); XmFileSelectionDoSearch (m_dialog, NULL); XtAddCallback (m_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (m_dialog); XtPopup (XtParent (m_dialog), XtGrabNone); break; case 4: if (!e_dialog) { e_dialog = XmCreateFileSelectionDialog (toplevel, "file_sel", NULL, 0); title=XmStringCreateLocalized ("Export File"); XtVaSetValues(e_dialog, XmNdialogTitle, title, NULL); /* okCallback calls save_file(), cancelCallback unmanages the FileSelectionDialog widget */ bw_fig = XmStringCreateLocalized("Fig (b/w)"); col_fig = XmStringCreateLocalized("Fig (colour)"); eps_bw = XmStringCreateLocalized("EPS (b/w)"); eps_co = XmStringCreateLocalized("EPS (colour)"); #ifdef XPM xpm = XmStringCreateLocalized("XPM"); #endif #ifdef GL gl2ps_eps = XmStringCreateLocalized("GL2PS (EPS)"); gl2ps_pdf = XmStringCreateLocalized("GL2PS (PDF)"); gl2ps_svg = XmStringCreateLocalized("GL2PS (SVG)"); #endif title=XmStringCreateLocalized ("File type"); export_type_w=XmVaCreateSimpleOptionMenu (e_dialog,"File type",title,'F', 0, export_type_cb, XmVaPUSHBUTTON, bw_fig, 'S', NULL, NULL, XmVaPUSHBUTTON, col_fig, 'T', NULL, NULL, XmVaPUSHBUTTON, eps_bw, 'E', NULL, NULL, XmVaPUSHBUTTON, eps_co, 'P', NULL, NULL, #ifdef XPM XmVaPUSHBUTTON, xpm, 'X', NULL, NULL, #endif #ifdef GL XmVaPUSHBUTTON, gl2ps_eps, 'G', NULL, NULL, XmVaPUSHBUTTON, gl2ps_pdf, 'P', NULL, NULL, XmVaPUSHBUTTON, gl2ps_svg, 'V', NULL, NULL, #endif NULL); XtManageChild(export_type_w); XmStringFree (bw_fig); XmStringFree (col_fig); XmStringFree(eps_bw); XmStringFree(eps_co); #ifdef XPM XmStringFree(xpm); #endif #ifdef GL XmStringFree (gl2ps_eps); XmStringFree (gl2ps_pdf); XmStringFree (gl2ps_svg); #endif XmStringFree(title); XtAddCallback(e_dialog, XmNokCallback, export_file_cb, (XtPointer) 3); XtAddCallback(e_dialog, XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); /* No help available ... */ XtUnmanageChild (XmFileSelectionBoxGetChild(e_dialog,XmDIALOG_HELP_BUTTON)); } /* Change to a directory that was just recently operated in any of the file selection dialogs and refresh the file list so that newly created files do show up */ XtVaSetValues (e_dialog, XmNdirectory, get_current_directory (), NULL); XmFileSelectionDoSearch (e_dialog, NULL); XtAddCallback (e_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (e_dialog); XtPopup (XtParent (e_dialog), XtGrabNone); break; case 5:/* aro: Create print dialog */ if (!p_dialog) { p_dialog = XmCreateMessageDialog(toplevel, "print dialog", NULL, 0); title=XmStringCreateLocalized ("Print File"); XtVaSetValues(p_dialog, XmNdialogTitle, title, NULL); XmStringFree (title); /* Change OK button label to "Print" */ temp_widget = XmMessageBoxGetChild(p_dialog, XmDIALOG_OK_BUTTON); title=XmStringCreateLocalized("Print"); XtVaSetValues(temp_widget, XmNlabelString, title, NULL); XmStringFree (title); /* Main RowColumn */ rc[0] = XtVaCreateManagedWidget("rc_main", xmRowColumnWidgetClass, p_dialog, XmNorientation, XmVERTICAL, NULL); /* First sub RowColumn */ rc[1] = XtVaCreateManagedWidget("rc_sub_1", xmRowColumnWidgetClass, rc[0], XmNorientation, XmHORIZONTAL, NULL); XtVaCreateManagedWidget("File:", xmLabelWidgetClass, rc[1], NULL); /* If current_file_name is an empty string, assume no file has been loaded */ if(strcmp(current_file_name, "") == 0) title = XmStringCreateLocalized ("(no file loaded)"); else title = XmStringCreateLocalized (current_file_name); XtVaCreateManagedWidget("file_name", xmLabelWidgetClass, rc[1], XmNlabelString, title, NULL); XmStringFree(title); /* Second sub RowColumn */ rc[1] = XtVaCreateManagedWidget("rc_sub_2", xmRowColumnWidgetClass, rc[0], XmNorientation, XmHORIZONTAL, NULL); XtVaCreateManagedWidget("Printer:", xmLabelWidgetClass, rc[1], NULL); /* Parse /etc/printcap to get list of available printers. User can still type in an arbitrary name */ printcap_file = fopen("/etc/printcap", "r"); i = 0, j = 0; if(printcap_file != NULL) { line_ptr = fgets(line, sizeof(line), printcap_file); while(line_ptr != NULL && j < MAX_PRINTERS) { /* If line[i] is an alphanumeric character, assume it is part of printer name */ if(isalnum((int)line[i])) { printer_strings[j][i] = line[i]; i++; } /* If line[i] is '|' or ':' then we've reached end of printer name, append '\0' to printer_strings and get next line */ else if(line[i] == '|' || line[i] == ':') { printer_strings[j][i] = '\0'; line_ptr = fgets(line, sizeof(line), printcap_file); i = 0; j++; } /* If line[i] is not an alphanumeric character and it is not '|' or ':' then get next line of printcap_file */ else { line_ptr = fgets(line, sizeof(line), printcap_file); i = 0; } } fclose(printcap_file); } /* Set first empty element of printer_strings to "ENDLIST" to denote end. If failure in opening printcap_file, then j == 0 */ strcpy(printer_strings[j], "ENDLIST"); /* Get default printer name if one of the environment variables LPDEST or PRINTER is set */ printer_name = getenv("LPDEST"); if(printer_name == NULL) printer_name = getenv("PRINTER"); if(printer_name == NULL) { printer_name = alloca(32); strcpy(printer_name, "(no default)"); } /* Create printer name text field initialized with name of default printer */ print_printer = XtVaCreateManagedWidget("p_name", xmTextFieldWidgetClass, rc[1], XmNcolumns, 20, XmNvalue, printer_name, NULL); /* Third sub RowColumn */ rc[1] = XtVaCreateManagedWidget("rc_sub_3", xmRowColumnWidgetClass, rc[0], NULL); /* Convert printer strings to XmStrings */ for(j = 0; strcmp(printer_strings[j], "ENDLIST"); j++) printer_xmstrings[j] = (XmString *)XmStringCreateLocalized(printer_strings[j]); /* Create scrolled list with names of first MAX_PRINTERS printers from print_cap file */ i = 0; XtSetArg(args[i], XmNselectionPolicy, XmSINGLE_SELECT); i++; /* if j = 0, then no printers were found in /etc/printcap, so we don't want to set XmNitems to printer_xmstrings, or we'll get a warning about XmNitemCount not agreeing with XmNitems */ if(j != 0) {XtSetArg(args[i], XmNitems, printer_xmstrings); i++;} XtSetArg(args[i], XmNitemCount, j); i++; XtSetArg(args[i], XmNvisibleItemCount, 5); i++; temp_widget = XmCreateScrolledList(rc[1], "Printers", args, i); XtManageChild(temp_widget); XtAddCallback(temp_widget, XmNsingleSelectionCallback, print_file_select_cb, print_printer); XtVaCreateManagedWidget("Copies:", xmLabelWidgetClass, rc[1], NULL); /* Create text field to let user input number of copies to be printed */ XtVaCreateManagedWidget("num_copies", xmTextFieldWidgetClass, rc[1], XmNvalue, "1", XmNcolumns, 4, NULL); /* Create radio box to let user select color or black & white output */ rc[1] = XmCreateRadioBox(rc[0],"color/bw",NULL,0); XtVaSetValues(rc[1], XmNorientation, XmHORIZONTAL, NULL); XtVaCreateManagedWidget("color", xmToggleButtonWidgetClass, rc[1], XmNset, True, NULL); XtVaCreateManagedWidget("bw", xmToggleButtonWidgetClass, rc[1], NULL); XtManageChild(rc[1]); /* Create Label and TextField to display current print command and format */ XtVaCreateManagedWidget("Print command and format:", xmLabelWidgetClass, rc[0], NULL); sprintf(print_command_string, "lpr -P%%printer%% -#%%num_copies%% %%filename%%"); print_command = XtVaCreateManagedWidget("print_command_label", xmTextFieldWidgetClass, rc[0], XmNvalue, print_command_string, NULL); XtAddCallback(p_dialog, XmNokCallback, print_file_cb, print_command); /* No help available ... */ XtUnmanageChild (XmMessageBoxGetChild(p_dialog,XmDIALOG_HELP_BUTTON)); }else{ /* Update file name */ temp_widget = XtNameToWidget(p_dialog, "rc_main.rc_sub_1.file_name"); /* If current_file_name is an empty string, assume no file has been loaded */ if(strcmp(current_file_name, "") == 0) title = XmStringCreateLocalized ("(no file loaded)"); else title = XmStringCreateLocalized (current_file_name); XtVaSetValues(temp_widget, XmNlabelString, title, NULL); XmStringFree(title); } XtAddCallback (p_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild (p_dialog); XtPopup (XtParent (p_dialog), XtGrabNone); break; case 6: cleanup_cb(toplevel, NULL, NULL); /* aro - cleanup before exit */ exit (0); break; } } void file_type_cb(Widget widget, XtPointer client_data, XtPointer call_data) { file_type = (int) client_data; } void export_type_cb(Widget widget, XtPointer client_data, XtPointer call_data) { export_type = (int) client_data; } void merge_type_cb (Widget widget, XtPointer client_data, XtPointer call_data) { merge_type = (enum merge_types) client_data; } void load_file_cb(Widget dialog, XtPointer client_data, XtPointer call_data) { void open_file(char *, Boolean); /* aro - moved char file_name[1024] to char current_file_name[1024] in globals.h */ char *file = NULL; XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data; if (cbs) { if (!XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &file)) return; /* internal error */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); /* save file name and open the file */ (void) strcpy(current_file_name, file); open_file(current_file_name, FALSE); XtFree (file); /* free allocated data from XmStringGetLtoR() */ } XtUnmanageChild(dialog); } void save_file_cb(Widget dialog, XtPointer client_data, XtPointer call_data) { void write_file(char *); char *file_name, message_string[1024]; XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data; if (cbs) { if (!XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &file_name)) return; /* internal error */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); /* Check if we can open the file */ if(fopen(file_name, "w") == NULL) { sprintf(message_string, "Cannot open %s for write", file_name); echo_to_message_area(message_string); } else { write_file(file_name); } XtFree (file_name); /* free allocated data from XmStringGetLtoR() */ } XtUnmanageChild(dialog); } void merge_file_cb (Widget dialog, XtPointer client_data, XtPointer call_data) { double get_angle_axis(double *); void open_file(char *, Boolean); void rotate_atoms(double *,double,Boolean,Boolean); void frame_content_to_atoms (int); struct frame * get_selected_frame (void); int i, j, merge_no_atoms; char *file = NULL, buf[BUFSIZ], eof_string[32] = ""; char merge_file_name[1024], *temp_file_name; double angle, axis[3]; Boolean eof_merge_file = False; FILE *merge_file, *temp_file; struct frame *this_frame; XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data; if (cbs) { if (!XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &file)) return; /* internal error */ (void) strcpy (merge_file_name, file); XtFree (file); /* free allocated data from XmStringGetLtoR() */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); } XtUnmanageChild(dialog); merge_file = fopen (merge_file_name, "r"); if(merge_file == NULL) { sprintf(buf,"No file %s",gnu_basename(merge_file_name)); echo_to_message_area(buf); return; } /* Set up temporary file */ temp_file_name = alloca (32); strcpy (temp_file_name, "/tmp/xmakemol.XXXXXX"); temp_file = fdopen (mkstemp (temp_file_name), "w"); if(temp_file == NULL) { sprintf(buf,"Cannot open %s",temp_file_name); echo_to_message_area(buf); return; } /* Make sure none of this is drawn */ inhibit_canvas_callback = 1; /* Reset the angle_axis_matrix */ for(i = 0; i < 3; i++) { for(j = 0; j < 3; j++) { angle_axis_matrix[i][j] = global_matrix[i][j]; } } /* Loop over frames */ for(i = 0; i < no_frames; i++) { int frame_visible_atoms; int count_visible_atoms_in_frame (struct frame *); /* Rewind the merge file if appropriate */ if (merge_type == MERGE_FRAME) { rewind (merge_file); } /* Check to see if we have reached the end of the merge file */ if (eof_merge_file == False) { fgets (buf, sizeof (buf), merge_file); if (feof (merge_file)) { merge_no_atoms = 0; eof_merge_file = True; sprintf (eof_string, " - merge stopped after frame %d", i); } else { sscanf (buf, "%d", &merge_no_atoms); /* Gobble the comment line */ fgets (buf, sizeof (buf), merge_file); } } frame_content_to_atoms (i); this_frame = get_selected_frame(); frame_visible_atoms = count_visible_atoms_in_frame (this_frame); fprintf(temp_file, "%d\n", frame_visible_atoms + merge_no_atoms); fprintf(temp_file, "%s\n", this_frame->comment); angle = get_angle_axis(axis); rotate_atoms(axis, angle, 0, False); for(j = 0; j < no_atoms; j++) { if(atoms[j].visi == 1) { /* We need to add the global_vector component as there may have been translations */ fprintf(temp_file,"%2s %12.6f %12.6f %12.6f\n", atoms[j].label, atoms[j].x + global_vector[0], atoms[j].y + global_vector[1], atoms[j].z + global_vector[2]); } } /* Now insert the merged frame if available */ if (eof_merge_file == False) { for (j = 0; j < merge_no_atoms; j++) { fgets (buf, sizeof (buf), merge_file); fputs (buf, temp_file); } } } fclose(temp_file); inhibit_canvas_callback = 0; open_file(temp_file_name, FALSE); sprintf(buf,"Files merged%s", eof_string); echo_to_message_area(buf); unlink (temp_file_name); /* If the Edit->Positions dialog is open, make the merged atoms the only ones that we can move */ if (edit_posn_dialog != NULL) { for (i = 0; i < no_atoms; i++) { if (i < no_atoms - (merge_no_atoms)) { atoms[i].edit = 0; } } } } void export_file_cb(Widget dialog, XtPointer client_data, XtPointer call_data) { void export_file(char *); char *file_name, message_string[1024]; XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data; if (cbs) { if (!XmStringGetLtoR (cbs->value, XmFONTLIST_DEFAULT_TAG, &file_name)) return; /* internal error */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); /* Check if we can open the file */ if(fopen(file_name, "w") == NULL) { sprintf(message_string, "Cannot open %s for write", file_name); echo_to_message_area(message_string); } else { export_file(file_name); } XtFree (file_name); /* free allocated data from XmStringGetLtoR() */ } XtUnmanageChild(dialog); } void print_file_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void write_eps(char *, FILE *, Boolean); void echo_to_message_area(char *); char *string, *temp_file_name, *p_name, *copies, p_command[1024]; const char printer_str[] = "%printer%", numcopies_str[] = "%num_copies%", filename_str[] = "%filename%"; char *printer_pos, *numcopies_pos, *filename_pos; int num_copies, i, j; Boolean print_color; Widget temp_w, print_command = (Widget) client_data; FILE * temp_f, *eps_file; XmString errorMsg; /* Get widget ID of color toggle */ temp_w = XtNameToWidget(widget, "rc_main.color/bw.color"); /* Get value of color toggle (true or false) */ XtVaGetValues(temp_w, XmNset, &print_color, NULL); /* Create unique file name in /tmp */ temp_file_name = alloca (32); strcpy (temp_file_name, "/tmp/xmakemol.XXXXXX"); eps_file = fdopen (mkstemp (temp_file_name), "w"); /* Write eps file to /tmp for printing */ write_eps ("", eps_file, print_color); /* Get the name of the printer selected */ temp_w = XtNameToWidget(widget, "rc_main.rc_sub_2.p_name"); XtVaGetValues(temp_w, XmNvalue, &p_name, NULL); /* Get the number of copies to be printed */ temp_w = XtNameToWidget(widget, "rc_main.rc_sub_3.num_copies"); XtVaGetValues(temp_w, XmNvalue, &copies, NULL); num_copies = atoi(copies); /* Determine whether user is printing in color or black & white */ temp_w = XtNameToWidget(widget, "rc_main.color/bw.color"); XtVaGetValues(temp_w, XmNset, &print_color, NULL); if(strcmp(p_name, "(no default)") == 0 || strcmp(p_name, "") == 0) { echo_to_message_area("Print Error - No Printer Selected"); } else if(!(temp_f = fopen(current_file_name, "r"))) { echo_to_message_area("Print Error - No File Loaded"); } else { fclose(temp_f); string = alloca (32); XtVaGetValues(print_command, XmNvalue, &string, NULL); /* Create print command string */ /* Check if user put all three variable fields in print command string */ printer_pos = strstr(string, printer_str); numcopies_pos = strstr(string, numcopies_str); filename_pos = strstr(string, filename_str); if(printer_pos && numcopies_pos && filename_pos) { for(i = 0, j = 0; string[i] != '\0'; i++) { if(string[i] == '%') { switch(string[i+1]) { case 'p': strcat(p_command, p_name); j += strlen(p_name); i += strlen(printer_str) - 1; break; case 'n': strcat(p_command, copies); j += strlen(copies); i += strlen(numcopies_str) - 1; break; case 'f': strcat(p_command, temp_file_name); j += strlen(temp_file_name); i += strlen(filename_str) - 1; break; default: p_command[j] = string[i]; p_command[j+1] = '\0'; j++; break; } } else { p_command[j] = string[i]; p_command[j+1] = '\0'; j++; } } system(p_command); echo_to_message_area("Print job sent"); } else { errorMsg = XmStringCreateLocalized("Need to have %printer%, %num_copies%,\nand %filename% in print command string."); i = 0; XtSetArg(args[i], XmNmessageString, errorMsg); i++; temp_w = XmCreateErrorDialog(toplevel, "error", args, i); XtUnmanageChild(XmMessageBoxGetChild(temp_w,XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(temp_w,XmDIALOG_HELP_BUTTON)); XtManageChild(temp_w); } } /* Remove eps file from /tmp */ remove(temp_file_name); } void print_file_select_cb(Widget widget, XtPointer client_data, XtPointer call_data) { XmListCallbackStruct *cbs = (XmListCallbackStruct *) call_data; Widget w = (Widget) client_data; char *p_select; /* Convert selected XmString to regular string */ XmStringGetLtoR(cbs->item, XmFONTLIST_DEFAULT_TAG, &p_select); /* Update value of printer_name text field with currently selected printer */ XtVaSetValues(w, XmNvalue, p_select, NULL); } void open_file(char *file_name, Boolean revert) { void malloc_failed(char *); void pre_load_file_hooks (Boolean); void post_load_file_hooks (Boolean); void store_coords (void); void read_aux (char *); void set_selected_frame (struct frame *); int i, no_atoms_in_frame; int molecule; /* Molecule index */ char buf[BUFSIZ], atom_label[4], mode[16]; char *line_stat = NULL; FILE *in_file; Widget widget; /* this is only needed to show the bbox if it is given in the .xyz-file */ #ifdef GL enum gl_render_types gl_current_render_type = DEFAULT; #endif if (opendir (file_name)) { sprintf (buf, "Cannot open directory %s", file_name); echo_to_message_area (buf); return; } else if (strcmp (file_name, "") == 0) { /* This means read from stdin */ in_file = stdin; strcpy (file_name, ""); strcpy (current_file_name, ""); } else { /* Read from disk */ in_file = fopen (file_name, "r"); } if (in_file == NULL) { sprintf (buf, "xmakemol: cannot open %s for read", gnu_basename (file_name)); echo_to_message_area (buf); return; } /* At this point, we're willing to read in a file... */ pre_load_file_hooks (revert); /* read in frames */ no_frames = 0; /* change to 0 if we find otherwise */ while (1) { /* line declaring number of atoms */ line_stat = fgets (buf, sizeof (buf), in_file); if (line_stat == NULL) { if (no_frames == 0) { fprintf (stderr, "xmakemol: read zero frames in file %s\n", file_name); exit (1); } break; } sscanf (buf, "%d", &no_atoms_in_frame); no_frames++; /* Allocate the pointer to the frame */ if (no_frames == 1) { first_frame = (struct frame *) malloc (sizeof (struct frame)); current_frame = first_frame; } else { current_frame->next = (struct frame *) malloc (sizeof (struct frame)); current_frame = current_frame->next; } if (current_frame == NULL) { malloc_failed ("current_frame"); } /* Reset properties */ current_frame->perspective_depth = 0; current_frame->perspective_scale = 0; current_frame->bbox_available = FALSE; molecule = 0; /* Allocate the contents of the frame */ current_frame->no_atoms = no_atoms_in_frame; current_frame->atom = (struct atom *) malloc (no_atoms_in_frame * sizeof (struct atom)); if (current_frame->atom == NULL) { malloc_failed ("current_frame->atom"); } /* comment line -- NULL terminate */ fgets (buf, sizeof (buf), in_file); buf[strlen (buf) - 1] = '\0'; strcpy (current_frame->comment, buf); for (i = 0; i < no_atoms_in_frame; i++) { void make_label_uppercase (char *); char *optional = NULL, prop[16], ucased_label[4]; int type_found; fgets(buf, sizeof (buf), in_file); /* read and store the atom coordinates */ sscanf (buf, "%s %lf %lf %lf", atom_label, ¤t_frame->atom[i].x, ¤t_frame->atom[i].y, ¤t_frame->atom[i].z); /* Look for optional properties */ current_frame->atom[i].has_vector = 0; current_frame->atom[i].has_rgb = False; current_frame->atom[i].has_color_name = False; /* Read vectors (MAX_VECTORS_PER_ATOM allowed) */ optional = buf; while (optional && strstr (optional, "atom_vector")) /* Vectors */ { int nv; double x, y, z; optional = strstr (optional, "atom_vector"); nv = current_frame->atom[i].has_vector; if (current_frame->atom[i].has_vector == MAX_VECTORS_PER_ATOM) /* One too many here */ { printf ("Too many Vectors (%d) read for atom %d\n", nv + 1, i + 1); exit (2); } sscanf (optional, "%s %lf %lf %lf", prop, &x, &y, &z); current_frame->atom[i].vx[nv] = x; current_frame->atom[i].vy[nv] = y; current_frame->atom[i].vz[nv] = z; /* Move pointer past match */ current_frame->atom[i].has_vector++; optional++; } /* Read ellipse data */ optional = buf; if (optional && strstr (optional, "ellipse")) /* Ellipse properties */ { double x, y, z, alpha, beta, gamma; optional = strstr (optional, "ellipse"); sscanf (optional, "%s %lf %lf %lf %lf %lf %lf", prop, &x, &y, &z, &alpha, &beta, &gamma); current_frame->atom[i].is_ellipse = 1; current_frame->atom[i].euler[0] = alpha; current_frame->atom[i].euler[1] = beta; current_frame->atom[i].euler[2] = gamma; current_frame->atom[i].shape[0] = x; current_frame->atom[i].shape[1] = y; current_frame->atom[i].shape[2] = z; optional++; } else { current_frame->atom[i].is_ellipse = 0; } /* Read crystal data */ optional = buf; if (optional && strstr (optional, "crystal_origin")) { void set_crystal_origin (double *); double x[3]; optional = strstr (optional, "crystal_origin"); sscanf (optional, "%s %lf %lf %lf", prop, &x[0], &x[1], &x[2]); set_crystal_origin (x); optional++; } optional = buf; if (optional && strstr (optional, "crystal_images")) { void set_crystal_images (int *); int p[3]; optional = strstr (optional, "crystal_images"); sscanf (optional, "%s %d %d %d", prop, &p[0], &p[1], &p[2]); set_crystal_images (p); optional++; } optional = buf; while (optional && strstr (optional, "crystal_vector")) { void set_crystal_vector (int, double *); int i; double x[3]; optional = strstr (optional, "crystal_vector"); sscanf (optional, "%s %d %lf %lf %lf", prop, &i, &x[0], &x[1], &x[2]); set_crystal_vector (i, x); optional++; } while (optional && strstr (optional, "atom_rgb")) { double red, green, blue; optional = strstr (optional, "atom_rgb"); sscanf (optional, "%s %lf %lf %lf", prop, &red, &green, &blue); current_frame->atom[i].red = red; current_frame->atom[i].green = green; current_frame->atom[i].blue = blue; current_frame->atom[i].has_rgb = True; optional++; } while (optional && strstr (optional, "atom_color")) { char color_name[32]; optional = strstr (optional, "atom_color"); sscanf (optional, "%s %s", prop, color_name); strcpy (current_frame->atom[i].color_name, color_name); current_frame->atom[i].has_color_name = True; optional++; } /* Read bounding box data */ optional = buf; if (optional && strstr (optional, "bbox_xyz")) { double xmin, xmax, ymin, ymax, zmin, zmax; optional = strstr (optional, "bbox_xyz"); sscanf (optional, "%s %lf %lf %lf %lf %lf %lf", prop, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax); current_frame->bbox[0][0] = xmin; current_frame->bbox[0][1] = xmax; current_frame->bbox[1][0] = ymin; current_frame->bbox[1][1] = ymax; current_frame->bbox[2][0] = zmin; current_frame->bbox[2][1] = zmax; current_frame->bbox_available = TRUE; /* If bbox_xyz is given in the input-file we show the bounding box. and use the given bbox as default. */ bbox_type = FROM_FILE; bbox_flag = 1; if((widget = XtNameToWidget(nth_menu[4], "button_7"))) XtVaSetValues(widget, XmNset, True, NULL); optional++; } while (optional && strstr (optional, "molecule")) { optional = strstr (optional, "molecule"); /* Don't increment if this is the first atom of a frame; that this is the start of a molecule is implied. */ if (i > 0) molecule++; optional++; } current_frame->atom[i].molecule = molecule; #ifdef GL while (optional && strstr (optional, "render_ball_and_stick")) { optional = strstr (optional, "render_ball_and_stick"); gl_current_render_type = BALL_AND_STICK; optional++; } while (optional && strstr (optional, "render_tube")) { optional = strstr (optional, "render_tube"); gl_current_render_type = TUBES; optional++; } current_frame->atom[i].gl_render_type = gl_current_render_type; #endif /* GL */ /* store the atom label */ strcpy (current_frame->atom[i].label, atom_label); /* make an uppercased copy */ strcpy (ucased_label, atom_label); make_label_uppercase (ucased_label); /* reset properties */ current_frame->atom[i].visi = 1; /* See if this type of atom has already been read in -- if not, add it to the end of the type list */ type_found = 0; current_type = first_type; while (1) { if (current_type == NULL) break; if (strcmp (ucased_label, current_type->label) == 0) { type_found = 1; } if (current_type->next == NULL) break; current_type = current_type->next; } if (type_found == 0) { if (first_type == NULL) { first_type = (struct type *) malloc (sizeof (struct type)); current_type = first_type; } else { current_type->next = (struct type *) malloc (sizeof (struct type)); current_type = current_type->next; } strcpy (current_type->label, ucased_label); current_type->next = NULL; } } } /* NULL terminate the list of frames */ current_frame->next = NULL; /* Are any of the atoms hydrogen? */ any_hydrogen = False; for (i = 0; i < 4; i++) { selected[i]=-1; } sel_init = 0; /* remove any selections */ atoms_sorted = 0; no_atoms = first_frame->no_atoms; /* Read auxiliary file if it exists */ read_aux (file_name); post_load_file_hooks (revert); store_coords(); if (revert) { strcpy (mode, "reverted"); } else { strcpy (mode, "read"); } if(no_frames == 1) { sprintf(buf, "File %s %s: 1 frame", gnu_basename (file_name), mode); } else { sprintf(buf, "File %s %s: %d frames", gnu_basename (file_name), mode, no_frames); } echo_to_message_area (buf); } void pre_load_file_hooks (Boolean revert) { void read_elements_file (void); void reset_crystal_status (void); void reset_frame_list (void); void reset_type_list (void); void save_perspective_data (void); /* List of things to do before reading in new data */ if (revert) save_perspective_data (); read_elements_file (); reset_crystal_status (); reset_frame_list (); reset_type_list (); } void reset_frame_list (void) { struct frame *next_frame; current_frame = first_frame; while (current_frame != NULL) { next_frame = current_frame->next; free ((struct atom *) current_frame->atom); free ((struct frame *) current_frame); current_frame = next_frame; } first_frame = NULL; } void reset_type_list (void) { struct type *next_type; current_type = first_type; while (current_type != NULL) { next_type = current_type->next; free ((struct type *) current_type); current_type = current_type->next; current_type = next_type; } first_type = NULL; } void calculate_frame_bboxes (void) { void frame_content_to_atoms (int); struct frame *this_frame; int temp_frame = frame_no; int i; this_frame = first_frame; for(i = 0; i < no_frames; i++) { frame_content_to_atoms (i); /* If no bbox given for this frame, use the one from the first frame, if it exists */ if (! this_frame->bbox_available) { if (first_frame->bbox_available) { this_frame->bbox[0][0] = first_frame->bbox[0][0]; this_frame->bbox[0][1] = first_frame->bbox[0][1]; this_frame->bbox[1][0] = first_frame->bbox[1][0]; this_frame->bbox[1][1] = first_frame->bbox[1][1]; this_frame->bbox[2][0] = first_frame->bbox[2][0]; this_frame->bbox[2][1] = first_frame->bbox[2][1]; this_frame->bbox_available = TRUE; } } this_frame = this_frame->next; } frame_content_to_atoms (temp_frame); } void post_load_file_hooks (Boolean revert) { void canvas_cb (Widget, XtPointer, XtPointer); void reallocate_atom_types (void); void reset_any_atoms (void); void reset_global_matrix (void); void set_default_depth (void); void update_bond_matrix (Boolean); void frame_content_to_atoms (int); void deactivate_region (void); void update_some_dialogs (void); void update_frame_label (void); void set_selected_frame (struct frame *); void check_frame_sizes (void); void calculate_frame_bboxes (void); void update_bbox (void); void load_perspective_data (void); /* List of things to do after reading in new data */ check_frame_sizes (); set_selected_frame (NULL); reset_any_atoms (); /* Must precede reallocate_atom_types */ reallocate_atom_types (); if (revert) { double get_angle_axis (double *); void rotate_atoms (double *, double, Boolean, Boolean); int i, j; double angle, axis[3]; frame_content_to_atoms (frame_no); /* get angle-axis rotation from global_matrix positions... */ for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { angle_axis_matrix[i][j] = global_matrix[i][j]; } } angle = get_angle_axis (axis); rotate_atoms (axis, angle, 0, False); load_perspective_data (); } else { frame_no = 0; frame_content_to_atoms (frame_no); reset_global_matrix (); if (! aux_file_exists_p) set_default_depth (); } update_bond_matrix (True); deactivate_region (); update_frame_label (); update_some_dialogs (); calculate_frame_bboxes (); update_bbox (); redraw = 1; canvas_cb (canvas, NULL, NULL); } void reset_any_atoms (void) { int i, elem_found; for (i = 0; i < no_elements; i++) { element[i].any_atoms = False; } current_type = first_type; while (current_type != NULL) { elem_found = 0; for (i = 0; i < no_elements; i++) { if (strcmp (current_type->label, element[i].label) == 0) { element[i].any_atoms = True; current_type->elem = i; elem_found = 1; } } if (elem_found == 0) { fprintf (stderr, "xmakemol: element %s not found in elements file\n", current_type->label); element[0].any_atoms = True; current_type->elem = 0; /* Dummy */ strcpy (current_type->label, "DU"); /* Dummy */ } current_type = current_type->next; } no_atom_types = 0; for (i = 0; i < no_elements; i++) { if (element[i].any_atoms == True) { no_atom_types++; } } } /* Expects label to be uppercase */ static Boolean dummy_message_not_shown = True; int get_element_index_for_type (char *label) { int element_index = 0; current_type = first_type; while ((current_type != NULL) && (element_index == 0)) { if (strcmp (current_type->label, label) == 0) { element_index = current_type->elem; } current_type = current_type->next; } if ((element_index == 0) || (dummy_message_not_shown)) { /* FIXME: let's have a console for this, so that messages aren't swallowed up by subsequent ones */ echo_to_message_area ("Dummy atoms detected"); dummy_message_not_shown = False; } return (element_index); } void reset_global_matrix (void) { int i, j; /* To accommodate frames, and keep the relative orientations the * same we adopt this method:- * * We monitor a rotation matrix relative to the global axes. When * the frame is changed, the atomic coordinates are rotated into * this basis. */ for (i = 0; i < 3; i++) { global_vector[i] = 0; for (j = 0; j < 3; j++) { if (i == j) { global_matrix[i][j] = 1; } else { global_matrix[i][j] = 0; } } } } void reallocate_atom_types (void) { int i, typei; if (atom_types != NULL) { free ((int *) atom_types); } atom_types = (int *) malloc (no_atom_types * sizeof (int)); typei = 0; for (i = 0; i < no_elements; i++) { if(element[i].any_atoms) { atom_types[typei] = i; typei++; } } } void assign_atom_types (void) { int i, j; for (i = 0; i < no_atoms; i++) { for (j = 0; j < no_atom_types; j++) { if(strcmp (atoms[i].uppercase_label, element[atom_types[j]].label) == 0) { atoms[i].type = j; } } } } void set_default_depth (void) { int xm_nint (double); void set_canvas_scale (double); void set_depth_all_frames (int); void set_scale_all_frames (int); void set_z_depth (double); int i; double x, y, z, r, r_max; r_max = 0; for (i = 0; i < no_atoms; i++) { x = atoms[i].x; y = atoms[i].y; z = atoms[i].z; r = (x * x) + (y * y) + (z * z); if (r == 0.0) { r = atoms[i].vdw_rad; } if (r > r_max) { r_max = r; } } r_max = sqrt (r_max); depth = xm_nint (DEPTH + r_max); /* Maybe use z_max? */ /* Pass the value of the depth to set_z_depth */ set_depth_all_frames (depth); set_z_depth (depth); /* Pass the value of the original scale to set_canvas_scale - this could be set such that a point at r_max touches the side of the canvas, when in the correct orientation. We usually would like to room at the edge and an additional factor of 1.25 seems to work reasonably well */ { int fudge = 2.0, v_scale_int; double scale; scale = canvas_width / (2.0 * fudge * r_max); set_canvas_scale (scale); v_scale_int = xm_nint (100.0 * log (scale + 1) / log(2.0)); set_scale_all_frames (v_scale_int); } /* Update gl_eye so inital GL rendered image looks similar to initial X11 rendered image */ #ifdef GL { double get_gl_fov(); double get_canvas_scale(); double get_z_depth(); void set_gl_eye(double); double get_gl_eye(void); double new_gl_eye; double gl_fov_rad; double scale_to_width; Widget eye_scale; gl_fov_rad = get_gl_fov() * (PI / 180); scale_to_width = (get_canvas_scale() * get_z_depth()) / (float)canvas_width; new_gl_eye = (r_max * 2 * scale_to_width) / tan(gl_fov_rad / 2); set_gl_eye(new_gl_eye); if(gl_render_dialog){ eye_scale = XtNameToWidget(gl_render_dialog, "row_column.hor_row_column.eye_scale"); XtVaSetValues(eye_scale, XmNvalue, (int) get_gl_eye(), NULL); } } #endif /* GL */ } void write_file(char *file_name) { void write_ascii_all(char *); void write_ascii_frame(char *, Boolean); void write_aux (char *); switch (file_type) { case 0: write_ascii_all(file_name); break; case 1: write_ascii_frame(file_name, False); /* No connectivities */ break; case 2: write_ascii_frame(file_name, True); /* With connectivities */ break; case 3: /* Auxiliary information */ write_aux (file_name); break; } } void export_file(char *file_name) { void write_eps(char *, FILE *, Boolean); void write_fig_file (char *, Boolean); #ifdef XPM int write_xpm(char *, int); #ifdef GL Boolean render_using_gl_p (void); void canvas_cb(Widget, XtPointer, XtPointer); void set_gl_copy_canvas (int); #endif /* GL */ #endif /* XPM */ #ifdef GL void write_gl2ps (char *, GLint); #endif switch (export_type) { case 0: write_fig_file (file_name, False); break; case 1: write_fig_file (file_name, True); break; case 2: write_eps(file_name, NULL, False); /* False = black and white */ break; case 3: write_eps(file_name, NULL, True); /* True = colour */ break; #ifdef XPM case 4: #ifdef GL /* Under these circumstances, we have to force a redraw to get the pixmap saved */ if (render_using_gl_p ()) { set_gl_copy_canvas (1); redraw = 1; canvas_cb (canvas, NULL, NULL); set_gl_copy_canvas (0); } #endif /* GL */ write_xpm(file_name, 0); break; #endif #ifdef GL case 5: write_gl2ps (file_name, GL2PS_EPS); break; case 6: write_gl2ps (file_name, GL2PS_PDF); break; case 7: write_gl2ps (file_name, GL2PS_SVG); break; #endif } } void write_ascii_frame(char *file_name, Boolean with_connectivities) { int count_visible_atoms (void); struct frame * get_selected_frame (void); int i, no_visible_atoms; char buf[BUFSIZ]; FILE *out_file; struct frame *this_frame; out_file=fopen(file_name,"w"); this_frame = get_selected_frame (); no_visible_atoms = count_visible_atoms (); fprintf (out_file, "%d\n", no_visible_atoms); fprintf (out_file, "%s\n", this_frame->comment); for (i = 0; i < this_frame->no_atoms; i++) { if (atoms[i].visi) { fprintf (out_file, "%2s %12.6f %12.6f %12.6f", atoms[i].label, atoms[i].x,atoms[i].y,atoms[i].z); if (with_connectivities == 1) { int ni; struct node *ptr = bond_adjacency_list[i]; while(ptr != NULL) { ni = (ptr->v); fprintf(out_file, " %d", ni + 1); ptr = ptr->next; } } fprintf(out_file, "\n"); } } fclose(out_file); if(with_connectivities == 1) { sprintf (buf, "File %s written: %d atoms and 1 frame (XYZ + connectivities)", gnu_basename(file_name), no_visible_atoms); } else { sprintf (buf, "File %s written: %d atoms and 1 frame (XYZ)", gnu_basename(file_name), no_visible_atoms); } echo_to_message_area(buf); } void write_ascii_all(char *file_name) { void change_frame(int, Boolean, Boolean); double get_angle_axis(double *); void rotate_atoms(double *,double,Boolean,Boolean); void frame_content_to_atoms (int); struct frame * get_selected_frame (void); int count_visible_atoms_in_frame (struct frame *); int i, j, frame_visible_atoms; char buf[BUFSIZ]; double angle, axis[3]; FILE *out_file; struct frame *this_frame; out_file=fopen(file_name,"w"); /* Make sure none of this is drawn */ redraw = 0; /* Reset the angle_axis_matrix */ for(i = 0; i < 3; i++) { for(j = 0; j < 3; j++) { angle_axis_matrix[i][j] = global_matrix[i][j]; } } /* Loop over frames */ for(i = 0; i < no_frames; i++) { frame_content_to_atoms (i); this_frame = get_selected_frame(); frame_visible_atoms = count_visible_atoms_in_frame (this_frame); fprintf (out_file, "%d\n", frame_visible_atoms); fprintf (out_file, "%s\n", this_frame->comment); angle = get_angle_axis(axis); rotate_atoms(axis, angle, 0, False); for(j = 0; j < this_frame->no_atoms; j++) { if(atoms[j].visi == 1) { /* We need to add the global_vector component as there may have been translations */ fprintf(out_file,"%2s %12.6f %12.6f %12.6f\n", atoms[j].label, atoms[j].x + global_vector[0], atoms[j].y + global_vector[1], atoms[j].z + global_vector[2]); } } } fclose(out_file); if(no_frames == 1) { sprintf(buf, "File %s written: %d frame (XYZ)", gnu_basename(file_name), no_frames); } else { sprintf(buf, "File %s written: %d frames (XYZ)", gnu_basename(file_name), no_frames); } echo_to_message_area(buf); /* Now restore the coordinates */ if(centre_each_frame == 1) { /* Change frame, don't reset title _and_ centre the frame */ change_frame(frame_no, False, True); } else { /* Change frame, don't reset title, _don't_ centre the frame */ change_frame(frame_no, False, False); } } void write_eps(char *file_name, FILE *out_file, Boolean is_colour) { void convert_to_canvas_coords(double *, double *, Boolean); double get_atom_radius(int); double get_hbond_scale(void); double get_h_bond_width(int, int); int get_no_dashes(void); double get_z_depth (void); void update_canvas_bond_points(int, int, Boolean, double); void update_canvas_hbond_points(int, int, Boolean); int i, si, sj, dash_length; int xmin, xmax, ymin, ymax; char string[1024]; double radius, atom_coord[3], canvas_coord[2], hbond_length; struct node *ptr; /* We might have already opened the file, if we used mkstemp to generate the filename */ if (out_file == NULL) { if (strlen (file_name) == 0) { echo_to_message_area ("xmakemol: no file name given in write_eps"); return; } out_file = fopen (file_name, "w"); } xmax = 0; ymax = 0; xmin = canvas_width; ymin = canvas_height; /* Get the bounding-box */ for (i = 0; i < no_atoms; i++) { if (atoms[i].visi == 1) { if (atom_flag == 1) { radius = get_atom_radius(i); atom_coord[0] = atoms[i].x; atom_coord[1] = atoms[i].y; atom_coord[2] = atoms[i].z; convert_to_canvas_coords(atom_coord, canvas_coord, 1); if (canvas_coord[0] + radius > xmax) { xmax = (int)(canvas_coord[0] + radius); } if (canvas_coord[0] - radius < xmin) { xmin = (int)(canvas_coord[0] - radius); } if (canvas_coord[1] + radius > ymax) { ymax = (int)(canvas_coord[1] + radius); } if (canvas_coord[1] - radius < ymin) { ymin = (int)(canvas_coord[1] - radius); } } } } /* Don't worry too much about the axes, as they are in the upper right * corner anyway */ if(axes_flag) { xmax = canvas_width; ymax = canvas_height; } fprintf(out_file,"%%!PS-Adobe-2.0 EPSF-2.0\n"); fprintf(out_file,"%%%%Title: XMakemol\n"); fprintf(out_file,"%%%%BoundingBox: %d %d %d %d\n",xmin, ymin, xmax, ymax); fprintf(out_file,"%%%%EndComments\n"); fprintf(out_file,"%%%%BeginProlog\n"); fprintf(out_file,"/Cc {0 360 arc} def\n"); fprintf(out_file,"/Cp {closepath} def\n"); fprintf(out_file,"/Gs {gsave} def\n"); fprintf(out_file,"/Gr {grestore} def\n"); if(is_colour){ fprintf(out_file,"/Sc {setrgbcolor} def\n"); }else{ fprintf(out_file,"/Wh {1.0 setgray} def\n"); } fprintf(out_file,"/Bl {0.0 setgray} def\n"); fprintf(out_file,"/St {stroke} def\n"); fprintf(out_file,"/Fi {fill} def\n"); fprintf(out_file,"/Mt {moveto} def\n"); fprintf(out_file,"/Lt {lineto} def\n"); fprintf(out_file,"/Sn {show newpath} def\n"); if(is_colour){ fprintf(out_file,"/Draw {Cp Gs Fi Gr Bl St} def\n"); }else{ fprintf(out_file,"/Draw {Cp Gs Wh Fi Gr Bl St} def\n"); } fprintf(out_file,"%%%%EndProlog\n"); fprintf(out_file,"%%%%BeginSetup\n"); fprintf(out_file,"/Times-Roman findfont 10 scalefont setfont\n"); fprintf(out_file,"%%%%EndSetup\n"); fprintf(out_file, "1 setlinewidth\n"); depth = get_z_depth (); for(i=0;iZ_TOL) || (depth_is_on==0)){ if(atoms[si].visi){ if(is_colour) { fprintf(out_file,"%6.3f %6.3f %6.3f Sc\n", (double)atoms[si].red/65536.0, (double)atoms[si].green/65536.0, (double)atoms[si].blue/65536.0); } radius = get_atom_radius(si); atom_coord[0] = atoms[si].x; atom_coord[1] = atoms[si].y; atom_coord[2] = atoms[si].z; convert_to_canvas_coords(atom_coord, canvas_coord, 1); fprintf(out_file,"%d %d %d Cc ", (int) canvas_coord[0], (int) canvas_coord[1], (int) radius); fprintf(out_file,"Draw\n"); } } } if(bond_flag == 1) { /* Draw the bonds */ ptr = bond_adjacency_list[si]; while(ptr != NULL) { sj = (ptr->v); if( (depth_is_on == 0) || (((depth-atoms[si].z>Z_TOL) && (depth-atoms[sj].z>Z_TOL)))) { if(atoms[si].visi && atoms[sj].visi) { if(atoms[si].z<=atoms[sj].z) { update_canvas_bond_points(si, sj, 1, 0.0); if(is_colour){ fprintf(out_file,"%6.3f %6.3f %6.3f Sc\n", (double)atoms[si].red/65536.0, (double)atoms[si].green/65536.0, (double)atoms[si].blue/65536.0); /* Draw polygon 0-1-4-5 */ fprintf(out_file,"%d %d Mt ", (int) canvas_bond_points[0].x, (int) canvas_bond_points[0].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[1].x, (int) canvas_bond_points[1].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[4].x, (int) canvas_bond_points[4].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[5].x, (int) canvas_bond_points[5].y); fprintf(out_file,"Draw\n"); fprintf(out_file,"%6.3f %6.3f %6.3f Sc\n", (double)atoms[sj].red/65536.0, (double)atoms[sj].green/65536.0, (double)atoms[sj].blue/65536.0); /* Draw polygon 2-1-4-3 */ fprintf(out_file,"%d %d Mt ", (int) canvas_bond_points[2].x, (int) canvas_bond_points[2].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[1].x, (int) canvas_bond_points[1].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[4].x, (int) canvas_bond_points[4].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[3].x, (int) canvas_bond_points[3].y); fprintf(out_file,"Draw\n"); }else{ /* Draw polygon 0-2-3-5 */ fprintf(out_file,"%d %d Mt ", (int) canvas_bond_points[0].x, (int) canvas_bond_points[0].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[2].x, (int) canvas_bond_points[2].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[3].x, (int) canvas_bond_points[3].y); fprintf(out_file,"%d %d Lt ", (int) canvas_bond_points[5].x, (int) canvas_bond_points[5].y); fprintf(out_file,"Draw\n"); } } } } ptr = ptr->next; } } if((any_hydrogen == 1) && (hbond_flag == 1)) { /* ... if there are any */ ptr = hbond_adjacency_list[si]; while(ptr != NULL) { sj = (ptr->v); if( (depth_is_on == 0) || (((depth-atoms[si].z>Z_TOL)) && (depth-atoms[sj].z>Z_TOL))) { if(atoms[si].visi && atoms[sj].visi) { if(atoms[si].z<=atoms[sj].z) { double x, y; update_canvas_hbond_points(si, sj, 1); /* Don't print if dashlength is zero */ x = canvas_hbond_points[0].x - canvas_hbond_points[1].x; y = canvas_hbond_points[0].y - canvas_hbond_points[1].y; hbond_length = sqrt ((x * x) + (y * y)); dash_length = (int) (hbond_length / (2 * get_no_dashes() - 1)); if(dash_length > 0) { /* Draw line 0-1 */ fprintf(out_file,"%d %d Mt ", (int) canvas_hbond_points[0].x, (int) canvas_hbond_points[0].y); fprintf(out_file,"%d %d Lt ", (int) canvas_hbond_points[1].x, (int) canvas_hbond_points[1].y); fprintf(out_file, "%d setlinewidth\n", (int) get_h_bond_width(si, sj)); fprintf(out_file,"[%d %d] 0 setdash St [1 0] 0 setdash 1 setlinewidth\n", dash_length, dash_length); } } } } ptr = ptr->next; } } if(at_nos_flag && atoms[si].visi) { fprintf(out_file, "%d %d Mt ", (int) canvas_coord[0], (int) canvas_coord[1]); fprintf(out_file, "(%d) Sn\n", si + 1); } if(at_sym_flag && atoms[si].visi) { fprintf(out_file, "%d %d Mt ", (int) canvas_coord[0], (int) canvas_coord[1]); fprintf(out_file, "(%s) Sn\n", atoms[si].label); } } if(axes_flag){ fprintf(out_file,"%d %d Mt ",400,(canvas_width-50)); fprintf(out_file,"%d %d Lt St\n", (int)(400+global_matrix[0][0]*30), (int)(canvas_width-(50-global_matrix[0][1]*30))); fprintf(out_file,"%d %d Mt (X) Sn\n", (int)(400+global_matrix[0][0]*40), (int)(canvas_width-(50-global_matrix[0][1]*40))); fprintf(out_file,"%d %d Mt ",400,(canvas_width-50)); fprintf(out_file,"%d %d Lt St\n", (int)(400+global_matrix[1][0]*30), (int)(canvas_width-(50-global_matrix[1][1]*30))); fprintf(out_file,"%d %d Mt (Y) Sn\n", (int)(400+global_matrix[1][0]*40), (int)(canvas_width-(50-global_matrix[1][1]*40))); fprintf(out_file,"%d %d Mt ",400,(canvas_width-50)); fprintf(out_file,"%d %d Lt St\n", (int)(400+global_matrix[2][0]*30), (int)(canvas_width-(50-global_matrix[2][1]*30))); fprintf(out_file,"%d %d Mt(Z) Sn\n", (int)(400+global_matrix[2][0]*40), (int)(canvas_width-(50-global_matrix[2][1]*40))); } fprintf(out_file,"showpage\n"); fclose(out_file); if(is_colour == 1) { sprintf(string, "File %s written: EPS (colour)", gnu_basename(file_name)); } else { sprintf(string, "File %s written: EPS (b/w)", gnu_basename(file_name)); } echo_to_message_area(string); } void write_aux (char *file_name) { int frame_number = 1; struct frame *this_frame; FILE *aux_file; aux_file = fopen (file_name, "w"); if (aux_file == NULL) { echo_to_message_area ("xmakemol: cannot write aux file"); return; } this_frame = get_first_frame (); while (this_frame != NULL) { fprintf (aux_file, "# Frame %d\n", frame_number); fprintf (aux_file, "depth = %d\n", this_frame->perspective_depth); fprintf (aux_file, "scale = %d\n", this_frame->perspective_scale); this_frame = this_frame->next; frame_number++; } if (fclose (aux_file) != 0) { echo_to_message_area ("xmakemol: error closing aux file"); } } void read_aux (char *file_name) { int frame_number, value; char *xyz_str = ".xyz", *sub_string, buf[BUFSIZ], prop[32], aux_file_name[1024]; struct frame *this_frame = NULL; FILE *aux_file; aux_file_exists_p = True; aux_file_error_p = False; /* If the file name extension is .xyz, look for aux file with extension .aux; otherwise, just append .aux */ strcpy (aux_file_name, file_name); sub_string = strstr (aux_file_name, xyz_str); if (sub_string != NULL) { strcpy (sub_string, ".aux"); } else { strcat (aux_file_name, ".aux"); } aux_file = fopen (aux_file_name, "r"); if (aux_file == NULL) { aux_file_exists_p = False; return; } /* Read the information */ while (1) { if (feof (aux_file)) break; fgets (buf, sizeof (buf), aux_file); if (sscanf (buf, "# Frame %d", &frame_number)) { if (this_frame == NULL) { this_frame = get_first_frame (); } else { this_frame = this_frame->next; } if (this_frame == NULL) { fprintf (stderr, "xmakemol: frame pointer is null in read_aux\n"); exit (2); } } else if (sscanf (buf, "%s = %d", prop, &value)) { if ((frame_number == 0) || (frame_number > no_frames)) { aux_file_exists_p = False; fprintf (stderr, "xmakemol: error detected in aux file\n"); aux_file_error_p = True; return; } if (strcmp (prop, "depth") == 0) { this_frame->perspective_depth = value; } else if (strcmp (prop, "scale") == 0) { this_frame->perspective_scale = value; } else { fprintf (stderr, "xmakemol: unrecognized property in aux file\n"); aux_file_error_p = True; } } } } /* Save the pixmap `canvas_pm' to a named file. The function returns false for failure and true for success. */ #ifdef XPM int write_xpm(char *file_name, int quiet) { int retcode, ok ; char string[1024]; XpmAttributes xpm_attrib; Colormap cmap; /* Allocate colormap suitable for the canvas. Note that the use of `DefaultColormap()' is known to succeed only because we have not been picky about the visual class being used. This has to be fixed if we start using TrueColor visuals someday. */ #ifdef GL cmap = XCreateColormap(display, XtWindow(canvas), visinfo->visual, AllocNone); #else /* GL */ cmap = DefaultColormap(display,screen_num); #endif /* GL */ /* Give visual, depth and colormap to the libXpm so that it does not ask them directly from the X11. Write of an XPM file will fail at least on Octane2 if the colormap is not specified here. (Octane2 is capable of having varying types of visual on a single screen so I guess the libXpm fails to query out the correct colors for the pixmap.) */ xpm_attrib.valuemask = XpmDepth | XpmVisual | XpmColormap; #ifdef GL xpm_attrib.depth = visinfo->depth; xpm_attrib.visual = visinfo->visual; #else /* X11 */ xpm_attrib.depth = screen_depth; xpm_attrib.visual = DefaultVisual (display, screen_num); /* Correct? */ #endif /* X11 */ xpm_attrib.colormap = cmap; /* Write file while dealing with possible errors. */ retcode = XpmWriteFileFromPixmap (display, gnu_basename (file_name), canvas_pm, 0, &xpm_attrib); if (retcode == XpmSuccess) { if (!quiet) { sprintf(string, "File %s written: XPM", gnu_basename(file_name)); echo_to_message_area(string); } ok = /*success*/1; } else if (retcode == XpmOpenFailed) { sprintf (string, "Cannot open %s for write", gnu_basename (file_name)); echo_to_message_area(string); ok = /*failure*/0; } else { sprintf(string, "Error %d: cannot write XPM file", retcode); echo_to_message_area(string); ok = /*failure*/0; } #ifdef GL XFreeColormap(display, cmap); #endif return ok; } #endif #ifdef GL void write_gl2ps (char *filename, GLint type) { FILE *fp = fopen (filename, "w"); void gl_render (void); GLint buffsize = 0, state = GL2PS_OVERFLOW; GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); while (state == GL2PS_OVERFLOW) { buffsize += 1024*1024; gl2psBeginPage ( "Title", "XMakemol", viewport, type, GL2PS_BSP_SORT, GL2PS_DRAW_BACKGROUND | GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT | GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT, GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, NULL ); gl_render (); state = gl2psEndPage(); } fclose (fp); } #endif /* Minimum H-bond length allowed: should make this customizable */ #define MIN_HBOND_LENGTH2 (1.2 * 1.2) void update_bond_matrix(Boolean force_update) { void free_bond_adjacency_list(void); void set_no_bonds (int); void set_no_hbonds (int); void update_lengths_dialog(Boolean); struct node *new_ptr; int i, j, no_bonds = 0, no_hbonds = 0; static int last_frame_no=0; double atom_sep2; static double last_bdfd_factor=0.0; static double last_hbdfd_factor=0.0; static double last_ibdfd_factor=0.0; static double last_ihbdfd_factor=0.0; /* We may not actually have to do the update. If the frame number has not changed and the bdfd_factor/hbdfd_factor are the same then we are wasting our time. These checks can be overridden if force_update is True */ if((force_update == False) && /* We might not need to update - check other things */ (frame_no == last_frame_no) && (last_bdfd_factor == bdfd_factor) && (last_hbdfd_factor == hbdfd_factor) && (last_ibdfd_factor == ibdfd_factor) && (last_ihbdfd_factor == ihbdfd_factor)) { return; /* We can return */ } if(bond_adjacency_list) { free_bond_adjacency_list(); } bond_adjacency_list = (struct node **)malloc(no_atoms*sizeof(struct node *)); hbond_adjacency_list = (struct node **)malloc(no_atoms*sizeof(struct node *)); /* Keep a track of this for freeing purposes */ bond_adjacency_lists_allocated_size = no_atoms; for( i = 0; i < no_atoms; i++ ) { bond_adjacency_list[i] = NULL; hbond_adjacency_list[i] = NULL; } /* Assign the bonds */ for(i=0;iv=i; new_ptr->next = bond_adjacency_list[j]; bond_adjacency_list[j]=new_ptr; /* and i is joined to j */ new_ptr = (struct node *)malloc(sizeof(struct node)); new_ptr->v=j; new_ptr->next = bond_adjacency_list[i]; bond_adjacency_list[i]=new_ptr; } } } /* Assign the H-bonds */ /* There is no point doing this if there are no H atoms */ if(any_hydrogen == 1) { for(i = 0; i < no_atoms - 1 ; i++) { for(j = i + 1; j < no_atoms; j++) { /* Test if _one_ of the atoms is hydrogen */ if((( atoms[i].is_hydrogen) && (!atoms[j].is_hydrogen)) || ((!atoms[i].is_hydrogen) && ( atoms[j].is_hydrogen))) { double bond_test, hbond_test; double x, y, z; x = atoms[i].x - atoms[j].x; y = atoms[i].y - atoms[j].y; z = atoms[i].z - atoms[j].z; atom_sep2 = (x * x) + (y * y) + (z * z); if (atoms[i].molecule == atoms[j].molecule) { /* Intramolecular tolerance */ bond_test = ibdfd_factor * BOND * (atoms[i].cov_rad + atoms[j].cov_rad); hbond_test = ihbdfd_factor * HBOND; } else { bond_test = bdfd_factor * BOND * (atoms[i].cov_rad + atoms[j].cov_rad); hbond_test = hbdfd_factor * HBOND; } hbond_test = hbond_test * hbond_test; bond_test = bond_test * bond_test; if( /* distance smaller than H-bond tolerance */ (atom_sep2 < hbond_test) && /* distance greater than fixed minimum distance */ (atom_sep2 > MIN_HBOND_LENGTH2) && /* distance larger than bond tolerance */ (atom_sep2 > bond_test)) { /* There is an H-bond */ no_hbonds++; /* So j is joined to i */ new_ptr = (struct node *)malloc(sizeof(struct node)); new_ptr->v=i; new_ptr->next = hbond_adjacency_list[j]; hbond_adjacency_list[j]=new_ptr; /* and i is joined to j */ new_ptr = (struct node *)malloc(sizeof(struct node)); new_ptr->v=j; new_ptr->next = hbond_adjacency_list[i]; hbond_adjacency_list[i]=new_ptr; } } } } } update_lengths_dialog(True); /* Update values so that we know what their values _were_ next time we call this function */ last_frame_no = frame_no; last_bdfd_factor = bdfd_factor; last_hbdfd_factor = hbdfd_factor; last_ibdfd_factor = ibdfd_factor; last_ihbdfd_factor = ihbdfd_factor; set_no_bonds (no_bonds); set_no_hbonds (no_hbonds); } void update_some_dialogs(void) { void edit_posn_cancel_cb(Widget, XtPointer, XtPointer); void edit_visi_cancel_cb(Widget, XtPointer, XtPointer); void edit_elements_discard_cb(Widget, XtPointer, XtPointer); void make_edit_posn_dialog(Widget); void make_edit_visi_dialog(Widget); void make_edit_element_props_dialog(Widget);/* aro */ void reset_pers_scales(void); /* Don't need to destroy this widget */ if(pers_dialog){ reset_pers_scales(); } if(edit_visi_dialog){ edit_visi_cancel_cb(edit_visi_dialog, NULL, NULL); make_edit_visi_dialog(main_w); } if(edit_posn_dialog){ edit_posn_cancel_cb(edit_posn_dialog, NULL, NULL); make_edit_posn_dialog(main_w); } /* edit_element_props_dialog and p_dialog should also be reset if file is loaded while it's open */ if(edit_element_props_dialog){ if(XtIsManaged(edit_element_props_dialog)){ make_edit_element_props_dialog(main_w); } } if(p_dialog){ if(XtIsManaged(p_dialog)){ /* we want to go through the p_dialog creation routine to update p_dialog, so we pass 3 as client_data to file_cb */ file_cb(NULL, (XtPointer) 3, NULL); } } } void read_elements_file(void) { void make_label_uppercase(char *); void set_smallest_cov_rad(double); int i; char line[1024],label[4],color[1024],*line_ptr; char *elem_file_name; double mass, cov_rad, vdw_rad; double smallest_cov_rad = -1; FILE *elem_file = NULL; if(!element){ element=malloc(MAX_ELEMENTS*sizeof(struct elements)); /* Check to see if XM_ELEMENTS is set */ elem_file_name = getenv ("XM_ELEMENTS"); if (elem_file_name) { /* If this is a directory, append `/elements' and try to open the resultant file */ if (opendir (elem_file_name)) { elem_file_name = strcat (elem_file_name, "/elements"); elem_file = fopen (elem_file_name, "r"); } else { elem_file = fopen (elem_file_name, "r"); } } /* If still not found, try the default location */ if (! elem_file) { elem_file = fopen (ELEMENTS, "r"); } /* Last, try the current working directory */ if (! elem_file) { elem_file = fopen ("elements", "r"); } if (! elem_file) { fprintf (stderr, "xmakemol: cannot find elements file\n"); exit (2); } largest_cov_rad=0.0; no_elements = 0; element:while(1) { line_ptr = fgets(line, sizeof(line), elem_file); if(line_ptr == NULL) { break; } if (line[0] == '!') { /* This is a comment -- ignore */ goto element; } if(no_elements >= MAX_ELEMENTS) { no_elements--; /* We can't allocate for this one */ fprintf(stderr, "xmakemol: number of elements in %s exceeds MAX_ELEMENTS (file.c)\n", elem_file_name); break; } /* i is junk - we don't trust the writer of elements ... */ sscanf(line, "%d %s %lf %s %lf %lf", &i, label, &mass ,color, &cov_rad, &vdw_rad); i = no_elements; strcpy(element[i].label, label); make_label_uppercase(element[i].label); element[i].mass = mass; strcpy(element[i].color, color); element[i].cov_rad = cov_rad; element[i].vdw_rad = vdw_rad; element[i].color_allocated = 0; element[i].customized = 0; /* aro */ if(cov_rad > largest_cov_rad) { largest_cov_rad=cov_rad; } if(smallest_cov_rad > 0.0) { if(cov_rad < smallest_cov_rad) { smallest_cov_rad = cov_rad; } } else { smallest_cov_rad = cov_rad; } no_elements++; } set_smallest_cov_rad(smallest_cov_rad); } } /* aro--> */ void read_user_elements_file (void) { /* Read in the file .xmakemol.elements from /home// */ double get_smallest_cov_rad(); void make_label_uppercase(char *); void set_smallest_cov_rad(double); double smallest_cov_rad = get_smallest_cov_rad(); int i; char line[1024],label[4],color[1024]; char *user_elements_file_name, *line_ptr; double mass, cov_rad, vdw_rad; FILE *user_elements_file; /* check to see if .xmakemol.elements file exists in user's home directory */ strcpy(line, getenv("HOME")); /* line used as temp variable here */ user_elements_file_name = strcat(line, "/.xmakemol.elements"); user_elements_file = fopen(user_elements_file_name, "r"); if(user_elements_file != NULL) { line_ptr = fgets(line, sizeof(line), user_elements_file); while(line_ptr != NULL) { sscanf(line, "%s %lf %s %lf %lf", label, &mass, color, &cov_rad, &vdw_rad); make_label_uppercase(label); for(i = 0; strcmp(element[i].label, label); i++) ;/* do nothing, for loop will set correct index */ /* We don't copy label or mass information because those should be unchanged from default element properties */ strcpy(element[i].color, color); element[i].cov_rad = cov_rad; element[i].vdw_rad = vdw_rad; element[i].color_allocated = 0; element[i].customized = 1; if(cov_rad > largest_cov_rad) { largest_cov_rad=cov_rad; } if(smallest_cov_rad > 0.0) { if(cov_rad < smallest_cov_rad) smallest_cov_rad = cov_rad; } else { smallest_cov_rad = cov_rad; } line_ptr = fgets(line, sizeof(line), user_elements_file); } set_smallest_cov_rad(smallest_cov_rad); fclose(user_elements_file); } } /* <--aro */ void malloc_failed(char *string) { fprintf (stderr, "xmakemol: malloc failed in %s\n", string); exit (1); } void make_label_uppercase(char *label) { int i; /* Check if a lowercase letter */ for (i = 0; i < strlen (label); i++) { if ((label[i] >= 'a') && (label[i] <= 'z')) { label[i] -= ('a' - 'A'); } } } void free_bond_adjacency_list(void) { int i; if(bond_adjacency_list != NULL) { for ( i = 0; i < bond_adjacency_lists_allocated_size; i++ ) { struct node *this_ptr, *next_ptr; this_ptr = bond_adjacency_list[i]; while(this_ptr != NULL) { next_ptr = this_ptr->next; free((struct node *)this_ptr); this_ptr = next_ptr; } } free(bond_adjacency_list); bond_adjacency_list=NULL; } if(hbond_adjacency_list != NULL) { for ( i = 0; i < bond_adjacency_lists_allocated_size; i++ ) { struct node *this_ptr, *next_ptr; this_ptr = hbond_adjacency_list[i]; while(this_ptr != NULL) { next_ptr = this_ptr->next; free((struct node *)this_ptr); this_ptr = next_ptr; } } free(hbond_adjacency_list); hbond_adjacency_list=NULL; } } int get_no_elements(void) { return(no_elements); } /* The pointer to the selected frame, available through get_selected_frame () */ static struct frame *selected_frame, *previous_frame; struct frame * update_frame_pointer (int frame_index) { int i; /* Store the previously selected frame */ previous_frame = selected_frame; /* printf ("previous_frame = 0x%x\n", previous_frame); */ /* Find the frame pointer for the frame with index frame_index */ selected_frame = get_first_frame (); for (i = 0; i < frame_index; i++) { selected_frame = selected_frame->next; if (selected_frame == NULL) { fprintf (stderr, "xmakemol: internal error (update_frame_pointer)\n"); /* exit (1); */ } } return (selected_frame); } struct frame * get_selected_frame (void) { return (selected_frame); } void set_selected_frame (struct frame *new_frame) { selected_frame = new_frame; } struct frame * get_first_frame (void) { return (first_frame); } struct frame * get_previous_frame (void) { return (previous_frame); } void frame_content_to_atoms (int frame_no) { void assign_atom_types (void); int crystal_p (void); void get_atom_data (struct frame *, Colormap, int, double, double, double); int * get_crystal_images (void); void set_canvas_scale (double); void set_z_depth (double); struct frame * update_frame_pointer (int); int i, selections_viable; int *images = NULL; static int last_no_atoms = 0; struct frame *this_frame; Colormap cmap; /* Get pointer to the current frame */ this_frame = update_frame_pointer (frame_no); if (crystal_p ()) { images = get_crystal_images (); no_atoms = this_frame->no_atoms * images[0] * images[1] * images[2]; } else { no_atoms = this_frame->no_atoms; } /* aro - use colormap specific to canvas and visual, default colormap may give inaccurate colors on some displays */ #ifdef GL cmap = XCreateColormap(display, XtWindow(canvas), visinfo->visual, AllocNone); #else /* GL */ cmap = DefaultColormap(display,screen_num); #endif /* GL */ /* Allocate memory */ if (atoms == NULL) { atoms = (struct atoms *) malloc (no_atoms * sizeof (struct atoms)); sorted_atoms = (int *) malloc (no_atoms * sizeof (int)); } else if (last_no_atoms != no_atoms) { free ((struct atoms *) atoms); atoms = (struct atoms *) malloc (no_atoms * sizeof (struct atoms)); free ((int *) sorted_atoms); sorted_atoms = (int *) malloc (no_atoms * sizeof (int)); } last_no_atoms = no_atoms; if (crystal_p ()) { double * get_crystal_vector (void); int p, q, r; int offset = 0; double *cv; cv = get_crystal_vector (); for (p = 0; p < images[0]; p++) { for (q = 0; q < images[1]; q++) { for (r = 0; r < images[2]; r++) { double x, y, z; x = (p * cv[0]) + (q * cv[3]) + (r * cv[6]); y = (p * cv[1]) + (q * cv[4]) + (r * cv[7]); z = (p * cv[2]) + (q * cv[5]) + (r * cv[8]); get_atom_data (this_frame, cmap, offset, x, y, z); offset += this_frame->no_atoms; } } } } else { get_atom_data (this_frame, cmap, 0, 0.0, 0.0, 0.0); } assign_atom_types (); /* Bounding box */ if (this_frame->bbox_available) { bbox_available = True; file_bbox.x_min = this_frame->bbox[0][0]; file_bbox.x_max = this_frame->bbox[0][1]; file_bbox.y_min = this_frame->bbox[1][0]; file_bbox.y_max = this_frame->bbox[1][1]; file_bbox.z_min = this_frame->bbox[2][0]; file_bbox.z_max = this_frame->bbox[2][1]; /* Setup bounding box vectors */ file_bbox.v[0][0] = file_bbox.x_max; file_bbox.v[0][1] = file_bbox.y_min; file_bbox.v[0][2] = file_bbox.z_max; file_bbox.v[1][0] = file_bbox.x_max; file_bbox.v[1][1] = file_bbox.y_max; file_bbox.v[1][2] = file_bbox.z_max; file_bbox.v[2][0] = file_bbox.x_max; file_bbox.v[2][1] = file_bbox.y_min; file_bbox.v[2][2] = file_bbox.z_min; file_bbox.v[3][0] = file_bbox.x_max; file_bbox.v[3][1] = file_bbox.y_max; file_bbox.v[3][2] = file_bbox.z_min; file_bbox.v[4][0] = file_bbox.x_min; file_bbox.v[4][1] = file_bbox.y_min; file_bbox.v[4][2] = file_bbox.z_max; file_bbox.v[5][0] = file_bbox.x_min; file_bbox.v[5][1] = file_bbox.y_max; file_bbox.v[5][2] = file_bbox.z_max; file_bbox.v[6][0] = file_bbox.x_min; file_bbox.v[6][1] = file_bbox.y_min; file_bbox.v[6][2] = file_bbox.z_min; file_bbox.v[7][0] = file_bbox.x_min; file_bbox.v[7][1] = file_bbox.y_max; file_bbox.v[7][2] = file_bbox.z_min; for (i = 0; i < 8; i++) { file_bbox.v[i][0] += global_vector[0]; file_bbox.v[i][1] += global_vector[1]; file_bbox.v[i][2] += global_vector[2]; } } else { bbox_available = False; } /* Check to see if selections are viable */ for (i = 0; i < no_atoms; i++) { atoms[i].sel = 0; } selections_viable = 1; for (i = 0; i < 4; i++) { if (selected[i] >= no_atoms) { selections_viable = 0; } } if (selections_viable == 1) { for (i = 0; i < 4; i++) { if (selected[i] != -1) { atoms[selected[i]].sel = 1; } } } else { for (i = 0; i < 4; i++) { selected[i] = -1; } } /* Set up scale and depth */ { void reset_pers_scales (void); int scale, depth; if ((this_frame->perspective_scale) && (this_frame->perspective_depth)) { scale = this_frame->perspective_scale; scale = pow (2.0, scale / 100.0) - 1; set_canvas_scale (scale); depth = this_frame->perspective_depth; set_z_depth (depth); reset_pers_scales (); } } #ifdef GL XFreeColormap(display, cmap); #endif /* GL */ } void get_atom_data (struct frame *this_frame, Colormap cmap, int offset, double x, double y, double z) { int i, j; int io, index; XColor xcolor; for (i = 0; i < this_frame->no_atoms; i++) { io = i + offset; sorted_atoms[io] = io; /* The atom coordinates */ atoms[io].x = this_frame->atom[i].x + global_vector[0] + x; atoms[io].y = this_frame->atom[i].y + global_vector[1] + y; atoms[io].z = this_frame->atom[i].z + global_vector[2] + z; /* The atom vectors */ atoms[io].has_vector = this_frame->atom[i].has_vector; for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if (atoms[io].has_vector > j) { atoms[io].v[j][0] = this_frame->atom[i].vx[j]; atoms[io].v[j][1] = this_frame->atom[i].vy[j]; atoms[io].v[j][2] = this_frame->atom[i].vz[j]; } else { atoms[io].v[j][0] = 0; atoms[io].v[j][1] = 0; atoms[io].v[j][2] = 0; } } /* Ellipse properties */ atoms[io].is_ellipse = this_frame->atom[i].is_ellipse; if (atoms[io].is_ellipse == 1) { double max_shape = 0.0; for (j = 0; j < 3; j++) { atoms[io].euler[j] = this_frame->atom[i].euler[j]; atoms[io].shape[j] = this_frame->atom[i].shape[j]; /* Keep track of max scaling for GL clipping purposes */ if (atoms[io].shape[j] > max_shape) { max_shape = atoms[io].shape[j]; } } atoms[io].max_shape = max_shape; } else { atoms[io].max_shape = 1.0; } atoms[io].visi = this_frame->atom[i].visi; /* properties for which we need the index of the element */ strcpy (atoms[io].label, this_frame->atom[i].label); strcpy (atoms[io].uppercase_label, this_frame->atom[i].label); make_label_uppercase (atoms[io].uppercase_label); index = get_element_index_for_type (atoms[io].uppercase_label); /* Set label for dummy atoms */ if (index == 0) { strcpy (atoms[io].label, "DU"); strcpy (atoms[io].uppercase_label, "DU"); } atoms[io].cov_rad = element[index].cov_rad; if (element[index].vdw_rad != 0) { atoms[io].vdw_rad = element[index].vdw_rad; } else { atoms[io].vdw_rad = atoms[io].cov_rad; } atoms[io].mass = element[index].mass; if (this_frame->atom[i].has_rgb) { xcolor.red = 65535 * this_frame->atom[i].red; xcolor.green = 65535 * this_frame->atom[i].green; xcolor.blue = 65535 * this_frame->atom[i].blue; XAllocColor(display, cmap, &xcolor); } else if (this_frame->atom[i].has_color_name) { XParseColor(display, cmap, this_frame->atom[i].color_name, &xcolor); if (XAllocColor(display,cmap,&xcolor) == 0) { fprintf (stderr, "xmakemol: cannot allocate colour %20s\n", this_frame->atom[i].color_name); /* Allocate the atom as white instead */ XParseColor(display, cmap, "white", &xcolor); XAllocColor(display, cmap, &xcolor); } } else if (element[index].color_allocated == 0) { XParseColor(display, cmap, element[index].color, &xcolor); if (XAllocColor(display,cmap,&xcolor) == 0) { fprintf (stderr, "xmakemol: cannot allocate colour %20s\n", element[index].color); /* Allocate the atom as white instead */ XParseColor(display, cmap, "white", &xcolor); XAllocColor(display, cmap, &xcolor); } element[index].color_allocated = 1; element[index].pixel = xcolor.pixel; element[index].red = xcolor.red; element[index].green = xcolor.green; element[index].blue = xcolor.blue; } else { xcolor.pixel = element[index].pixel; xcolor.red = element[index].red; xcolor.green = element[index].green; xcolor.blue = element[index].blue; } atoms[io].pixel = xcolor.pixel; atoms[io].red = xcolor.red; atoms[io].green = xcolor.green; atoms[io].blue = xcolor.blue; /* Always reset edit status when changing atom contents */ atoms[io].edit = 1; if (strcmp (atoms[io].uppercase_label, "H") == 0) { atoms[io].is_hydrogen = 1; any_hydrogen = 1; } else { atoms[io].is_hydrogen = 0; } /* Render type */ atoms[io].gl_render_type = this_frame->atom[i].gl_render_type; /* Molecule index */ atoms[io].molecule = this_frame->atom[i].molecule; } } int count_visible_atoms_in_frame (struct frame *this_frame) { int i, count; count = 0; for (i = 0; i < this_frame->no_atoms; i++) { if (this_frame->atom[i].visi == 1) { count++; } } return (count); } void check_frame_sizes (void) { void set_all_frames_same_size (int); struct frame* this_frame; int mismatch = 0, last_no_atoms; this_frame = get_first_frame (); last_no_atoms = this_frame->no_atoms; while (1) { this_frame = this_frame->next; if (this_frame == NULL) break; if (this_frame->no_atoms != last_no_atoms) { mismatch = 1; set_all_frames_same_size (0); break; } } if (mismatch == 0) { set_all_frames_same_size (1); } } /* Keep track of whether all frames have the same number of atoms */ static int all_frames_same_size = 0; void set_all_frames_same_size (int arg) { all_frames_same_size = arg; } int get_all_frames_same_size (void) { return (all_frames_same_size); } void set_current_directory (XmString dir) { char *s; /* Free the old working directory */ if (current_directory != NULL) { XmStringFree (current_directory); } /* Save the current working directory */ current_directory = XmStringCopy (dir); /* Change to the current working directory so that files being created without explicit directory reference end up to the current directory */ if (XmStringGetLtoR (dir, XmFONTLIST_DEFAULT_TAG, &s)) { chdir (s); XtFree (s); } } XmString get_current_directory (void) { if (current_directory == NULL) { /* Make current directory when no file selection dialog has been opened */ current_directory = XmStringCreateLocalized ("."); } return current_directory; } int *saved_depth, *saved_scale; void save_perspective_data (void) { int i; struct frame *this_frame; saved_depth = malloc (no_frames * sizeof (int)); saved_scale = malloc (no_frames * sizeof (int)); if ((saved_depth == NULL) || (saved_scale == NULL)) { malloc_failed ("saved_depth or saved_scale"); } this_frame = first_frame; i = 0; while (this_frame) { saved_depth[i] = this_frame->perspective_depth; saved_scale[i] = this_frame->perspective_scale; this_frame = this_frame->next; i++; } } void load_perspective_data (void) { int i; struct frame *this_frame; this_frame = first_frame; i = 0; while (this_frame) { this_frame->perspective_depth = saved_depth[i]; this_frame->perspective_scale = saved_scale[i]; this_frame = this_frame->next; i++; } free (saved_depth); free (saved_scale); } xmakemol-5.16/frames.c0000644000175000017500000004775510664010175011646 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* #include */ char * gnu_basename (char *); #include #include #include #include #include #include #include #include #include #include #ifdef XPM #include #endif #include "draw.h" #include "globals.h" void echo_to_message_area(char *); void clear_message_area (void); void place_dialog_cb (Widget, XtPointer, XtPointer); #ifdef HAVE_USLEEP static int frame_speed = 1; #endif static int stop_anim; #ifdef XPM static Widget save_anim_dialog = NULL; #endif static Widget label_w,stop_b; #ifdef HAVE_USLEEP static Widget speed_scale_w, scale_scroll_bar; #endif void make_frame_dlg(Widget parent) { void bounce_cb(Widget, XtPointer, XtPointer); void centre_b_cb(Widget, XtPointer, XtPointer); void frame_dlg_cancel_cb(Widget, XtPointer, XtPointer); void frame_no_cb(Widget, XtPointer, XtPointer); #ifdef HAVE_USLEEP void frame_speed_cb(Widget, XtPointer, XtPointer); #endif void next_frame_cb(Widget, XtPointer, XtPointer); void prev_frame_cb(Widget, XtPointer, XtPointer); void rewind_cb(Widget, XtPointer, XtPointer); void start_anim_cb(Widget, XtPointer, XtPointer); void stop_anim_cb(Widget, XtPointer, XtPointer); void update_frame_label(void); #ifdef XPM void make_anim_cb(Widget, XtPointer, XtPointer); #endif int n=0; #ifdef XPM Widget make_anim_b; #endif Widget rc_ver,rc_hor,start_b,next_b,prev_b,bounce_b,rewind_b; Widget centre_b, child; #ifdef HAVE_USLEEP int s, t, nkids; Arg tmpargs[2]; Widget *kids; #endif XmString label = ""; if (! frames_dialog) { label = XmStringCreateLocalized ("Frames"); XtSetArg (args[n], XmNautoUnmanage, False); n++; XtSetArg (args[n], XmNdialogTitle, label); n++; frames_dialog = (Widget) XmCreateMessageDialog (parent, "frames", args, n); rc_ver = XtVaCreateManagedWidget ("rc_ver",xmRowColumnWidgetClass,frames_dialog, NULL); label_w=XtVaCreateManagedWidget ("Comment", xmLabelWidgetClass, rc_ver, XmNlabelString, label, XmNwidth, 400, NULL); update_frame_label(); rc_hor = XtVaCreateManagedWidget ("rc_hor",xmRowColumnWidgetClass,rc_ver, XmNorientation, XmHORIZONTAL, NULL); start_b = XtVaCreateManagedWidget ("Start",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(start_b, XmNactivateCallback, start_anim_cb, NULL); stop_b = XtVaCreateManagedWidget ("Stop",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(stop_b, XmNactivateCallback, stop_anim_cb, NULL); next_b = XtVaCreateManagedWidget ("Next (>)",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(next_b, XmNactivateCallback, next_frame_cb, NULL); prev_b = XtVaCreateManagedWidget ("Previous (<)",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(prev_b, XmNactivateCallback, prev_frame_cb, NULL); rewind_b = XtVaCreateManagedWidget ("Rewind (^)",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(rewind_b, XmNactivateCallback, rewind_cb, NULL); bounce_b = XtVaCreateManagedWidget ("Bounce",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(bounce_b, XmNactivateCallback, bounce_cb, NULL); #ifdef XPM make_anim_b = XtVaCreateManagedWidget ("Make anim",xmPushButtonWidgetClass,rc_hor, NULL); XtAddCallback(make_anim_b, XmNactivateCallback, make_anim_cb, NULL); #endif #ifdef HAVE_USLEEP label=XmStringCreateLocalized("Select speed"); speed_scale_w = XtVaCreateManagedWidget ("Speed",xmScaleWidgetClass, rc_ver, XmNmaximum, 20, XmNminimum, 1, XmNvalue, (int) (20-frame_speed+1), XmNshowValue, True, XmNorientation, XmHORIZONTAL, XmNtitleString, label, NULL); /* need to access scale bar widget for callbacks */ s=0; XtSetArg(tmpargs[s], XmNnumChildren, &nkids); s++; XtSetArg(tmpargs[s], XmNchildren, &kids); s++; XtGetValues(speed_scale_w, tmpargs, s); for(t=0;t (no_frames - 1))) { echo_to_message_area("Choice of frame out of bounds!"); return; } /* if OK, change frame_no */ frame_no = temp_frame; sprintf(string,"Frame %d selected",frame_no+1); echo_to_message_area(string); if(centre_each_frame){ /* Change frame, reset title _and_ centre the frame */ change_frame(frame_no, True, True); }else{ /* Change frame, reset title, _don't_ centre the frame */ change_frame(frame_no, True, False); } } void start_anim_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void change_frame(int, Boolean, Boolean); XEvent event; stop_anim=0; if(no_frames < 2){ return; } while(1){ /* infinite loop, stop with button press */ if(frame_novalue, XmFONTLIST_DEFAULT_TAG, &anim_file)) return; /* internal error */ /* Save directory shown in the dialog so that all the other file selection dialogs could be made to operate the very same directory */ set_current_directory (cbs->dir); } #ifdef GL set_gl_copy_canvas (1); #endif for(i = 0; i < no_frames; i++) { frame_no = i; XmUpdateDisplay(toplevel); /* handle all expose events during loop */ if(centre_each_frame) { /* Change frame, reset title _and_ centre the frame */ change_frame(frame_no, True, True); } else { /* Change frame, reset title, _don't_ centre the frame */ change_frame(frame_no, True, False); } sprintf(pixmap_file, "%s.%d.xpm", anim_file, (i + 1)); /* Write the `canvas_pm' to the file. */ if (write_xpm (pixmap_file, 1) == /*failure*/0) { /* Could not write the file. Flag the error so that we know not to overwrite the error message currently in the message area with our status message. */ success = /*failure*/ 0; } } #ifdef GL set_gl_copy_canvas (0); #endif if (success) { if(no_frames == 1) { sprintf(buf, "File %s.1.xpm written", gnu_basename(anim_file)); } else { sprintf(buf, "Files %s.1..%d.xpm written", gnu_basename(anim_file), no_frames); } echo_to_message_area(buf); } } #endif #ifdef HAVE_USLEEP void frame_speed_cb(Widget w, XtPointer client_data, XtPointer call_data) { XmScaleCallbackStruct *cbs= (XmScaleCallbackStruct *)call_data; frame_speed = 20-cbs->value+1; } #endif void centre_b_cb(Widget widget, XtPointer client_data, XtPointer call_data) { if(centre_each_frame==1){ centre_each_frame=0; echo_to_message_area("Not centering each frame"); }else{ centre_each_frame=1; echo_to_message_area("Centering each frame"); } } /* update_label is redundant - remove at some point from calls to change_frame */ void change_frame(int frame_no, Boolean update_label, Boolean centre_this_frame) { double get_angle_axis(double *); void canvas_cb(Widget, XtPointer, XtPointer); void centre_atoms(void); void make_label_uppercase (char *); void rotate_atoms(double *,double,Boolean,Boolean); void update_bbox(void); void update_bond_matrix(Boolean); void update_frame_label(void); void frame_content_to_atoms (int); int i,j; double angle,axis[3]; /* if no frames, return ... */ if(no_frames == 0) return; changing_frame = True; frame_content_to_atoms (frame_no); /* Centre frame if required, by modifying global_vector[] */ if(centre_this_frame){ centre_atoms(); } /* get angle-axis rotation from global_matrix positions... */ for(i=0;i<3;i++){ for(j=0;j<3;j++){ angle_axis_matrix[i][j]=global_matrix[i][j]; } } angle=get_angle_axis(axis); update_bbox(); update_bond_matrix (True); redraw=0; rotate_atoms(axis,angle,0,False); redraw=1; canvas_cb(canvas,NULL,NULL); update_frame_label(); changing_frame = False; } double get_angle_axis(double *axis) { int i,j; double angle,s,z,mod,r[3][3]; for(i=0;i<3;i++){ for(j=0;j<3;j++){ r[i][j]=angle_axis_matrix[i][j]; } } /* adapted from quater.f (ajs) */ z=r[0][0]+r[1][1]+r[2][2]+1; if(z>0){ angle=0.5*sqrt(z); }else{ angle=0; } if(angle > 0.0001){ axis[0]=0.25*(r[2][1]-r[1][2])/angle; axis[1]=0.25*(r[0][2]-r[2][0])/angle; axis[2]=0.25*(r[1][0]-r[0][1])/angle; }else{ s=1-r[0][0]-r[1][1]-r[2][2]; for(i=0;i<3;i++){ z=2*r[i][i]+s; if(z > 0){ axis[i]=0.5*sqrt(z); }else{ axis[i]=0; } } if(angle > 0){ if(r[1][0] < r[0][1]){axis[2]=-axis[2];} if(r[2][1] < r[1][2]){axis[0]=-axis[0];} if(r[0][2] < r[2][0]){axis[1]=-axis[1];} }else{ if(axis[0] > 0.5){ if(r[0][1]+r[1][0] < 0){axis[1]=-axis[1];} if(r[0][2]+r[2][0] < 0){axis[2]=-axis[2];} }else if(axis[1] > 0.5){ if(r[0][1]+r[1][0] < 0){axis[0]=-axis[0];} if(r[1][2]+r[2][1] < 0){axis[2]=-axis[2];} }else if(axis[2] > 0.5){ if(r[0][2]+r[2][0] < 0){axis[0]=-axis[0];} if(r[1][2]+r[2][1] < 0){axis[1]=-axis[1];} } } } angle=2*acos(angle); mod = (axis[0] * axis[0]) + (axis[1] * axis[1]) + (axis[2] * axis[2]); if(mod==0){ axis[2]=1; } return(angle); } void update_frame_label(void) { struct frame * get_selected_frame (int); char string[1024]; struct frame *this_frame; XmString xm_str; this_frame = get_selected_frame (frame_no); if(no_frames == 0) { sprintf(string, "No frames loaded"); } else if(strlen(this_frame->comment) == 0) { sprintf(string, "Frame %d (%d atoms); comment \"(empty)\".", frame_no + 1, this_frame->no_atoms); } else { sprintf(string, "Frame %d (%d atoms); comment \"%s\".", frame_no + 1, this_frame->no_atoms, this_frame->comment); } if(frames_dialog != NULL) { /* Set label in frames_dialog ... */ xm_str = XmStringCreateLocalized(string); XtVaSetValues (label_w, XmNlabelString, xm_str, NULL); XmStringFree(xm_str); clear_message_area (); } else { echo_to_message_area (string); } } void frame_key (Widget widget, XEvent *event, String *args, int *num_args) { void change_frame(int, Boolean, Boolean); if (*num_args != 1) { XtError ("Wrong number of args!"); } if (strcmp (args[0], "next") == 0) { if (frame_no == (no_frames - 1)) { frame_no = 0; } else { frame_no++; } } else if (strcmp (args[0], "prev") == 0) { if (frame_no == 0) { frame_no = no_frames - 1; } else { frame_no--; } } else if (strcmp (args[0], "start") == 0) { frame_no = 0; } /* Select the frame */ if (centre_each_frame) { change_frame(frame_no, True, True); } else { change_frame(frame_no, True, False); } } xmakemol-5.16/gl_funcs.c0000644000175000017500000011523310664010175012154 00000000000000/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __GL_FUNCS_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef GL #include #include #include #include #ifdef SGI_STEREO #include /* aro */ #endif /* SGI_STEREO */ #include "globals.h" #include "bbox.h" #include "bonds.h" #include "defs.h" #include "draw.h" #include "view.h" #include "gl_funcs.h" #include "gl2ps.h" /* Function prototypes */ double get_atom_scale (void); double get_bond_scale (void); double get_bond_width (void); double get_hbond_scale (void); double gl_get_rendered_atom_size (int); void gl_init (void); void gl_render_atoms (void); void gl_render_bbox (void); void gl_render_bbox_face (int, int, int, int); void gl_render_bbox_line (int, int); void gl_render_bonds (void); void gl_render_hbonds (void); void gl_render_vectors (void); void gl_set_perspective (void); double get_smallest_cov_rad (void); void gl_update_near_and_far (void); double mod_of_vec (double *); Boolean mouse_motion_p (void); void normalize_vec (double *); Boolean outline_mode_p (void); /* Variable declarations */ static int gl_copy_canvas = 0; static int gl_initialized = 0; static int gl_no_atom_segments = 12; static int gl_no_bond_segments = 8; static int gl_use_lighting = 0; static int gl_use_specular_lighting = 0; static int gl_sep = 30; /* aro */ static GLfloat gl_shininess[] = {64}; static double gl_eye = 10; /* per-system setting */ static double gl_fov = 50; static double gl_max_z, gl_min_z; static double gl_perspective_near = 0, gl_perspective_far = 0; static GLUquadricObj *gl_quadric = NULL; static enum gl_render_types gl_render_type = BALL_AND_STICK; static enum gl_render_types gl_current_render_type; void gl_render (void) { enum render_stereo_types get_gl_render_stereo(); void set_gl_render_stereo(enum render_stereo_types); void StereoProjection(float left, float right, float bottom, float top, float near, float far, float zero_plane, float dist, float eye, int side_by_side); double get_canvas_scale(void); double get_z_depth(void); double eye_offset, gl_fov_rad, zp_width; /* zero parallax width */ static double last_eye_offset; double scale, depth, width_scale, height_scale; int side_by_side; if (gl_initialized == 0) { gl_init (); gl_initialized = 1; } gl_set_perspective (); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); /* Make sure the image does not appear distorted in a window that is wide but not very tall. Note that we use canvas_scale and z_depth here for trying to keep up with the X11 rendering engine. Currently the selection from the OpenGL canvas is performed using the coordinates generated by the X11 rendering engine. In the following code we are trying to squeeze the OpenGL view so that the image generated by the OpenGL resembles the image generated by the X11 rendered as much as possible. This depends highly on the position of the field of view slider but we are trying to match the images anyway. The images become more and more different as the user zooms in. */ scale = get_canvas_scale (); depth = get_z_depth (); width_scale = (scale * depth) / (float) canvas_width; height_scale = width_scale * (canvas_width / (float) canvas_height); glScalef (width_scale, height_scale, 1.0f); gluLookAt (0.0, 0.0, gl_eye, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); /* This may get changed in StereoProjection, but isn't reset when we change back to a single image */ glViewport (0, 0, canvas_width, canvas_height); /* aro--> */ if(get_gl_render_stereo() && depth_is_on) { /* Calculate offset between eyes. Max distance between eyes should be (distance to projection plane) / 15 */ eye_offset = (gl_eye + gl_perspective_near) / gl_sep; if(eye_offset > 0.0) last_eye_offset = eye_offset; else eye_offset = last_eye_offset; /* Calculate width at zero parallax (default z = 0) from given fov. zp_width = (1/2) entire width at zero parallax */ gl_fov_rad = (PI * gl_fov) / 180; zp_width = gl_eye * tan( 0.5 * gl_fov_rad ); /* Left eye: */ /* Create nonsymetric viewing frustum */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (get_gl_render_stereo() == SIDE_BY_SIDE) { side_by_side = 1; } else { side_by_side = 0; } StereoProjection(-zp_width, zp_width, -zp_width, zp_width, gl_perspective_near, gl_perspective_far, 0.0, gl_eye, -eye_offset, side_by_side); if(get_gl_render_stereo() == SIDE_BY_SIDE) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); */ } else if (get_gl_render_stereo() == RED_BLUE) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);/* Red mask */ } #ifdef SGI_STEREO else if(get_gl_render_stereo() == SGI_HARDWARE) { glXWaitGL(); XSGISetStereoBuffer(display, XtWindow(canvas), STEREO_BUFFER_LEFT); glXWaitX(); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Need to change aspect ratio as we've changed aspect ratio of monitor */ width_scale = width_scale / 0.48; } #endif /* SGI_STEREO */ else fprintf(stderr, "gl_render: Invalid stereo mode\n"); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glScalef (width_scale, height_scale, 1.0f); if ((! mouse_motion_p ()) || (! outline_mode_p ())) { if (gl_use_lighting) { gluQuadricNormals (gl_quadric, GLU_SMOOTH); } else { gluQuadricNormals (gl_quadric, GLU_NONE); } gluQuadricDrawStyle (gl_quadric, GLU_FILL); glEnable (GL_DEPTH_TEST); glEnable (GL_COLOR_MATERIAL); glDisable (GL_LIGHTING); if (bbox_flag && (no_atoms > 0)) gl_render_bbox (); if (gl_use_lighting) glEnable (GL_LIGHTING); gl_render_atoms (); gl_render_bonds (); gl_render_hbonds (); gl_render_vectors (); } else { glDisable (GL_LIGHTING); glDisable (GL_DEPTH_TEST); glDisable (GL_COLOR_MATERIAL); gluQuadricDrawStyle (gl_quadric, GLU_LINE); gluQuadricNormals (gl_quadric, GLU_NONE); gl_render_atoms (); } /* Right eye: */ /* Create nonsymetric viewing frustum */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); StereoProjection(-zp_width, zp_width, -zp_width, zp_width, gl_perspective_near, gl_perspective_far, 0.0, gl_eye, eye_offset, -side_by_side); if(get_gl_render_stereo() == SIDE_BY_SIDE) { /* glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); */ /* glClear(GL_DEPTH_BUFFER_BIT); */ } else if (get_gl_render_stereo() == RED_BLUE) { glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE);/* Blue mask */ glClear(GL_DEPTH_BUFFER_BIT); } #ifdef SGI_STEREO else if(get_gl_render_stereo() == SGI_HARDWARE) { glXWaitGL(); XSGISetStereoBuffer(display, XtWindow(canvas), STEREO_BUFFER_RIGHT); glXWaitX(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); } #endif /* SGI_STEREO */ else fprintf(stderr, "gl_render: Invalid stereo mode\n"); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glScalef (width_scale, height_scale, 1.0f); } else /* If not stereo, we need to clear color and depth */ { glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); } /* <--aro */ if ((! mouse_motion_p ()) || (! outline_mode_p ())) { if (gl_use_lighting) { gluQuadricNormals (gl_quadric, GLU_SMOOTH); } else { gluQuadricNormals (gl_quadric, GLU_NONE); } gluQuadricDrawStyle (gl_quadric, GLU_FILL); glEnable (GL_DEPTH_TEST); glEnable (GL_COLOR_MATERIAL); glDisable (GL_LIGHTING); if (bbox_flag && (no_atoms > 0)) gl_render_bbox (); if (gl_use_lighting) glEnable (GL_LIGHTING); gl_render_atoms (); gl_render_bonds (); gl_render_hbonds (); gl_render_vectors (); } else { glDisable (GL_LIGHTING); glDisable (GL_DEPTH_TEST); glDisable (GL_COLOR_MATERIAL); gluQuadricDrawStyle (gl_quadric, GLU_LINE); gluQuadricNormals (gl_quadric, GLU_NONE); gl_render_atoms (); } /* aro - change color mask so all of RGB color fields are cleared */ if ((get_gl_render_stereo() == RED_BLUE) && depth_is_on) glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); /* Note that we are drawing onto the canvas directly, since I haven't been able to figure out the cause of crashes (in glClearColor) on some displays. */ glXSwapBuffers (display, XtWindow (canvas)); /* Note that we should make this conditional; we only need it when XpmWriteFileFromPixmap is called and canvas_pm is used. */ if (gl_copy_canvas) { XCopyArea (display, XtWindow (canvas), canvas_pm, gc, 0, 0, canvas_width, canvas_height, 0, 0); } } void StereoProjection(float left, float right, float bottom, float top, float near, float far, float zero_plane, float dist, float eye, int side_by_side) { enum render_stereo_types get_gl_render_stereo(); float xmid, ymid, clip_near, clip_far, topw, bottomw, leftw, rightw, dx, dy, n_over_d; static double last_near; static double last_far; /* Viewports for side by side mode */ if (side_by_side == 1) { glViewport (canvas_width / 2, 0, canvas_width / 2, canvas_height); left *= 0.5; right *= 0.5; } else if (side_by_side == -1) { glViewport (0, 0, canvas_width, canvas_height); glColor3f (0.0, 0.0, 0.0); glLineWidth (2.0); glBegin (GL_LINES); /* FIXME: do this properly */ glVertex3f (0.0, -1000, 0.0); glVertex3f (0.0, 1000, 0.0); glEnd (); glViewport (0, 0, canvas_width / 2, canvas_height); left *= 0.5; right *= 0.5; } else { glViewport (0, 0, canvas_width, canvas_height); } dx = right - left; dy = top - bottom; xmid = (right + left) / 2.0; ymid = (top + bottom) / 2.0; /* If the near clipping plane is going to be behind the eye, clamp its position at that of the eye (We set it 1.0 first because glFrustum requires it to be non-zero */ if(near > 0.0) { last_near = clip_near = near; last_far = clip_far = far; } else { clip_near = last_near; clip_far = last_far; } n_over_d = clip_near / dist; topw = n_over_d * dy / 2.0; bottomw = -topw; rightw = n_over_d * (dx / 2.0 - eye); leftw = n_over_d *(-dx / 2.0 - eye); /* Need to be in projection mode for this. */ glLoadIdentity(); glFrustum(leftw, rightw, bottomw, topw, clip_near, clip_far); glTranslatef(-xmid - eye, -ymid, -zero_plane - dist); } void gl_render_atoms (void) { void gl_render_atom (int); int get_gl_render_type (void); int i; /* Return if atoms not being display and in ball and stick mode; note that we draw atoms if tubes mode if the bond is visible */ for (i = 0; i < no_atoms; i++) { gl_current_render_type = (atoms[i].gl_render_type == DEFAULT) ? get_gl_render_type () : atoms[i].gl_render_type; if ((atom_flag == 0) && ((gl_current_render_type == BALL_AND_STICK) || ((gl_current_render_type == TUBES) && (! gl_use_lighting)))) return; if ((atoms[i].visi == 1) || (view_ghost_atoms == 1)) { gl_render_atom (i); } } } void gl_render_atom (int i) { int j; double line_width, atom_size; char string[16]="", sub_string[8]="", *labels = "ABCD"; enum render_stereo_types get_gl_render_stereo(void);/* aro */ GLfloat red, green, blue; /* For tubes mode, we don't draw an atom (a) when bonds are not displayed and the atom is bonded and (b) when atoms are not displayed and the atom is not bonded. In essense, atoms and bonds are mutually exclusive. */ if ((gl_current_render_type == TUBES) && gl_use_lighting) { if (((bond_flag == 0) && (bond_adjacency_list[i] != NULL)) || ((atom_flag == 0) && (bond_adjacency_list[i] == NULL))) return; } red = atoms[i].red / 65536.0; blue = atoms[i].blue / 65536.0; green = atoms[i].green / 65536.0; /* aro - We need to convert the colors to grayscale in order for red and blue color masks to work properly */ if ((get_gl_render_stereo() == RED_BLUE) && depth_is_on) { red = (red + blue + green) / 3; blue = red; green = red; } glPushMatrix (); glTranslatef (atoms[i].x, atoms[i].y, atoms[i].z); if ((! mouse_motion_p ()) || (! outline_mode_p ())) { glColor3f (red, green, blue); } else { glColor3f (0.0, 0.0, 0.0); } atom_size = gl_get_rendered_atom_size (i); line_width = 0.1 * get_atom_scale () * get_smallest_cov_rad (); /* Set up rendering for elliptical atoms */ if (((gl_current_render_type == BALL_AND_STICK) || ((gl_current_render_type == TUBES) && bond_adjacency_list[i] == NULL)) && (atoms[i].is_ellipse == 1)) { void euler_to_matrix (double *, double *); int j, k; double axis[3], angle, matrix[9]; double get_angle_axis (double *); /* Apply the rotation for the orientation of the system */ for (j = 0; j < 3; j++) { for (k = 0; k < 3; k++) { angle_axis_matrix[j][k] = global_matrix[j][k]; } } angle = get_angle_axis (axis); glRotatef (-angle / DEG2RAD, axis[0], axis[1], axis[2]); /* Apply the rotation describing the original orientation of the ellipse */ euler_to_matrix (atoms[i].euler, matrix); for (j = 0; j < 3; j++) { for (k = 0; k < 3; k++) { angle_axis_matrix[j][k] = matrix[(j * 3) + k]; } } angle = get_angle_axis (axis); glRotatef (angle / DEG2RAD, axis[0], axis[1], axis[2]); /* Apply the anisotropic scaling */ glScalef (atoms[i].shape[0], atoms[i].shape[1], atoms[i].shape[2]); } if ((! mouse_motion_p ()) || (! outline_mode_p ())) { /* Draw border for selected atoms */ if (atoms[i].sel == 1) { glColor3f (1.0, 0.65, 0.0); /* Orange */ glDisable (GL_LIGHTING); gluDisk (gl_quadric, atom_size - line_width, atom_size, gl_no_atom_segments, 1); if (gl_use_lighting) glEnable (GL_LIGHTING); glColor3f (red, green, blue); } if (gl_use_lighting) { double size; if (atoms[i].sel == 0) { size = atom_size; } else { size = atom_size - line_width; } gluSphere (gl_quadric, size, gl_no_atom_segments, gl_no_atom_segments); } else { gluDisk (gl_quadric, 0, atom_size, gl_no_atom_segments, 1); if (atoms[i].sel == 0) { glColor3f (0.0, 0.0, 0.0); /* Move slightly forward */ glTranslatef (0.0, 0.0, 0.01); gluDisk (gl_quadric, atom_size - line_width, atom_size, gl_no_atom_segments, 1); } } } else { gluDisk (gl_quadric, atom_size, /* Inner radius */ atom_size, /* Outer radius */ 8, /* Small number for slices */ 1); /* Number of rings */ } if (atom_flag == 1) { /* Atom numbers */ if (at_nos_flag) { sprintf (string, "%d ", i + 1); } /* Atom symbols */ if (at_sym_flag) { sprintf (sub_string, "%s ", atoms[i].label); strcat (string, sub_string); } /* Atom selections */ for (j = 0; j < 4; j++) { if(i == selected[j]) { sprintf (sub_string, "%c ", labels[j]); strcat (string, sub_string); } } if (strlen (string) > 0) { glColor3f (0.0, 0.0, 0.0); glRasterPos3f (0, 0, atom_size * 1.1); for (j = 0; j < strlen (string); j++) { glutBitmapCharacter (GLUT_BITMAP_HELVETICA_12, string[j]); } glRasterPos3f (0, 0, atom_size * 1.1); gl2psText(string, "Helvetica", 12); } } glPopMatrix (); } void gl_render_bbox (void) { GLfloat line_width = 2.0; glColor3f (0.7, 0.7, 0.7); glDepthMask (GL_FALSE); gl_render_bbox_face (0, 1, 3, 2); gl_render_bbox_face (4, 5, 7, 6); gl_render_bbox_face (0, 2, 6, 4); gl_render_bbox_face (1, 3, 7, 5); gl_render_bbox_face (0, 1, 5, 4); gl_render_bbox_face (2, 3, 7, 6); glDepthMask (GL_TRUE); glColor3f (0.0, 0.0, 0.0); glLineWidth (line_width); gl_render_bbox_line (0, 1); gl_render_bbox_line (0, 2); gl_render_bbox_line (0, 4); gl_render_bbox_line (1, 3); gl_render_bbox_line (1, 5); gl_render_bbox_line (2, 3); gl_render_bbox_line (2, 6); gl_render_bbox_line (3, 7); gl_render_bbox_line (4, 5); gl_render_bbox_line (4, 6); gl_render_bbox_line (5, 7); gl_render_bbox_line (6, 7); } void gl_render_bbox_line (int i, int j) { glBegin (GL_LINES); glVertex3f (bbox.v[i][0], bbox.v[i][1], bbox.v[i][2]); glVertex3f (bbox.v[j][0], bbox.v[j][1], bbox.v[j][2]); glEnd (); } void gl_render_bbox_face (int i, int j, int k, int l) { glBegin (GL_POLYGON); glVertex3f (bbox.v[i][0], bbox.v[i][1], bbox.v[i][2]); glVertex3f (bbox.v[j][0], bbox.v[j][1], bbox.v[j][2]); glVertex3f (bbox.v[k][0], bbox.v[k][1], bbox.v[k][2]); glVertex3f (bbox.v[l][0], bbox.v[l][1], bbox.v[l][2]); glEnd(); } void gl_render_bonds (void) { void gl_render_bond (int, int); int i, j; struct node *ptr; if (bond_flag == 0) return; for (i = 0; i < no_atoms; i++) { ptr = bond_adjacency_list[i]; while (ptr != NULL) { j = (ptr->v); if (atoms[i].visi && atoms[j].visi) { gl_render_bond (i, j); } ptr = ptr->next; } } } void gl_render_bond (int i, int j) { enum render_stereo_types get_gl_render_stereo(void);/* aro */ void update_canvas_bond_points (int, int, Boolean, double); int k; double angle, b[3], bond_radius, length, mod_b, line_width; GLfloat red, green, blue; /* We want the radius, ie half the width which represents the diameter */ bond_radius = get_bond_width () / 2.0; /* b is the vector along the bond */ b[0] = atoms[j].x - atoms[i].x; b[1] = atoms[j].y - atoms[i].y; b[2] = atoms[j].z - atoms[i].z; mod_b = mod_of_vec (b); normalize_vec (b); angle = acos (b[2]) / DEG2RAD; red = atoms[i].red / 65536.0; blue = atoms[i].blue / 65536.0; green = atoms[i].green / 65536.0; /* aro - We need to convert the colors to grayscale in order for red and blue color masks to work properly */ if ((get_gl_render_stereo() == RED_BLUE) && depth_is_on) { red = (red + blue + green) / 3; blue = red; green = red; } glColorMaterial (GL_FRONT, GL_DIFFUSE); glColor3f (red, green, blue); if (gl_use_lighting) { glPushMatrix (); glTranslatef (atoms[i].x, atoms[i].y, atoms[i].z); glRotatef (180.0, 0.0, 0.0, 1.0); glRotatef (angle, b[1], -1.0 * b[0], 0.0); /* length of bond segment */ length = (mod_b * atoms[i].cov_rad / (atoms[i].cov_rad + atoms[j].cov_rad)); gluCylinder (gl_quadric, bond_radius, bond_radius, length, gl_no_bond_segments, 1); glPopMatrix (); } else { /* Outline */ update_canvas_bond_points (i, j, False, 0.0); glColor3f (0.0, 0.0, 0.0); glPushMatrix (); glTranslatef (0.0, 0.0, -0.01); glBegin (GL_POLYGON); k = 0; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 1; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 4; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 5; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); glEnd (); glPopMatrix (); /* Colour blocks */ glColor3f (red, green, blue); line_width = 0.1 * get_bond_scale () * get_smallest_cov_rad (); update_canvas_bond_points (i, j, False, line_width); glBegin (GL_POLYGON); k = 0; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 1; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 4; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); k = 5; glVertex3f (cartesian_bond_points[k][0], cartesian_bond_points[k][1], cartesian_bond_points[k][2]); glEnd (); } } void gl_render_hbonds (void) { void gl_render_hbond (int, int); int i, j; struct node *ptr; if ((hbond_flag == 0) || (any_hydrogen == 0)) return; for (i = 0; i < no_atoms; i++) { ptr = hbond_adjacency_list[i]; while (ptr != NULL) { j = (ptr->v); if (i > j) /* don't do things twice */ { if (atoms[i].visi && atoms[j].visi) { gl_render_hbond (i, j); } } ptr = ptr->next; } } } void gl_render_hbond (int i, int j) { int k, l, no_segments = 5; double angle, atom_size, bond_length, segment_length, hbond_width; double start[3], end[3], bond_vector[3], segment[3]; /* The whole bond */ bond_vector[0] = atoms[j].x - atoms[i].x; bond_vector[1] = atoms[j].y - atoms[i].y; bond_vector[2] = atoms[j].z - atoms[i].z; normalize_vec (bond_vector); /* The visible portion of the bond */ atom_size = gl_get_rendered_atom_size (i); start[0] = atoms[i].x + (atom_size * bond_vector[0]); start[1] = atoms[i].y + (atom_size * bond_vector[1]); start[2] = atoms[i].z + (atom_size * bond_vector[2]); atom_size = gl_get_rendered_atom_size (j); end[0] = atoms[j].x - (atom_size * bond_vector[0]); end[1] = atoms[j].y - (atom_size * bond_vector[1]); end[2] = atoms[j].z - (atom_size * bond_vector[2]); for (k = 0; k < 3; k++) { bond_vector[k] = end[k] - start[k]; } bond_length = mod_of_vec (bond_vector); segment_length = bond_length / ((2 * no_segments) - 1); normalize_vec (bond_vector); angle = acos (bond_vector[2]) / DEG2RAD; glColorMaterial (GL_FRONT, GL_DIFFUSE); /* aro - as long as hbonds are always grayscale, they'll render properly in red/blue stereo mode */ glColor3f (0.0, 0.0, 0.0); for (k = 0; k < no_segments; k++) { /* Coordinate for start of segment */ for (l = 0; l < 3; l++) { segment[l] = start[l] + (k * 2) * bond_vector[l] * segment_length; } glPushMatrix (); glTranslatef (segment[0], segment[1], segment[2]); glRotatef (180.0, 0.0, 0.0, 1.0); glRotatef (angle, bond_vector[1], -1.0 * bond_vector[0], 0.0); /* length of bond segment */ hbond_width = 0.15 * get_hbond_scale (); gluCylinder (gl_quadric, hbond_width, hbond_width, segment_length, gl_no_bond_segments, 1); glPopMatrix (); } } double gl_get_rendered_atom_size (int i) { int get_gl_render_type (void); double atom_size = 0; /* Work out the size the atom is going to be rendered at taking into account the drawing mode (BALL_AND_STICK or TUBES) and whether or not atoms and bonds are being displayed */ /* We need this for bounding box calculation; it is a duplication of effort when called from gl_render_atom. */ gl_current_render_type = (atoms[i].gl_render_type == DEFAULT) ? get_gl_render_type () : atoms[i].gl_render_type; if ((gl_current_render_type == BALL_AND_STICK) || (! gl_use_lighting)) { if (atom_flag) { /* If not bonded use VDW, otherwise covalent radius */ if ((bond_adjacency_list[i] == NULL) && (never_use_vdw == 0)) { atom_size = get_atom_scale () * atoms[i].vdw_rad; } else { atom_size = get_atom_scale () * atoms[i].cov_rad; } } else { atom_size = 0; /* Atoms not being rendered */ } } else if (gl_current_render_type == TUBES) { if (bond_adjacency_list[i] == NULL) { /* Atom is not bonded; only render if atoms being displayed */ if (atom_flag) { if (never_use_vdw == 1) { atom_size = get_atom_scale () * atoms[i].cov_rad; } else { atom_size = get_atom_scale () * atoms[i].vdw_rad; } } else { atom_size = 0; } } else { /* Atom is bonded; only render if bonds are being displayed */ if (bond_flag) { atom_size = get_bond_width () / 2; } else { atom_size = 0; } } } return (atom_size); } void gl_render_vectors (void) { void gl_render_vector (int, int); int i, j; if (vector_flag == 0) { return; } glColorMaterial (GL_FRONT, GL_DIFFUSE); for (i = 0; i < no_atoms; i++) { for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if (atoms[i].has_vector > j) { gl_render_vector (i, j); } } } } void gl_render_vector (int i, int j) { double get_vector_arrow_angle (void); double get_vector_arrow_scale (void); double get_vector_scale (void); double angle, height, mod_of_vector, top_radius; double vector_arrow_angle, vector_arrow_scale, vector_scale; double vector[3]; double atom_size = gl_get_rendered_atom_size (i); vector_arrow_angle = get_vector_arrow_angle (); vector_arrow_scale = get_vector_arrow_scale (); vector_scale = get_vector_scale (); /* Draw stem */ glColor3f (0.5, 0.5, 0.5); vector[0] = atoms[i].v[j][0] * vector_scale; vector[1] = atoms[i].v[j][1] * vector_scale; vector[2] = atoms[i].v[j][2] * vector_scale; mod_of_vector = mod_of_vec (vector); normalize_vec (vector); height = mod_of_vector * vector_arrow_scale; angle = acos (vector[2]) / DEG2RAD; glPushMatrix (); glTranslatef (atoms[i].x, atoms[i].y, atoms[i].z); glRotatef (180.0, 0.0, 0.0, 1.0); glRotatef (angle, vector[1], -1.0 * vector[0], 0.0); glTranslatef (0.0, 0.0, atom_size); gluCylinder (gl_quadric, 0.025, 0.025, mod_of_vector - (height + atom_size), 16, 1); glPopMatrix (); /* Draw head */ glColor3f (0.0, 0.0, 0.0); top_radius = height * tan (vector_arrow_angle * DEG2RAD); glPushMatrix (); glTranslatef (atoms[i].x + (mod_of_vector - height) * vector[0], atoms[i].y + (mod_of_vector - height) * vector[1], atoms[i].z + (mod_of_vector - height) * vector[2]); glRotatef (180.0, 0.0, 0.0, -1.0); glRotatef (angle, vector[1], -1.0 * vector[0], 0.0); gluCylinder (gl_quadric, top_radius, 0, /* base radius */ height, 16, /* slices */ 8); /* stacks */ glPopMatrix (); } void gl_init (void) { void bg_color_init(void); /* aro */ XColor get_bg_color (void); double red, green, blue; Boolean color_initialized = False; static XColor bg_color_rgb; GLfloat light_position[] = {0.0, 0.0, 1.0, 0.0}; if (color_initialized == False) { if(bg_color_parsed == 0 && strcmp(bg_color,"") != 0){ bg_color_init(); bg_color_parsed = 1; } bg_color_rgb = get_bg_color (); red = bg_color_rgb.red / 65535.0; green = bg_color_rgb.green / 65535.0; blue = bg_color_rgb.blue / 65535.0; } glClearColor (red, green, blue, 0.0); glShadeModel (GL_SMOOTH); /* Lighting */ glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glLightfv (GL_LIGHT0, GL_POSITION, light_position); glEnable (GL_LIGHT0); glDepthFunc (GL_LESS); glEnable (GL_COLOR_MATERIAL); /* Allocate a quadric */ if (gl_quadric == NULL) { gl_quadric = gluNewQuadric (); } } void gl_set_perspective (void) { glMatrixMode (GL_PROJECTION); glLoadIdentity (); gl_update_near_and_far (); if (depth_is_on) { gluPerspective (gl_fov, 1.0, gl_perspective_near, gl_perspective_far); } else { double h; /* Use the field of view angle (gl_fov) to get the dimensions of the rendered scene (h) at the origin; this is a square gl_eye from the viewpoint */ h = gl_eye * tan (gl_fov * PI / 360.0); glOrtho (-h, h, -h, h, gl_perspective_near, gl_perspective_far); } } void gl_update_near_and_far (void) { double get_vector_scale (void); int i, j; double vector_scale = get_vector_scale (); double outline_offset = 0.1, shape_scale; Boolean max_set = False, min_set = False; /* Get the atoms with minimum/maximum Z for gluPerspective */ for (i = 0; i < no_atoms; i++) { /* Take account of elliptical atoms */ if (atoms[i].is_ellipse == 1) { shape_scale = atoms[i].max_shape; } else { shape_scale = 1.0; } /* Maximum distance of atom from origin; take in account the maximum radius of the atom since we don't want to clip it in the centre */ if (max_set) { if ((atoms[i].z + (shape_scale * atoms[i].vdw_rad)) > gl_max_z) { gl_max_z = atoms[i].z + (shape_scale * atoms[i].vdw_rad); } } else { gl_max_z = atoms[i].z + (shape_scale * atoms[i].vdw_rad); max_set = True; } /* We use outline_offset since when in outline mode, the disk furthest from the eye disappears if some leeway isn't set */ if (min_set) { if ((atoms[i].z - (shape_scale * atoms[i].vdw_rad)) < gl_min_z) { gl_min_z = (atoms[i].z - (shape_scale * atoms[i].vdw_rad)) - outline_offset; } } else { gl_min_z = (atoms[i].z - (shape_scale * atoms[i].vdw_rad)) - outline_offset; min_set = True; } } /* Now check the vectors */ if (vector_flag == 1) { for (i = 0; i < no_atoms; i++) { for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if (atoms[i].has_vector > j) { if ((atoms[i].z + (atoms[i].v[j][2] * vector_scale)) > gl_max_z) { gl_max_z = atoms[i].z + (atoms[i].v[j][2] * vector_scale); } else if ((atoms[i].z + (atoms[i].v[j][2] * vector_scale)) < gl_min_z) { gl_min_z = atoms[i].z + (atoms[i].v[j][2] * vector_scale); } } } } /* FIX ME -- we haven't taken into account the vector head, which may be clipped; fudge this */ { double max_vector_size = 10.0; gl_max_z += max_vector_size; gl_min_z -= max_vector_size; } } if (gl_eye > gl_max_z) { gl_perspective_near = gl_eye - gl_max_z; } else { gl_perspective_near = 0.01; /* Small and positive */ } if (gl_eye > gl_min_z) { gl_perspective_far = gl_eye - gl_min_z; } else { gl_perspective_far = 0.02; /* Small and slightly more positive */ } } int get_gl_no_atom_segments (void) { return (gl_no_atom_segments); } void set_gl_no_atom_segments (int new_value) { gl_no_atom_segments = new_value; } int get_gl_no_bond_segments (void) { return (gl_no_bond_segments); } void set_gl_no_bond_segments (int new_value) { gl_no_bond_segments = new_value; } double get_gl_fov (void) { return (gl_fov); } void set_gl_fov (double new_value) { gl_fov = new_value; gl_set_perspective (); } double get_gl_eye (void) { return (gl_eye); } void set_gl_eye (double new_value) { gl_eye = new_value; gl_set_perspective (); } /* aro--> */ int get_gl_sep (void) { return (gl_sep); } void set_gl_sep (int new_value) { gl_sep = new_value; } /* Logical variable used to determine if GL rendering is active */ static Boolean render_using_gl = True; void set_render_using_gl (Boolean value) { render_using_gl = value; } Boolean render_using_gl_p (void) { return (render_using_gl); } int get_gl_render_type (void) { return (gl_render_type); } void set_gl_render_type (enum gl_render_types new_value) { gl_render_type = new_value; } /* aro--> */ /* Variable used to determine whether stereo rendering is active */ static enum render_stereo_types render_stereo_mode = NO_STEREO; void set_gl_render_stereo(enum render_stereo_types value) { #ifdef SGI_STEREO int get_monitor_frequency(); void set_monitor_frequency(int); Boolean render_using_gl_p(); static Dimension w; static Dimension h; Dimension new_w; static int refresh_rate; int event, error; char* display_env; #endif /* SGI_STEREO */ render_stereo_mode = value; #ifdef SGI_STEREO if(value == SGI_HARDWARE && render_using_gl_p()) { display_env = getenv("DISPLAY"); if(display_env[0] != ':') { fprintf(stderr, "Not running on a local display, can't change to SGI stereo mode\n"); } else if(XSGIStereoQueryExtension(display, &event, &error) == False) { fprintf(stderr, "SGI Stereo Extensions not supported by X server\n"); } else if(XSGIQueryStereoMode(display, XtWindow(canvas)) == X_STEREO_UNSUPPORTED) { fprintf(stderr, "SGI Stereo Extensions not supported by current screen\n"); } else if(XSGIQueryStereoMode(display, XtWindow(canvas)) != STEREO_TOP) { XtVaSetValues(toplevel, XmNallowShellResize, True, NULL); XtVaGetValues(canvas, XmNwidth, &w, NULL); XtVaGetValues(canvas, XmNheight, &h, NULL); new_w = w / 0.48; XtVaSetValues(canvas, XmNwidth, new_w, NULL); /* Hard coded 392 for now, not sure if this is uniform resolution across SGI's when in STR_TOP mode */ XtVaSetValues(canvas, XmNheight, 392, NULL); XtVaSetValues(toplevel, XmNallowShellResize, False, NULL); refresh_rate = get_monitor_frequency(); system("/usr/gfx/setmon -n STR_TOP"); } } else if(XSGIQueryStereoMode(display, XtWindow(canvas)) == STEREO_TOP) { set_monitor_frequency(refresh_rate); /*makes system call to setmon */ XtVaSetValues(toplevel, XmNallowShellResize, True, NULL); XtVaSetValues(canvas, XmNwidth, w, NULL); XtVaSetValues(canvas, XmNheight, h, NULL); XtVaSetValues(toplevel, XmNallowShellResize, False, NULL); } #endif /* SGI_STEREO */ } enum render_stereo_types get_gl_render_stereo() { return render_stereo_mode; } /* <--aro */ void gl_set_lighting (int new_value) { gl_use_lighting = new_value; } int gl_get_lighting (void) { return (gl_use_lighting); } void gl_set_specular_lighting (int new_value) { GLfloat specular[] = {0.5, 0.5, 0.5, 1.0}; /* Configurable? */ GLfloat no_specular[] = {0.0, 0.0, 0.0, 1.0}; gl_use_specular_lighting = new_value; if (gl_use_specular_lighting) { glMaterialfv (GL_FRONT, GL_SPECULAR, specular); glMaterialfv (GL_FRONT, GL_SHININESS, gl_shininess); } else { glMaterialfv (GL_FRONT, GL_SPECULAR, no_specular); glMaterialfv (GL_FRONT, GL_SHININESS, gl_shininess); } } int gl_get_specular_lighting (void) { return (gl_use_specular_lighting); } void gl_set_shininess (int new_value) { GLfloat specular[] = {0.5, 0.5, 0.5, 1.0}; /* Configurable? */ GLfloat no_specular[] = {0.0, 0.0, 0.0, 1.0}; gl_shininess[0] = new_value; if (gl_use_specular_lighting) { glMaterialfv (GL_FRONT, GL_SPECULAR, specular); glMaterialfv (GL_FRONT, GL_SHININESS, gl_shininess); } else { glMaterialfv (GL_FRONT, GL_SPECULAR, no_specular); glMaterialfv (GL_FRONT, GL_SHININESS, gl_shininess); } } int gl_get_shininess (void) { return (gl_shininess[0]); } void set_gl_copy_canvas (int value) { gl_copy_canvas = value; } #endif /* GL */ xmakemol-5.16/help.c0000644000175000017500000001536610665601003011307 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" void place_dialog_cb (Widget, XtPointer, XtPointer); void help_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void make_about_dlg(Widget); void make_doc_dlg(Widget); void make_mouse_dlg(Widget); void make_bugs_dlg(Widget); int item_no=(int)client_data; switch(item_no){ case 0: make_about_dlg(main_w); break; case 1: make_doc_dlg(main_w); break; case 2: make_mouse_dlg(main_w); break; case 3: make_bugs_dlg(main_w); break; } } #define ABOUT_MSG "XMakemol version %s\nCopyright (C) 2007 Matthew P. Hodges\n\nXMakemol is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nXMakemol is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with XMakemol; see the file COPYING. If not, write to the Free Software\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" void make_about_dlg(Widget parent) { int n; char *about_string = NULL; static Widget about_dialog = NULL; XmString msg,title; if(about_dialog == NULL) { title = XmStringCreateLocalized("About XMakemol"); n=0; XtSetArg(args[n], XmNdialogTitle, title); n++; if(about_string == NULL) { about_string = malloc (sizeof (ABOUT_MSG) + sizeof (VERSION)); } sprintf(about_string, ABOUT_MSG, VERSION); msg = XmStringCreateLtoR(about_string, XmFONTLIST_DEFAULT_TAG); XtSetArg(args[n], XmNmessageString, msg); n++; about_dialog = XmCreateInformationDialog(main_w, "about" ,args, n); XmStringFree(title); XtUnmanageChild (XmMessageBoxGetChild(about_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(about_dialog, XmDIALOG_HELP_BUTTON)); } XtManageChild(about_dialog); } #define DOC_MSG "For documentation, see:-\nhttp://www.nongnu.org/xmakemol." void make_doc_dlg(Widget parent) { int n; char *doc_string = NULL; static Widget doc_dialog = NULL; XmString msg,title; if(doc_dialog == NULL) { title = XmStringCreateLocalized("Documentation"); n=0; XtSetArg(args[n], XmNdialogTitle, title); n++; if(doc_string == NULL) { doc_string = malloc(sizeof(DOC_MSG)); } sprintf(doc_string, DOC_MSG); msg = XmStringCreateLtoR(doc_string, XmFONTLIST_DEFAULT_TAG); XtSetArg(args[n], XmNmessageString, msg); n++; doc_dialog = XmCreateInformationDialog(main_w, "doc", args, n); XmStringFree(title); XtUnmanageChild (XmMessageBoxGetChild(doc_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(doc_dialog, XmDIALOG_HELP_BUTTON)); } XtManageChild(doc_dialog); } #define MOUSE_MSG "These are the mouse translations:\n\nNo modifier:\n\nMouse-1 Rotate atoms about an axis in the XY plane\nMouse-2 Rotate atoms about the Z axis\nMouse-3 Select atom for the Measure dialog\n\nControl modifier:\n\nMouse-1 Translate atoms in the XY plane\nMouse-2 Translate atoms along the Z axis\nMouse-3 Select closest atom for the Edit->Positions dialog\n\nShift modifier:\n\nMouse-1 Create a rectangular region on the canvas\nMouse-2 Show invisible atoms\nMouse-3 Toggle closest atom's visibility" void make_mouse_dlg(Widget parent) { int n; char *doc_string = NULL; static Widget mouse_dialog = NULL; XmString msg,title; if(mouse_dialog == NULL) { title = XmStringCreateLocalized("Mouse actions"); n=0; XtSetArg(args[n], XmNdialogTitle, title); n++; if(doc_string == NULL) { doc_string = malloc(sizeof(MOUSE_MSG)); } sprintf(doc_string, MOUSE_MSG); msg = XmStringCreateLtoR(doc_string, XmFONTLIST_DEFAULT_TAG); XtSetArg(args[n], XmNmessageString, msg); n++; mouse_dialog = XmCreateInformationDialog(main_w, "mouse", args, n); XmStringFree(title); XtUnmanageChild (XmMessageBoxGetChild(mouse_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(mouse_dialog, XmDIALOG_HELP_BUTTON)); } XtAddCallback (mouse_dialog, XmNmapCallback, place_dialog_cb, NULL); XtManageChild(mouse_dialog); } #define BUGS_MSG "Send bug reports to:-\nxmakemol-bugs@nongnu.org\n\nAll bug reports should state which version of XMakemol is being used\nand the platform on which it is being run.\n\nYou should detail what you expected to happen and what actually did\nhappen." void make_bugs_dlg(Widget parent) { int n; char *bugs_string = NULL; static Widget bugs_dialog = NULL; XmString msg,title; if(bugs_dialog == NULL) { title = XmStringCreateLocalized("Reporting bugs"); n=0; XtSetArg(args[n], XmNdialogTitle, title); n++; if(bugs_string == NULL) { bugs_string = malloc(sizeof(BUGS_MSG)); } sprintf(bugs_string, BUGS_MSG); msg = XmStringCreateLtoR(bugs_string, XmFONTLIST_DEFAULT_TAG); XtSetArg(args[n], XmNmessageString, msg); n++; bugs_dialog = XmCreateInformationDialog(main_w, "bugs", args, n); XtUnmanageChild (XmMessageBoxGetChild(bugs_dialog, XmDIALOG_OK_BUTTON)); XtUnmanageChild (XmMessageBoxGetChild(bugs_dialog, XmDIALOG_HELP_BUTTON)); } XtManageChild(bugs_dialog); } xmakemol-5.16/menus.c0000644000175000017500000002555210664010174011506 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "globals.h" #include "view.h" void make_menus(Widget main_w, Widget menubar) { void cont_cb(Widget, XtPointer, XtPointer); void edit_cb(Widget, XtPointer, XtPointer); void file_cb(Widget, XtPointer, XtPointer); void help_cb(Widget, XtPointer, XtPointer); void track_cb(Widget, XtPointer, XtPointer); void view_cb(Widget, XtPointer, XtPointer); Widget widget; XmString file,open,revert,save,merge,export,print,quit;/* aro */ /* 0th menu */ XmString cont,fram,anim,meas,pers; /* 1st */ XmString edit,visi,posn,sc_co,ab_sz,bd_fd,vdisp,ed_bbox,elem; /* 2nd */ XmString track,tr_rotl,tr_roto,cent,tr_reor,tr_repo, reflect_x,reflect_y,reflect_z,invert; /* 3rd */ XmString view,atoms,bonds,hbonds,vects,at_nos; /* 4th */ XmString at_sym,axes,bbox,outl; XmString help,about,doc,mouse,bugs; /* 5th */ #ifdef GL XmString gl_ren; #endif /* GL */ /* XmStrings for accelerators */ XmString accel1, accel2, accel3, accel4, accel5; /* Create a simple MenuBar that contains the five menus */ file = XmStringCreateLocalized("File"); cont = XmStringCreateLocalized("Control"); edit = XmStringCreateLocalized("Edit"); track = XmStringCreateLocalized("Track"); view = XmStringCreateLocalized("View"); help = XmStringCreateLocalized("Help"); menubar = XmVaCreateSimpleMenuBar (main_w, "menubar", XmVaCASCADEBUTTON, file, 'F', XmVaCASCADEBUTTON, cont, 'C', XmVaCASCADEBUTTON, edit, 'E', XmVaCASCADEBUTTON, track, 'T', XmVaCASCADEBUTTON, view, 'V', XmVaCASCADEBUTTON, help, 'H', NULL); XmStringFree(file); XmStringFree(cont); XmStringFree(edit); XmStringFree(track); XmStringFree(view); XmStringFree(help); /* Tell the menubar which button is the help menu */ if ((widget = XtNameToWidget (menubar, "button_5"))) XtVaSetValues (menubar, XmNmenuHelpWidget, widget, NULL); /* Zeroth menu is the File menu -- callback is file_cb() */ open = XmStringCreateLocalized("Open..."); revert = XmStringCreateLocalized("Revert"); save = XmStringCreateLocalized("Save..."); merge = XmStringCreateLocalized("Merge..."); export = XmStringCreateLocalized("Export..."); print = XmStringCreateLocalized("Print..."); /* aro */ quit = XmStringCreateLocalized("Quit"); accel1 = XmStringCreateLocalized("Ctrl+O"); accel2 = XmStringCreateLocalized("Ctrl+S"); accel3 = XmStringCreateLocalized("Ctrl+Q"); nth_menu[0] = XmVaCreateSimplePulldownMenu (menubar, "file_menu", 0, file_cb, XmVaPUSHBUTTON, open, 'O', "CtrlO", accel1, XmVaPUSHBUTTON, revert,'R', NULL, NULL, XmVaPUSHBUTTON, save, 'S', "CtrlS", accel2, XmVaPUSHBUTTON, merge, 'M', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, export, 'E', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, print, 'P', NULL, NULL,/* aro */ XmVaSEPARATOR,/* aro */ XmVaPUSHBUTTON, quit, 'Q', "CtrlQ", accel3, NULL); XmStringFree(open); XmStringFree(revert); XmStringFree(save); XmStringFree(merge); XmStringFree(export); XmStringFree(print);/* aro */ XmStringFree(quit); XmStringFree(accel1); XmStringFree(accel2); XmStringFree(accel3); /* First menu is the control menu -- callback is cont_cb() */ fram = XmStringCreateLocalized("Frames..."); anim = XmStringCreateLocalized("Animate..."); meas = XmStringCreateLocalized("Measure..."); pers = XmStringCreateLocalized("Perspective..."); accel1 = XmStringCreateLocalized("Ctrl+F"); accel2 = XmStringCreateLocalized("Ctrl+M"); accel3 = XmStringCreateLocalized("Ctrl+P"); nth_menu[1] = XmVaCreateSimplePulldownMenu (menubar, "cont_menu", 1, cont_cb, XmVaPUSHBUTTON, fram, 'F', "CtrlF", accel1, XmVaPUSHBUTTON, anim, 'A', NULL, NULL, XmVaPUSHBUTTON, meas, 'M', "CtrlM", accel2, XmVaPUSHBUTTON, pers, 'P', "CtrlP", accel3, NULL); XmStringFree(fram); XmStringFree(anim); XmStringFree(meas); XmStringFree(pers); XmStringFree(accel1); XmStringFree(accel2); XmStringFree(accel3); /* Second menu is the edit menu -- callback is edit_cb() */ visi=XmStringCreateLocalized("Visible..."); posn=XmStringCreateLocalized("Positions..."); sc_co=XmStringCreateLocalized("Scale coordinates..."); ab_sz=XmStringCreateLocalized("Atom/bond sizes..."); bd_fd=XmStringCreateLocalized("Bond factors..."); vdisp = XmStringCreateLocalized("Vector display..."); ed_bbox=XmStringCreateLocalized("Bounding Box..."); elem = XmStringCreateLocalized ("Element properties..."); #ifdef GL gl_ren = XmStringCreateLocalized ("GL rendering..."); #endif /* GL */ accel1 = XmStringCreateLocalized("Ctrl+V"); accel2 = XmStringCreateLocalized("Ctrl+A"); accel3 = XmStringCreateLocalized("Ctrl+B"); nth_menu[2] = XmVaCreateSimplePulldownMenu (menubar, "edit_menu", 2, edit_cb, XmVaPUSHBUTTON, visi, 'V', "CtrlV", accel1, XmVaPUSHBUTTON, posn, 'P', NULL, NULL, XmVaPUSHBUTTON, sc_co, 'S', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, ab_sz, 'A', "CtrlA", accel2, XmVaPUSHBUTTON, bd_fd, 'B', "CtrlB", accel3, XmVaSEPARATOR, XmVaPUSHBUTTON, vdisp, 'D', NULL, NULL, XmVaPUSHBUTTON, ed_bbox, 'O', NULL, NULL, XmVaPUSHBUTTON, elem, 'E', NULL, NULL, #ifdef GL XmVaPUSHBUTTON, gl_ren, 'G', NULL, NULL, #endif /* GL */ NULL); XmStringFree(visi); XmStringFree(posn); XmStringFree(sc_co); XmStringFree(ab_sz); XmStringFree(bd_fd); XmStringFree(vdisp); XmStringFree(ed_bbox); XmStringFree (elem); #ifdef GL XmStringFree (gl_ren); #endif /* GL */ XmStringFree(accel1); XmStringFree(accel2); XmStringFree(accel3); /* Third menu is the track menu -- callback is track_cb() */ tr_rotl = XmStringCreateLocalized ("Rotate about local COM"); tr_roto = XmStringCreateLocalized ("Rotate about origin"); cent = XmStringCreateLocalized ("Centre"); tr_reor = XmStringCreateLocalized("Original orientation"); tr_repo = XmStringCreateLocalized("Original position"); reflect_x = XmStringCreateLocalized("Reflect x coords"); reflect_y = XmStringCreateLocalized("Reflect y coords"); reflect_z = XmStringCreateLocalized("Reflect z coords"); invert = XmStringCreateLocalized("Invert through centre"); nth_menu[3] = XmVaCreateSimplePulldownMenu (menubar, "track_menu", 3, track_cb, XmVaRADIOBUTTON, tr_rotl, 'l', NULL, NULL, XmVaRADIOBUTTON, tr_roto, 'o', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, cent, 'C', NULL, NULL, XmVaPUSHBUTTON, tr_reor, 'o', NULL, NULL, XmVaPUSHBUTTON, tr_repo, 'p',NULL,NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, reflect_x,'x',NULL,NULL, XmVaPUSHBUTTON, reflect_y,'y',NULL,NULL, XmVaPUSHBUTTON, reflect_z,'z',NULL,NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, invert,'I',NULL,NULL, XmNradioBehavior, True, /* RowColumn resources to enforce */ NULL); XmStringFree(tr_rotl); XmStringFree(tr_roto); XmStringFree(cent); XmStringFree(tr_reor); XmStringFree(tr_repo); XmStringFree(reflect_x); XmStringFree(reflect_y); XmStringFree(reflect_z); XmStringFree(invert); /* Initialize menu so that "Rotations" is selected. */ if((widget = XtNameToWidget (nth_menu[3], "button_0"))) XtVaSetValues (widget, XmNset, True, NULL); /* Fourth menu is the view menu -- callback is view_cb() */ atoms = XmStringCreateLocalized("Atoms"); bonds = XmStringCreateLocalized("Bonds"); hbonds = XmStringCreateLocalized("H-Bonds"); vects = XmStringCreateLocalized("Vectors"); at_nos = XmStringCreateLocalized("Numbers"); at_sym = XmStringCreateLocalized("Symbols"); axes = XmStringCreateLocalized("Axes"); bbox = XmStringCreateLocalized("Bounding Box"); outl = XmStringCreateLocalized("Outline"); accel1 = XmStringCreateLocalized("A"); accel2 = XmStringCreateLocalized("B"); accel3 = XmStringCreateLocalized("H"); accel4 = XmStringCreateLocalized("N"); accel5 = XmStringCreateLocalized("S"); nth_menu[4] = XmVaCreateSimplePulldownMenu (menubar, "view_menu", 4, view_cb, XmVaTOGGLEBUTTON, atoms, 'A', "A", accel1, XmVaTOGGLEBUTTON, bonds, 'B', "B", accel2, XmVaTOGGLEBUTTON, hbonds, 'H', "H", accel3, XmVaTOGGLEBUTTON, vects, 'V', NULL,NULL, XmVaSEPARATOR, XmVaTOGGLEBUTTON, at_nos, 'N', "N", accel4, XmVaTOGGLEBUTTON, at_sym, 'S', "S", accel5, XmVaSEPARATOR, XmVaTOGGLEBUTTON, axes, 'x', NULL,NULL, XmVaTOGGLEBUTTON, bbox, 'o', NULL,NULL, XmVaSEPARATOR, XmVaTOGGLEBUTTON, outl, 'u', NULL, NULL, NULL); if(atom_flag==1){ if((widget = XtNameToWidget(nth_menu[4], "button_0"))) XtVaSetValues(widget, XmNset, True, NULL); } if(bond_flag==1){ if((widget = XtNameToWidget(nth_menu[4], "button_1"))) XtVaSetValues(widget, XmNset, True, NULL); } if(hbond_flag==1){ if((widget = XtNameToWidget(nth_menu[4], "button_2"))) XtVaSetValues(widget, XmNset, True, NULL); } if(vector_flag==1){ if((widget = XtNameToWidget(nth_menu[4], "button_3"))) XtVaSetValues(widget, XmNset, True, NULL); } XmStringFree(atoms); XmStringFree(bonds); XmStringFree(hbonds); XmStringFree(vects); XmStringFree(at_nos); XmStringFree(at_sym); XmStringFree(axes); XmStringFree(bbox); XmStringFree(outl); XmStringFree(accel1); XmStringFree(accel2); XmStringFree(accel3); XmStringFree(accel4); XmStringFree(accel5); /* Fifth is the help menu -- callback is help_cb() */ about = XmStringCreateLocalized("About..."); doc = XmStringCreateLocalized("Doc..."); mouse = XmStringCreateLocalized("Mouse..."); bugs = XmStringCreateLocalized("Bugs..."); nth_menu[5] = XmVaCreateSimplePulldownMenu (menubar, "help_menu", 5, help_cb, XmVaPUSHBUTTON, about, 'A', NULL, NULL, XmVaPUSHBUTTON, doc, 'D', NULL, NULL, XmVaPUSHBUTTON, mouse, 'M', NULL, NULL, XmVaPUSHBUTTON, bugs, 'B', NULL, NULL, NULL); XmStringFree(about); XmStringFree(doc); XmStringFree(mouse); XmStringFree(bugs); XtManageChild (menubar); } xmakemol-5.16/region.c0000644000175000017500000001006010664010174011626 00000000000000/* Copyright (C) 1999, 2000, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __REGION_C__ /* Functions to define a region on the canvas and to determine which atoms lie inside it */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "globals.h" /* Function prototypes */ void canvas_cb (Widget, XtPointer, XtPointer); static int *atoms_in_region, atoms_in_region_size; static Boolean region_active; static XPoint region_start, region_end; XPoint region_get_start(void) { return (region_start); } void region_set_start (XButtonEvent *bevent) { void canvas_cb(Widget, XtPointer, XtPointer); void deactivate_region(void); region_start.x = bevent->x; region_start.y = bevent->y; deactivate_region (); canvas_cb (canvas, NULL, NULL); } XPoint region_get_end(void) { return(region_end); } void region_set_end (XButtonEvent *bevent) { void activate_region (void); region_end.x = bevent->x; region_end.y = bevent->y; if (region_active == 0) { activate_region (); } redraw = 1; canvas_cb (canvas, NULL, NULL); } void activate_region (void) { region_active = 1; } void deactivate_region (void) { region_active = 0; } Boolean region_active_p (void) { return(region_active); } int * get_atoms_in_region (void) { return (atoms_in_region); } void update_atoms_in_region (Boolean inside_p) { /* Work out which atoms are inside/outside the region depending on the value of inside_p */ void allocate_atoms_in_region (void); void convert_to_canvas_coords (double *, double *, Boolean); int i; double atom_in[3], atom_out[2]; double x1, y1, x2, y2, temp; /* Start coords of rectangle */ x1 = region_start.x; y1 = region_start.y; /* End coords of rectangle */ x2 = region_end.x; y2 = region_end.y; /* Ensure that top left of rectangle is the start */ if(x1 > x2) { temp = x1; x1 = x2; x2 = temp; } if(y1 > y2) { temp = y1; y1 = y2; y2 = temp; } /* Initialize atoms_in_region if necessary */ if(atoms_in_region == NULL) { allocate_atoms_in_region(); } else { /* Check the size of atoms_in_region */ if(atoms_in_region_size != no_atoms) { free(atoms_in_region); allocate_atoms_in_region(); } } for(i = 0; i < no_atoms; i++) { atom_in[0] = atoms[i].x; atom_in[1] = atoms[i].y; atom_in[2] = atoms[i].z; convert_to_canvas_coords(atom_in, atom_out, 0); if((atom_out[0] > x1) && (atom_out[0] < x2) && (atom_out[1] > y1) && (atom_out[1] < y2)) { if(inside_p == 1) { atoms_in_region[i] = 1; } else { atoms_in_region[i] = 0; } } else { if(inside_p == 1) { atoms_in_region[i] = 0; } else { atoms_in_region[i] = 1; } } } } void allocate_atoms_in_region(void) { atoms_in_region = malloc((no_atoms * sizeof(int))); if(atoms_in_region == NULL) { fprintf(stderr, "Malloc failed for atoms_in_region (region.c)\n"); } /* Keep track of the size */ atoms_in_region_size = no_atoms; } xmakemol-5.16/rotate.c0000644000175000017500000001737310664010173011656 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" #include "bbox.h" #include "draw.h" /* Code to actually alter the atomic x,y,z values. This routine accepts first the axis to rotate about, second the angle, third a logical variable to state whether we want to store the geometry after the rotation and fourth a logical variable to determine whether to honour the atoms[i].edit flags */ void rotate_atoms(double *axis, double phi, Boolean store_g, Boolean rot_subset) { void adjust_current_frame(void); void canvas_cb(Widget, XtPointer, XtPointer); void clear_message_area (void); void deactivate_region(void); void normalize_vec(double *); void rotate(double *); void rotate_vectors(double *, double); void set_rotate_axis(double *); void set_rotate_angle(double); void set_rotate_origin(double *); void store_coords(void); void update_bbox(void); void update_bond_matrix(Boolean); void update_lengths_dialog(Boolean); void vector_product(double *, double *, double *); int i,all_rotated; double local_com[3], local_mass; double atom_coords[3]; all_rotated = 1; local_com[0] = local_com[1] = local_com[2] = 0; local_mass = 0; changing_frame = False; if((rotate_about == ROTATE_ABOUT_ORIGIN) || changing_frame) { set_rotate_origin(NULL); for(i = 0; i < no_atoms; i++) { if(atoms[i].edit == 0) { all_rotated = 0; atoms_sorted = 0; /* Depths have changed */ } } } else if(rotate_about == ROTATE_ABOUT_LOCAL_COM) { for(i = 0; i < no_atoms; i++) { if(atoms[i].edit == 1) { local_com[0] += atoms[i].mass * atoms[i].x; local_com[1] += atoms[i].mass * atoms[i].y; local_com[2] += atoms[i].mass * atoms[i].z; local_mass += atoms[i].mass; } else { all_rotated = 0; atoms_sorted = 0; /* Depths have changed */ } } for(i = 0; i < 3; i++) { if (local_mass == 0) { /* All dummy atoms? */ local_com[i] = 0; } else { local_com[i] /= local_mass; } } set_rotate_origin(local_com); } set_rotate_axis(axis); set_rotate_angle(phi); for(i = 0; i < no_atoms; i++) { if((atoms[i].edit == 1) || (rot_subset == 0)) { atom_coords[0] = atoms[i].x; atom_coords[1] = atoms[i].y; atom_coords[2] = atoms[i].z; rotate(atom_coords); atoms[i].x = atom_coords[0]; atoms[i].y = atom_coords[1]; atoms[i].z = atom_coords[2]; } } if (bbox_available) { for (i = 0; i < 8; i++) { rotate (file_bbox.v[i]); } } if(store_g && all_rotated){ /* modify global vectors describing current orientation of frame */ set_rotate_origin(NULL); for(i=0;i<3;i++){ rotate(global_matrix[i]); } } if(!all_rotated){ update_bond_matrix(True); } rotate_vectors(axis, phi); update_bbox (); deactivate_region(); clear_message_area (); canvas_cb(canvas,NULL,NULL); update_lengths_dialog(False); } void rotate_vectors(double *axis, double phi) { void rotate(double *); void set_rotate_axis(double *); void set_rotate_angle(double); void set_rotate_origin(double *); int i, j; set_rotate_axis(axis); set_rotate_angle(phi); set_rotate_origin(NULL); for (i = 0; i < no_atoms; i++) { for (j = 0; j < MAX_VECTORS_PER_ATOM; j++) { if ((atoms[i].has_vector > j) && (atoms[i].edit == 1)) { rotate (atoms[i].v[j]); } } } } /* General purpose routines which rotate a vector relative to some origin about an axis by a certain angle */ /* The relative origin */ static Boolean ignore_rotate_origin = 0; static double rotate_origin[3]; /* Local axis variables */ static double rotate_axis_l[3], rotate_axis_m[3], rotate_axis_n[3]; /* The angle by which the vector will be rotated */ static double rotate_angle, sina, cosa; /* Public routines to set the above static variables */ void set_rotate_origin(double *origin) { if(origin != NULL) { ignore_rotate_origin = 0; rotate_origin[0] = origin[0]; rotate_origin[1] = origin[1]; rotate_origin[2] = origin[2]; } else { ignore_rotate_origin = 1; } } void set_rotate_axis(double *axis) { void normalize_vec(double *); void vector_product(double *, double *, double *); int i; /* Set up local axis frame */ /* rotate_axis_n is parallel to rotate_axis */ for(i = 0; i < 3; i++) { rotate_axis_n[i] = axis[i]; } normalize_vec(rotate_axis_n); /* rotate_axis_l is perpendicular to rotate_axis_n and lies in the 001 plane */ if(fabs(rotate_axis_n[2]) == 1.0) { rotate_axis_l[0] = 1.0; /* Arbitrary */ rotate_axis_l[1] = 0.0; rotate_axis_l[2] = 0.0; } else { rotate_axis_l[0] = rotate_axis_n[1]; rotate_axis_l[1] = -rotate_axis_n[0]; rotate_axis_l[2] = 0.0; } normalize_vec(rotate_axis_l); /* m is perpendicular to l and n */ vector_product(rotate_axis_m, rotate_axis_n, rotate_axis_l); } void set_rotate_angle(double angle) { rotate_angle = angle; sina = sin(rotate_angle); /* sin of angle */ cosa = cos(rotate_angle); /* cos of angle */ } /* The actually function to do the rotation -- pass pointer to a double foo[3] type variable */ void rotate(double *v) { double dot_product(double *, double *); int i; double a, b, c, ap, bp; /* Consider a rotation of vector v about an axis (l, m, n): v = a l + b m + c n --- ie vector in local axis frame rotate about n (local z) by angle p => rotation matrix given by: / cos(phi) sin(phi) 0 \ M = | -sin(phi) cos(phi) 0 | \ 0 0 1 / */ /* If rotate_origin is not NULL move the vector */ if(ignore_rotate_origin == 0) { for(i = 0; i < 3; i++) { v[i] -= rotate_origin[i]; } } /* decompose vector into components parallel to l, m and n which we label a, b and c */ a = dot_product(v, rotate_axis_l); b = dot_product(v, rotate_axis_m); c = dot_product(v, rotate_axis_n); /* Now the rotation about n */ ap = ((a * cosa) + (b * sina)); bp = ((b * cosa) - (a * sina)); /* Work out what new v is */ a = ap; b = bp; for(i = 0; i < 3; i++) { v[i] = ((a * rotate_axis_l[i]) + (b * rotate_axis_m[i]) + (c * rotate_axis_n[i])); } /* If rotate_origin is not NULL move the vector */ if(ignore_rotate_origin == 0) { for(i = 0; i < 3; i++) { v[i] += rotate_origin[i]; } } } xmakemol-5.16/sort.c0000644000175000017500000000243310664010173011336 00000000000000/* Copyright (C) 1998, 1999, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" void sort_atoms(void) { int compare_sorted_atoms(const void *, const void *); if(atoms_sorted==1){ /* don't need to resort */ return; } qsort(sorted_atoms, no_atoms, sizeof(int), compare_sorted_atoms); } int compare_sorted_atoms(const void *p, const void *q) { if( (atoms[*((int *) p)].z - atoms[*((int *) q)].z) > 0.0){ return 1; }else{ return -1; } } xmakemol-5.16/store.c0000644000175000017500000000231610664010173011503 00000000000000/* Copyright (C) 1998, 1999, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" void store_coords(void) { int i; for(i=0;i #include #include #include #include "defs.h" #include "globals.h" /* Function prototypes */ void canvas_cb (Widget, XtPointer, XtPointer); void echo_to_message_area(char *); double mod_of_vec (double *); void rotate_atoms (double *, double, Boolean, Boolean); void echo_to_message_area (char *); int select_atom_internal (Boolean); void store_mouse_coords (void); void translate_atoms (double *); /* When mouse_motion = 1, that means (for the purpose of redrawing) that the system is either being rotated or translated; this is used when View->Outline is selected */ static Boolean mouse_motion = 0; static Position mouse_coord[2]; #define XY_MOUSE_SENSITIVITY 100; #define Z_MOUSE_SENSITIVITY 10; XButtonEvent *bevent; enum mouse_translations { ONE_DOWN, ONE_MOTION, ONE_UP, TWO_DOWN, TWO_MOTION, TWO_UP, THREE_DOWN, THREE_MOTION, THREE_UP, CTRL_ONE_DOWN, CTRL_ONE_MOTION, CTRL_ONE_UP, CTRL_TWO_DOWN, CTRL_TWO_MOTION, CTRL_TWO_UP, CTRL_THREE_DOWN, CTRL_THREE_MOTION, CTRL_THREE_UP, SHIFT_ONE_DOWN, SHIFT_ONE_MOTION, SHIFT_ONE_UP, SHIFT_TWO_DOWN, SHIFT_TWO_MOTION, SHIFT_TWO_UP, SHIFT_THREE_DOWN, SHIFT_THREE_MOTION, SHIFT_THREE_UP } mouse_translation; void track_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void change_frame(int,Boolean,Boolean); void invert_coords(void); void reset_orientation(void); void reset_position(void); void reflect_x(void); void reflect_y(void); void reflect_z(void); int item_no = (int) client_data; switch(item_no){ case 0: echo_to_message_area("Track rotations about local COM"); rotate_about = ROTATE_ABOUT_LOCAL_COM; break; case 1: echo_to_message_area("Track rotations about the origin"); rotate_about = ROTATE_ABOUT_ORIGIN; break; case 2: redraw=1; change_frame(frame_no,False,True); echo_to_message_area("Centre atoms"); break; case 3: redraw=1; reset_orientation(); echo_to_message_area("Resetting orientation"); break; case 4: redraw=1; reset_position(); echo_to_message_area("Resetting position"); break; case 5: reflect_x(); atoms_sorted=0; /* Depths may have changed */ change_frame(frame_no,False,False); echo_to_message_area("x coordinates reflected"); break; case 6: reflect_y(); atoms_sorted=0; /* Depths may have changed */ change_frame(frame_no,False,False); echo_to_message_area("y coordinates reflected"); break; case 7: reflect_z(); atoms_sorted=0; /* Depths may have changed */ change_frame(frame_no,False,False); echo_to_message_area("z coordinates reflected"); break; case 8: invert_coords(); atoms_sorted=0; /* Depths may have changed */ change_frame(frame_no,False,False); echo_to_message_area("Coordinates inverted"); break; } } void track(Widget widget, XEvent *event, String *args, int *num_args) { void motion_start (void); void motion_stop (void); void xy_rotation (void); /* Rotate about vector in XY plane */ void z_rotation (void); /* Rotate about Z */ void select_atom_for_measure (void); void xy_translation (void); /* Translate in XY plane */ void z_translation (void); /* Translate along Z */ void select_atom_for_edit (void); void region_set_start (XButtonEvent *); void region_set_end (XButtonEvent *); void show_invisible_atoms (void); void hide_invisible_atoms (void); void select_atom_for_invis (void); bevent = (XButtonEvent *) event; /* aro - don't do translations if file is not loaded yet */ if(strcmp(current_file_name, "") != 0) { if(*num_args != 1) { XtError ("Wrong number of args!"); } mouse_translation = (enum mouse_translations) atoi (args[0]); switch (mouse_translation) { case ONE_DOWN: motion_start (); break; case ONE_MOTION: xy_rotation (); break; case ONE_UP: motion_stop (); break; case TWO_DOWN: motion_start (); break; case TWO_MOTION: z_rotation (); break; case TWO_UP: motion_stop (); break; case THREE_DOWN: select_atom_for_measure (); break; case THREE_MOTION: break; case THREE_UP: break; case CTRL_ONE_DOWN: motion_start (); break; case CTRL_ONE_MOTION: xy_translation (); break; case CTRL_ONE_UP: motion_stop (); break; case CTRL_TWO_DOWN: motion_start (); break; case CTRL_TWO_MOTION: z_translation (); break; case CTRL_TWO_UP: motion_stop (); break; case CTRL_THREE_DOWN: select_atom_for_edit (); break; case CTRL_THREE_MOTION: break; case CTRL_THREE_UP: break; case SHIFT_ONE_DOWN: region_set_start (bevent); break; case SHIFT_ONE_MOTION: region_set_end (bevent); break; case SHIFT_ONE_UP: break; case SHIFT_TWO_DOWN: show_invisible_atoms (); break; case SHIFT_TWO_MOTION: break; case SHIFT_TWO_UP: hide_invisible_atoms (); break; case SHIFT_THREE_DOWN: select_atom_for_invis (); break; case SHIFT_THREE_MOTION: break; case SHIFT_THREE_UP: break; } } } void store_mouse_coords (void) { /* Store the mouse coordinates */ mouse_coord[0] = bevent->x; mouse_coord[1] = bevent->y; } void motion_start (void) { store_mouse_coords (); mouse_motion = 1; redraw = 1; canvas_cb (canvas, NULL, NULL); } void motion_stop (void) { mouse_motion = 0; redraw = 1; canvas_cb (canvas, NULL, NULL); } void xy_rotation (void) { int i; double axis[3], mod, phi; /* Determine the axis to rotate about */ axis[0] = (double) (mouse_coord[1] - bevent->y); axis[1] = (double) (mouse_coord[0] - bevent->x); axis[2] = 0; mod = mod_of_vec (axis); if (mod == 0) return; for (i = 0; i < 2; i++) /* axis[2] = 0; ignore */ { axis[i] /= mod; } /* Determine the amount of rotation; full canvas_width -> 180 degree rotation */ phi = (double) (PI * mod / canvas_width); atoms_sorted = 0; redraw = 1; rotate_atoms (axis, phi, 1, 1); store_mouse_coords (); } void z_rotation (void) { double axis[3], vector[3], mod, phi; /* Determine the axis to rotate about */ vector[0] = (double) (mouse_coord[0] - bevent->x); vector[1] = (double) (mouse_coord[1] - bevent->y); vector[2] = 0; mod = mod_of_vec (vector); if (mod == 0) return; axis[0] = 0; axis[1] = 0; axis[2] = (vector[0] > 0) ? 1 : -1; /* Direction depends on X motion */ /* Determine the amount of rotation; full canvas_width -> 180 degree rotation */ phi = (double) (PI * mod / canvas_width); atoms_sorted = 0; redraw = 1; rotate_atoms (axis, phi, 1, 1); store_mouse_coords (); } void select_atom_for_measure (void) { void update_selected(int); void clear_message_area (void); char message[64]; int closest; if (no_atoms == 0) return; /* Here, 1 means ignore invisible atoms in the selection process */ closest = select_atom_internal (1); update_selected (closest); if (atoms[closest].sel == 1) { sprintf (message, "Atom %d selected: x = %9.4f, y = %9.4f, z = %9.4f", closest + 1, atoms[closest].x, atoms[closest].y, atoms[closest].z); echo_to_message_area (message); } else { clear_message_area (); } } void xy_translation (void) { int i; double vector[3]; vector[0] = (double) (bevent->x - mouse_coord[0]); vector[1] = (double) -(bevent->y - mouse_coord[1]); /* Y is down (X11) */ vector[2] = 0; for (i = 0; i < 2; i++) /* vector[2] = 0; ignore */ { /* sensitivity should be customizable */ vector[i] /= XY_MOUSE_SENSITIVITY; } translate_atoms (vector); store_mouse_coords (); } void z_translation (void) { double vector[3]; vector[0] = 0; vector[1] = 0; vector[2] = (double) (bevent-> x - mouse_coord[0]); /* sensitivity should be customizable */ vector[2] /= Z_MOUSE_SENSITIVITY; translate_atoms (vector); store_mouse_coords (); } void select_atom_for_edit (void) { int closest; if (no_atoms == 0) return; if (edit_posn_dialog == NULL) { echo_to_message_area ("Edit selections only allowed when Edit->Positions is open"); return; } /* Here, 1 means do ignore invisible atoms in the selection process */ closest = select_atom_internal (1); if (closest == -1) return; if (atoms[closest].edit == 1) { atoms[closest].edit = 0; } else { atoms[closest].edit = 1; } redraw = 1; canvas_cb(canvas, NULL, NULL); } void show_invisible_atoms (void) { view_ghost_atoms = 1; redraw = 1; canvas_cb (canvas, NULL, NULL); view_ghost_atoms = 0; } void hide_invisible_atoms (void) { view_ghost_atoms = 0; redraw = 1; canvas_cb (canvas, NULL, NULL); } void select_atom_for_invis (void) { int count_visible_atoms (void); void update_selected(int); struct frame * get_selected_frame (void); void update_bbox (void); int closest, no_visible_atoms; struct frame *this_frame; if (no_atoms == 0) return; /* Here, 0 means don't ignore invisible atoms in the selection process */ closest = select_atom_internal (0); if (closest == -1) return; this_frame = get_selected_frame (); if (atoms[closest].visi == 1) { atoms[closest].visi = 0; this_frame->atom[closest].visi = 0; } else { atoms[closest].visi = 1; this_frame->atom[closest].visi = 1; } no_visible_atoms = count_visible_atoms (); update_bbox (); redraw = 1; canvas_cb(canvas, NULL, NULL); } /* Function to determine whether we are currently rotating or translating */ Boolean mouse_motion_p (void) { return (mouse_motion); } /* If ignore_invisible is true, we don't care if the atoms are invisible or not */ int select_atom_internal (Boolean ignore_invisible) { void convert_to_canvas_coords(double *, double *, Boolean); int i, closest, first_value_set = 0; double a[3], b[2], dist, dist_keep = 0; closest = -1; for(i = 0; i < no_atoms; i++) { if((atoms[i].visi == True) || (ignore_invisible == False)) { double x, y; a[0] = atoms[i].x; a[1] = atoms[i].y; a[2] = atoms[i].z; convert_to_canvas_coords(a, b, 0); x = (double) (b[0] - bevent->x); y = (double) (b[1] - bevent->y); dist = (x * x) + (y * y); if(first_value_set == 1) { if(dist < dist_keep) { dist_keep = dist; closest = i; } } else { dist_keep = dist; /* Set for the first atom */ closest = i; first_value_set = 1; } } } return (closest); } void update_selected (int closest) { void update_lengths_dialog(Boolean); static int i,j,no_selected; Boolean deselected; if(sel_init == 0){ for(i=0;i<4;i++){ selected[i]=-1; /* set initial values */ } sel_init=1; } /* If selected atom is invisible, deselect */ for(i = 0; i < 4; i++) { if(selected[i] != -1) { if(atoms[selected[i]].visi == 0) { selected[i]=-1; } } } /* find out how many atoms selected */ no_selected=0; for(i=0;i<4;i++){ if(selected[i]==-1){ break; } no_selected++; } /* if closest is already selected, deselect and pack selected */ deselected=0; for(i=0;i<4;i++){ if(selected[i]==closest){ /* deselect and pack */ selected[i]=-1; for(j=i;j<3;j++){ selected[j]=selected[j+1]; } selected[3]=-1; deselected=1; break; } } /* if four atoms already selected, pop the first off the top of the stack (unless already deselected one of them) */ if(!deselected){ if(no_selected==4){ for(i=0;i<3;i++){ selected[i]=selected[i+1]; } selected[3]=closest; }else{ selected[no_selected]=closest; } } for(i=0;i torsion available */ torsion=get_torsion(seli,selj,selk,sell); sprintf(string, "A-B-C-D : %10.4f",torsion); }else{ sprintf(string, "A-B-C-D : "); } label=XmStringCreateLocalized(string); XtVaSetValues(meas_label_w[w], XmNlabelString, label, NULL); } XmStringFree(label); } } void reset_orientation(void) { void change_frame(int, Boolean, Boolean); int i,j; for(i=0;i<3;i++){ for(j=0;j<3;j++){ if(i==j){ global_matrix[i][j]=1; }else{ global_matrix[i][j]=0; } } } /* Atoms will no longer be sorted */ atoms_sorted=0; change_frame(frame_no,False,False); } void reset_position(void) { void change_frame(int, Boolean, Boolean); int i; for(i=0;i<3;i++){ global_vector[i]=0; } change_frame(frame_no,False, False); } void reflect_x (void) { struct frame * get_first_frame (); int i; struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].x *= -1.0; } if (this_frame->bbox_available) { this_frame->bbox[0][0] *= -1.0; this_frame->bbox[0][1] *= -1.0; } this_frame = this_frame->next; } } void reflect_y (void) { struct frame * get_first_frame (); int i; struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].y *= -1.0; } if (this_frame->bbox_available) { this_frame->bbox[1][0] *= -1.0; this_frame->bbox[1][1] *= -1.0; } this_frame = this_frame->next; } } void reflect_z (void) { struct frame * get_first_frame (); int i; struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].z *= -1.0; } if (this_frame->bbox_available) { this_frame->bbox[2][0] *= -1.0; this_frame->bbox[2][1] *= -1.0; } this_frame = this_frame->next; } } void invert_coords (void) { struct frame * get_first_frame (); int i; struct frame *this_frame; this_frame = get_first_frame (); while (this_frame != NULL) { for (i = 0; i < this_frame->no_atoms; i++) { this_frame->atom[i].x *= -1.0; this_frame->atom[i].y *= -1.0; this_frame->atom[i].z *= -1.0; } if (this_frame->bbox_available) { this_frame->bbox[0][0] *= -1.0; this_frame->bbox[0][1] *= -1.0; this_frame->bbox[1][0] *= -1.0; this_frame->bbox[1][1] *= -1.0; this_frame->bbox[2][0] *= -1.0; this_frame->bbox[2][1] *= -1.0; } this_frame = this_frame->next; } } xmakemol-5.16/translate.c0000644000175000017500000000377210664010172012352 00000000000000/* Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" void translate_atoms(double *vec) { void adjust_current_frame(void); void canvas_cb(Widget, XtPointer, XtPointer); void clear_message_area (void); void deactivate_region(void); void update_bbox(void); void update_bond_matrix(Boolean); void update_lengths_dialog(Boolean); int i,all_moved; all_moved=1; for(i = 0; i < no_atoms; i++) { if((atoms[i].edit == 1)) { atoms[i].x += vec[0]; atoms[i].y += vec[1]; atoms[i].z += vec[2]; } else { all_moved = 0; atoms_sorted = 0; /* Depths have changed */ } } if (bbox_available) { for (i = 0; i < 8; i++) { file_bbox.v[i][0] += vec[0]; file_bbox.v[i][1] += vec[1]; file_bbox.v[i][2] += vec[2]; } } if(all_moved){ for(i=0;i<3;i++){ global_vector[i]+=vec[i]; } } update_bbox (); redraw=1; if(!all_moved){ update_bond_matrix(True); } deactivate_region(); clear_message_area(); canvas_cb(canvas,NULL,NULL); update_lengths_dialog(False); } xmakemol-5.16/utils.c0000644000175000017500000001205610664010172011510 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include /* aro */ #include #include "defs.h" #include "globals.h" double mod_of_vec (double *vec) { double mod; mod = sqrt ((vec[0] * vec[0]) + (vec[1] * vec[1]) + (vec[2] * vec[2])); return (mod); } void normalize_vec (double *vec) { double mod; mod = ((vec[0] * vec[0]) + (vec[1] * vec[1]) + (vec[2] * vec[2])); if (mod == 0) return; mod = sqrt (mod); vec[0] /= mod; vec[1] /= mod; vec[2] /= mod; } double dot_product (double *vec_1, double *vec_2) { double product; product = ((vec_1[0] * vec_2[0]) + (vec_1[1] * vec_2[1]) + (vec_1[2] * vec_2[2])); return (product); } void vector_product (double *vec_1, double *vec_2, double *vec_3) { vec_1[0] = (vec_2[1] * vec_3[2]) - (vec_2[2] * vec_3[1]); vec_1[1] = (vec_2[2] * vec_3[0]) - (vec_2[0] * vec_3[2]); vec_1[2] = (vec_2[0] * vec_3[1]) - (vec_2[1] * vec_3[0]); } /* Return the nearest integer --- named to avoid clashes with the sometimes present function, nint */ int xm_nint (double value) { return ((int) (value + 0.5)); } void echo_to_message_area (char *message) { XmString xm_message; xm_message = XmStringCreateLocalized (message); XtVaSetValues (message_area, XmNlabelString, xm_message, NULL); } void clear_message_area (void) { echo_to_message_area (" "); /* Gross */ } void euler_to_matrix (double *angle, double *matrix) { double alpha, beta, gamma; double ca, cb, cg, sa, sb, sg; alpha = angle[0] * DEG2RAD; beta = angle[1] * DEG2RAD; gamma = angle[2] * DEG2RAD; ca = cos (alpha); cb = cos (beta); cg = cos (gamma); sa = sin (alpha); sb = sin (beta); sg = sin (gamma); /* Construct the matrix consisting of the composite rotation of: gamma about Z beta about Y alpha about Z */ matrix[0] = cg*(cb*ca) - sg*sa; matrix[1] = -(sg*(cb*ca)) - cg*sa; matrix[2] = sb*ca; matrix[3] = cg*(cb*sa) + sg*ca; matrix[4] = cg*ca - sg*(cb*sa); matrix[5] = sb*sa; matrix[6] = -(cg*sb); matrix[7] = sg*sb; matrix[8] = cb; } #ifdef SGI_STEREO /* aro - returns current refresh frequency in Hz for SGI machines */ int get_monitor_frequency() { char buf[1024] = ""; char space_tab[] = " \t"; char refresh_rate[10]; char *p; FILE *output; int index; int rounded_refresh; /* redirect stderr so error messages won't go to terminal (the "2>" notation does not work with csh/tcsh, but popen uses '/bin/sh -c' to execute the command, and sh uses this notation */ output = popen("/usr/gfx/gfxinfo 2> /dev/null | grep Hz", "r"); /* Error check */ if(output == NULL) { fprintf(stderr, "Error: popen() failed in get_monitor_frequency()\n"); exit(1); } /* Display line containing display info */ while (fgets(buf, 1024, output) != NULL) { index = strspn(buf, space_tab); strcpy(buf, &buf[index]); /* printf("Line containing display info:\n>> %s", buf); */ } if(strlen(buf) != 0) { p = (char*) strstr(buf, "Hz"); for(index = 0; p[index] != ' '; index--) {/*NOOP*/} if(abs(index) > 10) { fprintf(stderr, "The current refresh rate seems to be abnormally long.\n"); exit(1); } index++; strncpy(refresh_rate, &p[index], abs(index)); refresh_rate[index] = '\0'; } else { fprintf(stderr, "Error: Could not retrieve display refresh rate\n"); exit(1); } p = (char *) strstr(refresh_rate, "."); if(p != NULL) { /* printf("Refresh rate contains decimal, rounding off\n"); */ if(p[1] >= '5') rounded_refresh = atoi(refresh_rate) + 1; else rounded_refresh = atoi(refresh_rate); } else rounded_refresh = atoi(refresh_rate); /* printf("Refresh rate: %dHz\n", rounded_refresh); */ pclose(output); return rounded_refresh; } /* aro - set monitor refresh frequency to freq */ void set_monitor_frequency(int freq) { char string[40]; sprintf(string, "/usr/gfx/setmon -n %d", freq); system(string); } #endif /* SGI_STEREO */ xmakemol-5.16/vectors.c0000644000175000017500000001153310664010171012033 00000000000000/* Copyright (C) 1998, 1999, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __VECTORS_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "defs.h" #include "globals.h" #include "vectors.h" #include "view.h" static double vector_scale = 1.0; static double vector_arrow_angle = 30.0; static double vector_arrow_scale = 0.1; void set_vector_scale (double new_scale) { vector_scale = new_scale; } double get_vector_scale (void) { return (vector_scale); } void set_vector_arrow_angle (double new_angle) { vector_arrow_angle = new_angle; } double get_vector_arrow_angle (void) { return (vector_arrow_angle); } void set_vector_arrow_scale (double new_angle) { vector_arrow_scale = new_angle; } double get_vector_arrow_scale (void) { return (vector_arrow_scale); } /* Anatomy of a vector: e\ | \ \ | \ \ | \ | | \ o-----a-----------------------c-----b | | / / | / / | / | / d/ Notes: (1) The line d-c-e is defined to be perpendicular to both the a-c-b and [001] directions. (2) The angles b-e-c and b-d-c correspond to vec_arrow_angle. (3) The ratio |c-b| / |o-b| corresponds to vec_arrow_scale. */ void update_canvas_vector_points (int si, int j) { void convert_to_canvas_coords(double *, double *, Boolean); double get_atom_scale(void); double get_vector_arrow_angle (void); double get_vector_arrow_scale (void); double get_vector_scale(void); double mod_of_vec(double *); void normalize_vec (double *); double vector_product (double *, double *, double *); double mod, radius, vector_scale, vec_arrow_angle, vec_arrow_scale, t; double vector[3], a[3], b[3], c[3], d[3], e[3], perp[3], z[3]; double xy_temp[2]; vector_scale = get_vector_scale (); if(vector_scale == 0.0) { return; } vector[0] = atoms[si].v[j][0] * vector_scale; vector[1] = atoms[si].v[j][1] * vector_scale; vector[2] = atoms[si].v[j][2] * vector_scale; mod = mod_of_vec (vector); if(atom_flag == 1) { radius = atoms[si].cov_rad * get_atom_scale(); if(radius > mod) { return; } } else { radius = 0.0; } /* Base of vector */ a[0] = atoms[si].x + (radius * vector[0] / mod); a[1] = atoms[si].y + (radius * vector[1] / mod); a[2] = atoms[si].z + (radius * vector[2] / mod); convert_to_canvas_coords(a, xy_temp, 0); canvas_vector_points[0].x = xy_temp[0]; canvas_vector_points[0].y = xy_temp[1]; /* Tip of vector */ b[0] = atoms[si].x + vector[0]; b[1] = atoms[si].y + vector[1]; b[2] = atoms[si].z + vector[2]; convert_to_canvas_coords(b, xy_temp, 0); canvas_vector_points[1].x = xy_temp[0]; canvas_vector_points[1].y = xy_temp[1]; /* Arrow base of vector */ vec_arrow_scale = get_vector_arrow_scale (); c[0] = atoms[si].x + (1.0 - vec_arrow_scale) * vector[0]; c[1] = atoms[si].y + (1.0 - vec_arrow_scale) * vector[1]; c[2] = atoms[si].z + (1.0 - vec_arrow_scale) * vector[2]; convert_to_canvas_coords(c, xy_temp, 0); canvas_vector_points[2].x = xy_temp[0]; canvas_vector_points[2].y = xy_temp[1]; z[0] = 0.0; z[1] = 0.0; z[2] = 1.0; vector_product (perp, vector, z); normalize_vec (perp); vec_arrow_angle = get_vector_arrow_angle (); t = mod * vec_arrow_scale * (sin (vec_arrow_angle * PI / 180.0) / cos (vec_arrow_angle * PI / 180.0)); /* Point d */ d[0] = c[0] + (t * perp[0]); d[1] = c[1] + (t * perp[1]); d[2] = c[2] + (t * perp[2]); convert_to_canvas_coords(d, xy_temp, 0); canvas_vector_points[3].x = xy_temp[0]; canvas_vector_points[3].y = xy_temp[1]; /* Point e */ e[0] = c[0] - (t * perp[0]); e[1] = c[1] - (t * perp[1]); e[2] = c[2] - (t * perp[2]); convert_to_canvas_coords(e, xy_temp, 0); canvas_vector_points[4].x = xy_temp[0]; canvas_vector_points[4].y = xy_temp[1]; } xmakemol-5.16/view.c0000644000175000017500000001123210664010170011313 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define __VIEW_C__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "globals.h" #include "view.h" /* Function prototypes */ void echo_to_message_area(char *); /* Private variables */ static int outline_mode = 0; void view_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); int get_no_bonds (void); int get_no_hbonds (void); void update_bbox(void); int item_no = (int) client_data; char message[128]; switch(item_no){ case 0: if(atom_flag==0){ atom_flag=1; echo_to_message_area("Switching on atoms"); }else{ atom_flag=0; echo_to_message_area("Switching off atoms"); } /* If atoms have been switched, the bounding box may need updating */ if(bbox_flag == 1) { update_bbox(); } break; case 1: if(bond_flag==0){ bond_flag=1; sprintf (message, "Switching on bonds (%d)", get_no_bonds ()); echo_to_message_area (message); }else{ bond_flag=0; echo_to_message_area("Switching off bonds"); } break; case 2: if(hbond_flag==0){ hbond_flag=1; sprintf (message, "Switching on H-bonds (%d)", get_no_hbonds ()); echo_to_message_area (message); }else{ hbond_flag=0; echo_to_message_area("Switching off H-bonds"); } break; case 3: if(vector_flag==0){ vector_flag=1; echo_to_message_area("Switching on vectors"); }else{ vector_flag=0; echo_to_message_area("Switching off vectors"); } break; case 4: if(at_nos_flag==0){ at_nos_flag=1; echo_to_message_area("Switching on numbers"); }else{ at_nos_flag=0; echo_to_message_area("Switching off numbers"); } break; case 5: if(at_sym_flag==0){ at_sym_flag=1; echo_to_message_area("Switching on symbols"); }else{ at_sym_flag=0; echo_to_message_area("Switching off symbols"); } break; case 6: if(axes_flag==0){ axes_flag=1; echo_to_message_area("Switching on axes"); }else{ axes_flag=0; echo_to_message_area("Switching off axes"); } break; case 7: if(bbox_flag==0){ bbox_flag=1; echo_to_message_area("Switching on bounding box"); update_bbox(); }else{ bbox_flag=0; echo_to_message_area("Switching off bounding box"); } break; case 8: if(outline_mode==0){ outline_mode=1; echo_to_message_area("Switching on outline"); }else{ outline_mode=0; echo_to_message_area("Switching off outline"); } break; } redraw=1; canvas_cb(canvas,NULL,NULL); } void centre_atoms(void) { void canvas_cb(Widget, XtPointer, XtPointer); void update_lengths_dialog(Boolean); int i; double com[3],tot_mass; for(i=0;i<3;i++){ com[i]=0; } tot_mass=0; for(i=0;i #include #include #include #include #include #include #include #include /* aro */ #include "defs.h" #include "globals.h" #include "view.h" /* aro - might not be necessary if using mesa+linux */ #ifdef GL #include /* OpenGL drawing area widget */ #endif /* GL */ #ifdef GL #include "gl_funcs.h" #endif /* GL */ void echo_to_message_area(char *); int file_specified = 0; char go_file[1024]; char xmakemol_version[5]; /* aro - made app global so we can have warning dialog in edit.c that does not allow user to continue until he/she responds to dialog */ XtAppContext app; int main(int argc, char **argv) { void set_render_using_gl(Boolean); /* aro */ void canvas_cb(Widget, XtPointer, XtPointer); void canvas_resize_cb(Widget, XtPointer, XtPointer); void canvas_expose_cb(Widget, XtPointer, XtPointer); void get_options(int, char **); void initialize_xmakemol(void); void make_menus(Widget, Widget); void open_file(char *, Boolean); void read_elements_file(void); void read_user_elements_file(void);/* aro */ void reset_any_atoms(void);/* aro */ void cleanup_cb(Widget, XtPointer, XtPointer); /* aro */ char version_string[128]; /* Do modified translations have to come first? Each argument to track corresponds to an enum element (mouse_translations); see track.c */ String translations = "Ctrl: track(9) \n\ Ctrl: track(10) \n\ Ctrl: track(11) \n\ Ctrl: track(12) \n\ Ctrl: track(13) \n\ Ctrl: track(14) \n\ Ctrl: track(15) \n\ Ctrl: track(16) \n\ Ctrl: track(17) \n\ Shift: track(18) \n\ Shift: track(19) \n\ Shift: track(20) \n\ Shift: track(21) \n\ Shift: track(22) \n\ Shift: track(23) \n\ Shift: track(24) \n\ Shift: track(25) \n\ Shift: track(26) \n\ : track(0) \n\ : track(1) \n\ : track(2) \n\ : track(3) \n\ : track(4) \n\ : track(5) \n\ : track(6) \n\ : track(7) \n\ : track(8) \n\ <: frame_key(prev) \n\ >: frame_key(next) \n\ ^: frame_key(start)"; String fallback_resources[] = { "xmakemol*fontList: fixed", "xmakemol*background: dark grey", NULL }; Widget menubar=NULL; Atom wm_delete_window; XtActionProc track(Widget, XEvent *, String *, int *); XtActionProc frame_key(Widget, XEvent *, String *, int *); XtActionsRec actions; /* Set the version */ strcpy (xmakemol_version, VERSION); XtSetLanguageProc (NULL, NULL, NULL); /* Initialize toolkit and parse command line options. */ /* Creates the application context 'app' */ toplevel = XtVaAppInitialize (&app, "XMakemol", NULL, 0, &argc, argv, fallback_resources, NULL); /* If user selects 'close' from window manager, do some cleanup before exiting */ wm_delete_window = XmInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False); XmAddWMProtocolCallback(toplevel, wm_delete_window, cleanup_cb, NULL); /* Check the locale -- this must come after XtVaAppInitialize */ if (setlocale (LC_NUMERIC, "C") == NULL) { printf ("xmakemol: could not set locale (LC_NUMERIC) to C\n"); exit (1); } /* Add the "track" action/function used by the translation table */ actions.string = "track"; actions.proc = (XtActionProc) track; XtAppAddActions (app, &actions, 1); /* Add the "frame_key" action/function used by the translation table */ actions.string = "frame_key"; actions.proc = (XtActionProc) frame_key; XtAppAddActions (app, &actions, 1); /* main window contains a MenuBar and a Label displaying a pixmap */ main_w = XtVaCreateManagedWidget ("main_window", xmMainWindowWidgetClass, toplevel, NULL); /* generate menus */ make_menus(main_w,menubar); get_options(argc,argv); /* set screen properties */ /* aro - changed from using canvas to using toplevel because we need display before we create canvas, as the canvas widget is now glwMDrawingArea instead of xmDrawingArea and it takes visual info during the creation. XtScreen changed similiarly, since it comes before canvas creation. */ screen_ptr=XtScreen(toplevel); display=XtDisplay(toplevel); screen_num=DefaultScreen(display); screen_depth=DefaultDepth(display,screen_num); root_window=RootWindow(display,screen_num); /* aro--> moved */ #ifdef GL glutInit (&argc, argv); visinfo = glXChooseVisual(display, screen_num, gl_attrib); if (!visinfo) { printf ("xmakemol: couldn't get an RGB, Double-buffered visual\n"); exit (1); } #endif /* GL */ /* This returns the drawing area widget (canvas). We parse the translation table here for mouse action on the canvas */ /* aro - if using mesa+linux, may be able to use regular xmDrawingAreaWidgetClass with GL here */ canvas = XtVaCreateManagedWidget ("canvas", #ifdef GL glwMDrawingAreaWidgetClass, #else xmDrawingAreaWidgetClass, #endif /* GL */ main_w, #ifdef GL GLwNvisualInfo, visinfo, #endif /* GL */ XmNtranslations, XtParseTranslationTable(translations), XmNwidth, canvas_width, XmNheight, canvas_height, NULL); /* <--aro moved */ XtAddCallback(canvas, #ifdef GL GLwNresizeCallback, #else XmNresizeCallback, #endif /* GL */ canvas_resize_cb,NULL); XtAddCallback(canvas, #ifdef GL GLwNexposeCallback, #else XmNexposeCallback, #endif /* GL */ canvas_expose_cb,NULL); XtManageChild(canvas); sprintf (version_string, "XMakemol - version %s (see Help->About for non-warranty) ", xmakemol_version); message_area = XtVaCreateManagedWidget (version_string, xmLabelWidgetClass, main_w, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XmMainWindowSetAreas (main_w, menubar, NULL, message_area, NULL, canvas); /* Instantiate the toplevel widget and enter the main event loop. It's all callbacks from here ! */ XtRealizeWidget(toplevel); /* Set up a graphical context (Xlib) */ gcv.background=BlackPixelOfScreen(screen_ptr); gc=XCreateGC(display,XtWindow(canvas),GCBackground,&gcv); XtVaSetValues(canvas,XmNuserData,gc,NULL); #ifdef GL /* For some X11 displays, we can't draw on the canvas_pm due to crashes. Draw on the canvas window instead and use a backing store if available. See also gl_funcs.c */ { int backing_store; unsigned long valuemask; XSetWindowAttributes attributes; backing_store = DoesBackingStore (screen_ptr); if ((backing_store == WhenMapped) || (backing_store == Always)) { attributes.backing_store = Always; valuemask = CWBackingStore; XChangeWindowAttributes (display, XtWindow (canvas), valuemask, &attributes); } } glx_context = glXCreateContext (display, visinfo, NULL, GL_TRUE); canvas_pm = XCreatePixmap (display, XtWindow(canvas), canvas_width, canvas_height, visinfo->depth); glXMakeCurrent (display, XtWindow (canvas), glx_context); #endif /* GL */ initialize_xmakemol(); read_elements_file(); read_user_elements_file();/* aro: read in .xmakemol.elements from users home dir */ reset_any_atoms();/* aro: initialize elements[i].any_atoms to False */ /* On an sgi machine for some reason element[1].any_atoms == 239, before any file was ever read */ if (file_specified == 1) { /* aro: If file specified on command line, update current_file_name so proper name will appear in print dialog */ strcpy (current_file_name, go_file); open_file (go_file, FALSE); } XtAppMainLoop(app); return(0); } void get_options(int argc, char **argv) { char opt_list[16]; int c, errflg = 0; extern char *optarg; Widget widget; #ifdef GL strcpy (opt_list, "abhc:e:f:Guv"); /* extra -G option */ #else /* GL */ strcpy (opt_list, "abhc:e:f:uv"); #endif while ((c = getopt (argc, argv, opt_list)) != EOF) { switch(c) { case 'a': atom_flag=0; if((widget = XtNameToWidget(nth_menu[4], "button_0"))) XtVaSetValues(widget, XmNset, False, NULL); break; case 'b': bond_flag=0; if((widget = XtNameToWidget(nth_menu[4], "button_1"))) XtVaSetValues(widget, XmNset, False, NULL); break; case 'h': hbond_flag=0; if((widget = XtNameToWidget(nth_menu[4], "button_2"))) XtVaSetValues(widget, XmNset, False, NULL); break; case 'c': strcpy(bg_color,optarg); break; case 'e': strcpy(bb_color,optarg); break; case 'f': file_specified = 1; if (strcmp (optarg, "-") != 0) { strcpy (go_file, optarg); } else { /* Surely, noone will call a file by this name. */ strcpy (go_file, ""); } break; #ifdef GL case 'G': { void set_render_using_gl (Boolean); set_render_using_gl (False); } break; #endif /* GL */ case 'u': fprintf(stderr, "Usage: xmakemol [options]\n"); fprintf(stderr, " -a Switch off atoms\n"); fprintf(stderr, " -b Switch off bonds\n"); fprintf(stderr, " -h Switch off hydrogen bonds\n"); fprintf(stderr, " -c Set the canvas colour\n"); fprintf(stderr, " -e Set the bounding box colour\n"); fprintf(stderr, " -f Read file on startup (use '-f -' for STDIN)\n"); #ifdef GL fprintf(stderr, " -G Switch off GL rendering\n"); #endif /* GL */ fprintf(stderr, " -u Print usage information\n"); fprintf(stderr, " -v Print version information\n"); exit(2); break; case 'v': fprintf(stderr, "XMakemol version %s.\n", xmakemol_version); fprintf(stderr, "Copyright (C) 2007 Matthew P. Hodges.\n"); fprintf(stderr, "XMakemol comes with ABSOLUTELY NO WARRANTY.\n"); fprintf(stderr, "You may redistribute copies of XMakemol\n"); fprintf(stderr, "under the terms of the GNU General Public License.\n"); fprintf(stderr, "For more information about these matters, see the file named COPYING.\n"); exit(2); break; case '?': errflg++; } } if(errflg != 0) { fprintf(stderr, "See xmakemol usage with \"xmakemol -u\"\n"); exit(2); } } void canvas_expose_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); XmDrawingAreaCallbackStruct *dacs = (XmDrawingAreaCallbackStruct *) call_data; XExposeEvent *event = (XExposeEvent *) dacs->event; if (! event->count) { redraw = 1; canvas_cb (canvas, NULL, NULL); } } void canvas_resize_cb(Widget widget, XtPointer client_data, XtPointer call_data) { void canvas_cb(Widget, XtPointer, XtPointer); #ifdef XPM void disable_show_logo(void); #endif #ifdef SGI_STEREO /* cut enum render_stereo_types get_gl_render_stereo(); */ #endif /* SGI_STEREO */ char string[100]; if(!XtIsRealized(canvas)){ return; } #ifdef XPM disable_show_logo(); /* Don't show after a resize event */ #endif XtVaGetValues(canvas,XmNwidth,&canvas_width,NULL); XtVaGetValues(canvas,XmNheight,&canvas_height,NULL); #ifdef SGI_STEREO /*cut if(get_gl_render_stereo()!=SGI_HARDWARE){ */ #endif /* SGI_STEREO */ /* destroy old pixmap and make new */ if(canvas_pm){ XFreePixmap(display,canvas_pm); } canvas_pm=XCreatePixmap (display, XtWindow (canvas), canvas_width, canvas_height, #ifdef GL visinfo->depth #else /* GL */ screen_depth #endif /* GL */ ); #ifdef GL glViewport (0, 0, canvas_width, canvas_height); #endif /* GL */ sprintf(string,"Resized to %d x %d",(int)canvas_width,(int)canvas_height); #ifdef SGI_STEREO /*cut }else{ */ /* destroy old pixmap and make new */ /* cut if(canvas_pm){ XFreePixmap(display,canvas_pm); } canvas_pm=XCreatePixmap (display,XtWindow(canvas),canvas_width,canvas_height,visinfo->depth); glViewport (0, 0, canvas_width, canvas_height); sprintf(string,"Resized to %d x %d (SGI Crystaleyes Mode)", (int)canvas_width,(int)canvas_height); } */ #endif /* SGI_STEREO */ redraw=1; canvas_cb(canvas,NULL,NULL); echo_to_message_area(string); } void initialize_xmakemol(void) { /* Set variables so that if file not loaded, things behave correctly. */ int i; for(i=0;i<4;i++){ selected[i]=-1; } sel_init=0; /* remove any selections */ } void cleanup_cb(Widget widget, XtPointer client_data, XtPointer call_data) { /* do cleanup before exiting here */ #ifdef SGI_STEREO void set_gl_render_stereo(enum render_stereo_types); set_gl_render_stereo(NO_STEREO); #endif /* SGI_STEREO */ exit (0); } void place_dialog_cb (Widget widget, XtPointer client_data, XtPointer call_data) { Dimension pw, w, wmdw, ws; Position px, x; XtVaGetValues (main_w, XmNwidth, &pw, XmNx, &px, NULL); XtVaGetValues (widget, XmNwidth, &w, NULL); /* Window manager decoration widths */ wmdw = 10; ws = WidthOfScreen (XtScreen (widget)); if ((px + pw + w + (3 * wmdw)) < ws) { /* Place to right of main window */ x = px + (pw + (2 * wmdw)); } else if (px > (w + (3 * wmdw))) { /* Place to left of main window */ x = px - (w + (2 * wmdw)); } else { /* Place as far right as possible */ x = ws - (w + (2 * wmdw)); } /* NB: the WM can subvert this, rendering this useless */ XtVaSetValues (widget, XmNx, x, NULL); } xmakemol-5.16/gl2ps.c0000644000175000017500000054230710664005720011411 00000000000000/* $Id: gl2ps.c,v 1.10 2007/08/25 11:00:32 MPHodges Exp $ */ /* * GL2PS, an OpenGL to PostScript Printing Library * Copyright (C) 1999-2006 Christophe Geuzaine * * This program is free software; you can redistribute it and/or * modify it under the terms of either: * * a) the GNU Library General Public License as published by the Free * Software Foundation, either version 2 of the License, or (at your * option) any later version; or * * b) the GL2PS License as published by Christophe Geuzaine, 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 either * the GNU Library General Public License or the GL2PS License for * more details. * * You should have received a copy of the GNU Library General Public * License along with this library in the file named "COPYING.LGPL"; * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * * You should have received a copy of the GL2PS License with this * library in the file named "COPYING.GL2PS"; if not, I will be glad * to provide one. * * Contributors: * Michael Sweet * Marc Ume * Jean-Francois Remacle * Bart Kaptein * Quy Nguyen-Dai * Sam Buss * Shane Hill * Romain Boman * Rouben Rostamian * Diego Santa Cruz * Shahzad Muzaffar * Lassi Tuura * Guy Barrand * Prabhu Ramachandran * Micha Bieber * Olivier Couet * Shai Ayal * Fabian Wenzel * Ian D. Gay * Cosmin Truta * Baiju Devani * Alexander Danilov * * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. * Please report all bugs and problems to . */ #ifdef HAVE_CONFIG_H /* XMakemol */ #include "config.h" #endif #ifdef GL /* XMakemol */ #include "gl2ps.h" #include #include #include #include #include #include #if defined(GL2PS_HAVE_ZLIB) #include #endif #if defined(GL2PS_HAVE_LIBPNG) #include #endif /********************************************************************* * * Private definitions, data structures and prototypes * *********************************************************************/ /* Magic numbers (assuming that the order of magnitude of window coordinates is 10^3) */ #define GL2PS_EPSILON 5.0e-3F #define GL2PS_ZSCALE 1000.0F #define GL2PS_ZOFFSET 5.0e-2F #define GL2PS_ZOFFSET_LARGE 20.0F #define GL2PS_ZERO(arg) (fabs(arg) < 1.e-20) /* Primitive types */ #define GL2PS_NO_TYPE -1 #define GL2PS_TEXT 1 #define GL2PS_POINT 2 #define GL2PS_LINE 3 #define GL2PS_QUADRANGLE 4 #define GL2PS_TRIANGLE 5 #define GL2PS_PIXMAP 6 #define GL2PS_IMAGEMAP 7 #define GL2PS_IMAGEMAP_WRITTEN 8 #define GL2PS_IMAGEMAP_VISIBLE 9 #define GL2PS_SPECIAL 10 /* BSP tree primitive comparison */ #define GL2PS_COINCIDENT 1 #define GL2PS_IN_FRONT_OF 2 #define GL2PS_IN_BACK_OF 3 #define GL2PS_SPANNING 4 /* 2D BSP tree primitive comparison */ #define GL2PS_POINT_COINCIDENT 0 #define GL2PS_POINT_INFRONT 1 #define GL2PS_POINT_BACK 2 /* Internal feedback buffer pass-through tokens */ #define GL2PS_BEGIN_OFFSET_TOKEN 1 #define GL2PS_END_OFFSET_TOKEN 2 #define GL2PS_BEGIN_BOUNDARY_TOKEN 3 #define GL2PS_END_BOUNDARY_TOKEN 4 #define GL2PS_BEGIN_STIPPLE_TOKEN 5 #define GL2PS_END_STIPPLE_TOKEN 6 #define GL2PS_POINT_SIZE_TOKEN 7 #define GL2PS_LINE_WIDTH_TOKEN 8 #define GL2PS_BEGIN_BLEND_TOKEN 9 #define GL2PS_END_BLEND_TOKEN 10 #define GL2PS_SRC_BLEND_TOKEN 11 #define GL2PS_DST_BLEND_TOKEN 12 #define GL2PS_IMAGEMAP_TOKEN 13 #define GL2PS_DRAW_PIXELS_TOKEN 14 #define GL2PS_TEXT_TOKEN 15 typedef enum { T_UNDEFINED = -1, T_CONST_COLOR = 1, T_VAR_COLOR = 1<<1, T_ALPHA_1 = 1<<2, T_ALPHA_LESS_1 = 1<<3, T_VAR_ALPHA = 1<<4 } GL2PS_TRIANGLE_PROPERTY; typedef GLfloat GL2PSxyz[3]; typedef GLfloat GL2PSplane[4]; typedef struct _GL2PSbsptree2d GL2PSbsptree2d; struct _GL2PSbsptree2d { GL2PSplane plane; GL2PSbsptree2d *front, *back; }; typedef struct { GLint nmax, size, incr, n; char *array; } GL2PSlist; typedef struct _GL2PSbsptree GL2PSbsptree; struct _GL2PSbsptree { GL2PSplane plane; GL2PSlist *primitives; GL2PSbsptree *front, *back; }; typedef struct { GL2PSxyz xyz; GL2PSrgba rgba; } GL2PSvertex; typedef struct { GL2PSvertex vertex[3]; int prop; } GL2PStriangle; typedef struct { GLshort fontsize; char *str, *fontname; /* Note: for a 'special' string, 'alignment' holds the format (PostScript, PDF, etc.) of the special string */ GLint alignment; GLfloat angle; } GL2PSstring; typedef struct { GLsizei width, height; /* Note: for an imagemap, 'type' indicates if it has already been written to the file or not, and 'format' indicates if it is visible or not */ GLenum format, type; GLfloat *pixels; } GL2PSimage; typedef struct _GL2PSimagemap GL2PSimagemap; struct _GL2PSimagemap { GL2PSimage *image; GL2PSimagemap *next; }; typedef struct { GLshort type, numverts; GLushort pattern; char boundary, offset, culled; GLint factor; GLfloat width; GL2PSvertex *verts; union { GL2PSstring *text; GL2PSimage *image; } data; } GL2PSprimitive; typedef struct { #if defined(GL2PS_HAVE_ZLIB) Bytef *dest, *src, *start; uLongf destLen, srcLen; #else int dummy; #endif } GL2PScompress; typedef struct{ GL2PSlist* ptrlist; int gsno, fontno, imno, shno, maskshno, trgroupno; int gsobjno, fontobjno, imobjno, shobjno, maskshobjno, trgroupobjno; } GL2PSpdfgroup; typedef struct { /* General */ GLint format, sort, options, colorsize, colormode, buffersize; char *title, *producer, *filename; GLboolean boundary, blending; GLfloat *feedback, offset[2], lastlinewidth; GLint viewport[4], blendfunc[2], lastfactor; GL2PSrgba *colormap, lastrgba, threshold, bgcolor; GLushort lastpattern; GL2PSvertex lastvertex; GL2PSlist *primitives, *auxprimitives; FILE *stream; GL2PScompress *compress; GLboolean header; /* BSP-specific */ GLint maxbestroot; /* Occlusion culling-specific */ GLboolean zerosurfacearea; GL2PSbsptree2d *imagetree; GL2PSprimitive *primitivetoadd; /* PDF-specific */ int streamlength; GL2PSlist *pdfprimlist, *pdfgrouplist; int *xreflist; int objects_stack; /* available objects */ int extgs_stack; /* graphics state object number */ int font_stack; /* font object number */ int im_stack; /* image object number */ int trgroupobjects_stack; /* xobject numbers */ int shader_stack; /* shader object numbers */ int mshader_stack; /* mask shader object numbers */ /* for image map list */ GL2PSimagemap *imagemap_head; GL2PSimagemap *imagemap_tail; } GL2PScontext; typedef struct { void (*printHeader)(void); void (*printFooter)(void); void (*beginViewport)(GLint viewport[4]); GLint (*endViewport)(void); void (*printPrimitive)(void *data); void (*printFinalPrimitive)(void); const char *file_extension; const char *description; } GL2PSbackend; /* The gl2ps context. gl2ps is not thread safe (we should create a local GL2PScontext during gl2psBeginPage) */ static GL2PScontext *gl2ps = NULL; /* Need to forward-declare this one */ static GLint gl2psPrintPrimitives(void); /********************************************************************* * * Utility routines * *********************************************************************/ static void gl2psMsg(GLint level, const char *fmt, ...) { va_list args; if(!(gl2ps->options & GL2PS_SILENT)){ switch(level){ case GL2PS_INFO : fprintf(stderr, "GL2PS info: "); break; case GL2PS_WARNING : fprintf(stderr, "GL2PS warning: "); break; case GL2PS_ERROR : fprintf(stderr, "GL2PS error: "); break; } va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } /* if(level == GL2PS_ERROR) exit(1); */ } static void *gl2psMalloc(size_t size) { void *ptr; if(!size) return(NULL); ptr = malloc(size); if(!ptr){ gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory"); exit(1); } return(ptr); } static void *gl2psRealloc(void *ptr, size_t size) { if(!size) return(NULL); ptr = realloc(ptr, size); if(!ptr){ gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory"); exit(1); } return(ptr); } static void gl2psFree(void *ptr) { if(!ptr) return; free(ptr); } static size_t gl2psWriteBigEndian(unsigned long data, size_t bytes) { size_t i; size_t size = sizeof(unsigned long); for(i = 1; i <= bytes; ++i){ fputc(0xff & (data >> (size-i) * 8), gl2ps->stream); } return bytes; } /* zlib compression helper routines */ #if defined(GL2PS_HAVE_ZLIB) static void gl2psSetupCompress(void) { gl2ps->compress = (GL2PScompress*)gl2psMalloc(sizeof(GL2PScompress)); gl2ps->compress->src = NULL; gl2ps->compress->start = NULL; gl2ps->compress->dest = NULL; gl2ps->compress->srcLen = 0; gl2ps->compress->destLen = 0; } static void gl2psFreeCompress(void) { if(!gl2ps->compress) return; gl2psFree(gl2ps->compress->start); gl2psFree(gl2ps->compress->dest); gl2ps->compress->src = NULL; gl2ps->compress->start = NULL; gl2ps->compress->dest = NULL; gl2ps->compress->srcLen = 0; gl2ps->compress->destLen = 0; } static int gl2psAllocCompress(unsigned int srcsize) { gl2psFreeCompress(); if(!gl2ps->compress || !srcsize) return GL2PS_ERROR; gl2ps->compress->srcLen = srcsize; gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); gl2ps->compress->src = (Bytef*)gl2psMalloc(gl2ps->compress->srcLen); gl2ps->compress->start = gl2ps->compress->src; gl2ps->compress->dest = (Bytef*)gl2psMalloc(gl2ps->compress->destLen); return GL2PS_SUCCESS; } static void *gl2psReallocCompress(unsigned int srcsize) { if(!gl2ps->compress || !srcsize) return NULL; if(srcsize < gl2ps->compress->srcLen) return gl2ps->compress->start; gl2ps->compress->srcLen = srcsize; gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); gl2ps->compress->src = (Bytef*)gl2psRealloc(gl2ps->compress->src, gl2ps->compress->srcLen); gl2ps->compress->start = gl2ps->compress->src; gl2ps->compress->dest = (Bytef*)gl2psRealloc(gl2ps->compress->dest, gl2ps->compress->destLen); return gl2ps->compress->start; } static size_t gl2psWriteBigEndianCompress(unsigned long data, size_t bytes) { size_t i; size_t size = sizeof(unsigned long); for(i = 1; i <= bytes; ++i){ *gl2ps->compress->src = (Bytef)(0xff & (data >> (size-i) * 8)); ++gl2ps->compress->src; } return bytes; } static int gl2psDeflate(void) { /* For compatibility with older zlib versions, we use compress(...) instead of compress2(..., Z_BEST_COMPRESSION) */ return compress(gl2ps->compress->dest, &gl2ps->compress->destLen, gl2ps->compress->start, gl2ps->compress->srcLen); } #endif static int gl2psPrintf(const char* fmt, ...) { int ret; va_list args; #if defined(GL2PS_HAVE_ZLIB) unsigned int oldsize = 0; static char buf[1000]; if(gl2ps->options & GL2PS_COMPRESS){ va_start(args, fmt); ret = vsprintf(buf, fmt, args); va_end(args); oldsize = gl2ps->compress->srcLen; gl2ps->compress->start = (Bytef*)gl2psReallocCompress(oldsize + ret); memcpy(gl2ps->compress->start+oldsize, buf, ret); ret = 0; } else{ #endif va_start(args, fmt); ret = vfprintf(gl2ps->stream, fmt, args); va_end(args); #if defined(GL2PS_HAVE_ZLIB) } #endif return ret; } static void gl2psPrintGzipHeader() { #if defined(GL2PS_HAVE_ZLIB) char tmp[10] = {'\x1f', '\x8b', /* magic numbers: 0x1f, 0x8b */ 8, /* compression method: Z_DEFLATED */ 0, /* flags */ 0, 0, 0, 0, /* time */ 2, /* extra flags: max compression */ '\x03'}; /* OS code: 0x03 (Unix) */ if(gl2ps->options & GL2PS_COMPRESS){ gl2psSetupCompress(); /* add the gzip file header */ fwrite(tmp, 10, 1, gl2ps->stream); } #endif } static void gl2psPrintGzipFooter() { #if defined(GL2PS_HAVE_ZLIB) int n; uLong crc, len; char tmp[8]; if(gl2ps->options & GL2PS_COMPRESS){ if(Z_OK != gl2psDeflate()){ gl2psMsg(GL2PS_ERROR, "Zlib deflate error"); } else{ /* determine the length of the header in the zlib stream */ n = 2; /* CMF+FLG */ if(gl2ps->compress->dest[1] & (1<<5)){ n += 4; /* DICTID */ } /* write the data, without the zlib header and footer */ fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), 1, gl2ps->stream); /* add the gzip file footer */ crc = crc32(0L, gl2ps->compress->start, gl2ps->compress->srcLen); for(n = 0; n < 4; ++n){ tmp[n] = (char)(crc & 0xff); crc >>= 8; } len = gl2ps->compress->srcLen; for(n = 4; n < 8; ++n){ tmp[n] = (char)(len & 0xff); len >>= 8; } fwrite(tmp, 8, 1, gl2ps->stream); } gl2psFreeCompress(); gl2psFree(gl2ps->compress); gl2ps->compress = NULL; } #endif } /* The list handling routines */ static void gl2psListRealloc(GL2PSlist *list, GLint n) { if(!list){ gl2psMsg(GL2PS_ERROR, "Cannot reallocate NULL list"); return; } if(n <= 0) return; if(!list->array){ list->nmax = n; list->array = (char*)gl2psMalloc(list->nmax * list->size); } else{ if(n > list->nmax){ list->nmax = ((n - 1) / list->incr + 1) * list->incr; list->array = (char*)gl2psRealloc(list->array, list->nmax * list->size); } } } static GL2PSlist *gl2psListCreate(GLint n, GLint incr, GLint size) { GL2PSlist *list; if(n < 0) n = 0; if(incr <= 0) incr = 1; list = (GL2PSlist*)gl2psMalloc(sizeof(GL2PSlist)); list->nmax = 0; list->incr = incr; list->size = size; list->n = 0; list->array = NULL; gl2psListRealloc(list, n); return(list); } static void gl2psListReset(GL2PSlist *list) { if(!list) return; list->n = 0; } static void gl2psListDelete(GL2PSlist *list) { if(!list) return; gl2psFree(list->array); gl2psFree(list); } static void gl2psListAdd(GL2PSlist *list, void *data) { if(!list){ gl2psMsg(GL2PS_ERROR, "Cannot add into unallocated list"); return; } list->n++; gl2psListRealloc(list, list->n); memcpy(&list->array[(list->n - 1) * list->size], data, list->size); } static int gl2psListNbr(GL2PSlist *list) { if(!list) return 0; return(list->n); } static void *gl2psListPointer(GL2PSlist *list, GLint index) { if(!list){ gl2psMsg(GL2PS_ERROR, "Cannot point into unallocated list"); return NULL; } if((index < 0) || (index >= list->n)){ gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListPointer"); return NULL; } return(&list->array[index * list->size]); } static void gl2psListSort(GL2PSlist *list, int (*fcmp)(const void *a, const void *b)) { if(!list) return; qsort(list->array, list->n, list->size, fcmp); } static void gl2psListAction(GL2PSlist *list, void (*action)(void *data)) { GLint i; for(i = 0; i < gl2psListNbr(list); i++){ (*action)(gl2psListPointer(list, i)); } } static void gl2psListActionInverse(GL2PSlist *list, void (*action)(void *data)) { GLint i; for(i = gl2psListNbr(list); i > 0; i--){ (*action)(gl2psListPointer(list, i-1)); } } #if defined(GL2PS_HAVE_LIBPNG) static void gl2psListRead(GL2PSlist *list, int index, void *data) { if((index < 0) || (index >= list->n)) gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListRead"); memcpy(data, &list->array[index * list->size], list->size); } static void gl2psEncodeBase64Block(unsigned char in[3], unsigned char out[4], int len) { static const char cb64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; out[0] = cb64[ in[0] >> 2 ]; out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; out[2] = (len > 1) ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='; out[3] = (len > 2) ? cb64[ in[2] & 0x3f ] : '='; } static void gl2psListEncodeBase64(GL2PSlist *list) { unsigned char *buffer, in[3], out[4]; int i, n, index, len; n = list->n * list->size; buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned char)); memcpy(buffer, list->array, n * sizeof(unsigned char)); gl2psListReset(list); index = 0; while(index < n) { len = 0; for(i = 0; i < 3; i++) { if(index < n){ in[i] = buffer[index]; len++; } else{ in[i] = 0; } index++; } if(len) { gl2psEncodeBase64Block(in, out, len); for(i = 0; i < 4; i++) gl2psListAdd(list, &out[i]); } } gl2psFree(buffer); } #endif /* Helpers for rgba colors */ static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2) { if(!GL2PS_ZERO(rgba1[0] - rgba2[0]) || !GL2PS_ZERO(rgba1[1] - rgba2[1]) || !GL2PS_ZERO(rgba1[2] - rgba2[2])) return GL_FALSE; return GL_TRUE; } static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim) { int i; for(i = 1; i < prim->numverts; i++){ if(!gl2psSameColor(prim->verts[0].rgba, prim->verts[i].rgba)){ return GL_FALSE; } } return GL_TRUE; } static GLboolean gl2psSameColorThreshold(int n, GL2PSrgba rgba[], GL2PSrgba threshold) { int i; if(n < 2) return GL_TRUE; for(i = 1; i < n; i++){ if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] || fabs(rgba[0][1] - rgba[i][1]) > threshold[1] || fabs(rgba[0][2] - rgba[i][2]) > threshold[2]) return GL_FALSE; } return GL_TRUE; } static void gl2psSetLastColor(GL2PSrgba rgba) { int i; for(i = 0; i < 3; ++i){ gl2ps->lastrgba[i] = rgba[i]; } } static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, GLfloat *red, GLfloat *green, GLfloat *blue) { GLsizei width = im->width; GLsizei height = im->height; GLfloat *pixels = im->pixels; GLfloat *pimag; /* OpenGL image is from down to up, PS image is up to down */ switch(im->format){ case GL_RGBA: pimag = pixels + 4 * (width * (height - 1 - y) + x); break; case GL_RGB: default: pimag = pixels + 3 * (width * (height - 1 - y) + x); break; } *red = *pimag; pimag++; *green = *pimag; pimag++; *blue = *pimag; pimag++; return (im->format == GL_RGBA) ? *pimag : 1.0F; } /* Helper routines for pixmaps */ static GL2PSimage *gl2psCopyPixmap(GL2PSimage *im) { int size; GL2PSimage *image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); image->width = im->width; image->height = im->height; image->format = im->format; image->type = im->type; switch(image->format){ case GL_RGBA: size = image->height * image->width * 4 * sizeof(GLfloat); break; case GL_RGB: default: size = image->height * image->width * 3 * sizeof(GLfloat); break; } image->pixels = (GLfloat*)gl2psMalloc(size); memcpy(image->pixels, im->pixels, size); return image; } static void gl2psFreePixmap(GL2PSimage *im) { if(!im) return; gl2psFree(im->pixels); gl2psFree(im); } #if defined(GL2PS_HAVE_LIBPNG) #if !defined(png_jmpbuf) # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) #endif static void gl2psUserWritePNG(png_structp png_ptr, png_bytep data, png_size_t length) { unsigned int i; GL2PSlist *png = (GL2PSlist*)png_get_io_ptr(png_ptr); for(i = 0; i < length; i++) gl2psListAdd(png, &data[i]); } static void gl2psUserFlushPNG(png_structp png_ptr) { } static void gl2psConvertPixmapToPNG(GL2PSimage *pixmap, GL2PSlist *png) { png_structp png_ptr; png_infop info_ptr; unsigned char *row_data; GLfloat dr, dg, db; int row, col; if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) return; if(!(info_ptr = png_create_info_struct(png_ptr))){ png_destroy_write_struct(&png_ptr, NULL); return; } if(setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); return; } png_set_write_fn(png_ptr, (void *)png, gl2psUserWritePNG, gl2psUserFlushPNG); png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION); png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); png_write_info(png_ptr, info_ptr); row_data = (unsigned char*)gl2psMalloc(3 * pixmap->width * sizeof(unsigned char)); for(row = 0; row < pixmap->height; row++){ for(col = 0; col < pixmap->width; col++){ gl2psGetRGB(pixmap, col, row, &dr, &dg, &db); row_data[3*col] = (unsigned char)(255. * dr); row_data[3*col+1] = (unsigned char)(255. * dg); row_data[3*col+2] = (unsigned char)(255. * db); } png_write_row(png_ptr, (png_bytep)row_data); } gl2psFree(row_data); png_write_end(png_ptr, info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr); } #endif /* Helper routines for text strings */ static GLint gl2psAddText(GLint type, const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle) { GLfloat pos[4]; GL2PSprimitive *prim; GLboolean valid; if(!gl2ps || !str || !fontname) return GL2PS_UNINITIALIZED; if(gl2ps->options & GL2PS_NO_TEXT) return GL2PS_SUCCESS; glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid); if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */ glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = type; prim->boundary = 0; prim->numverts = 1; prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); prim->verts[0].xyz[0] = pos[0]; prim->verts[0].xyz[1] = pos[1]; prim->verts[0].xyz[2] = pos[2]; prim->culled = 0; prim->offset = 0; prim->pattern = 0; prim->factor = 0; prim->width = 1; glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); prim->data.text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); prim->data.text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char)); strcpy(prim->data.text->str, str); prim->data.text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char)); strcpy(prim->data.text->fontname, fontname); prim->data.text->fontsize = fontsize; prim->data.text->alignment = alignment; prim->data.text->angle = angle; gl2psListAdd(gl2ps->auxprimitives, &prim); glPassThrough(GL2PS_TEXT_TOKEN); return GL2PS_SUCCESS; } static GL2PSstring *gl2psCopyText(GL2PSstring *t) { GL2PSstring *text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); text->str = (char*)gl2psMalloc((strlen(t->str)+1)*sizeof(char)); strcpy(text->str, t->str); text->fontname = (char*)gl2psMalloc((strlen(t->fontname)+1)*sizeof(char)); strcpy(text->fontname, t->fontname); text->fontsize = t->fontsize; text->alignment = t->alignment; text->angle = t->angle; return text; } static void gl2psFreeText(GL2PSstring *text) { if(!text) return; gl2psFree(text->str); gl2psFree(text->fontname); gl2psFree(text); } /* Helpers for blending modes */ static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor) { /* returns TRUE if gl2ps supports the argument combination: only two blending modes have been implemented so far */ if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || (sfactor == GL_ONE && dfactor == GL_ZERO) ) return GL_TRUE; return GL_FALSE; } static void gl2psAdaptVertexForBlending(GL2PSvertex *v) { /* Transforms vertex depending on the actual blending function - currently the vertex v is considered as source vertex and his alpha value is changed to 1.0 if source blending GL_ONE is active. This might be extended in the future */ if(!v || !gl2ps) return; if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ v->rgba[3] = 1.0F; return; } switch(gl2ps->blendfunc[0]){ case GL_ONE: v->rgba[3] = 1.0F; break; default: break; } } static void gl2psAssignTriangleProperties(GL2PStriangle *t) { /* int i; */ t->prop = T_VAR_COLOR; /* Uncommenting the following lines activates an even more fine grained distinction between triangle types - please don't delete, a remarkable amount of PDF handling code inside this file depends on it if activated */ /* t->prop = T_CONST_COLOR; for(i = 0; i < 3; ++i){ if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){ t->prop = T_VAR_COLOR; break; } } */ if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){ t->prop |= T_VAR_ALPHA; } else{ if(t->vertex[0].rgba[3] < 1) t->prop |= T_ALPHA_LESS_1; else t->prop |= T_ALPHA_1; } } static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p, GLboolean assignprops) { t->vertex[0] = p->verts[0]; t->vertex[1] = p->verts[1]; t->vertex[2] = p->verts[2]; if(GL_TRUE == assignprops) gl2psAssignTriangleProperties(t); } static void gl2psInitTriangle(GL2PStriangle *t) { int i; GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} }; for(i = 0; i < 3; i++) t->vertex[i] = vertex; t->prop = T_UNDEFINED; } /* Miscellaneous helper routines */ static GL2PSprimitive *gl2psCopyPrimitive(GL2PSprimitive *p) { GL2PSprimitive *prim; if(!p){ gl2psMsg(GL2PS_ERROR, "Trying to copy an empty primitive"); return NULL; } prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = p->type; prim->numverts = p->numverts; prim->boundary = p->boundary; prim->offset = p->offset; prim->pattern = p->pattern; prim->factor = p->factor; prim->culled = p->culled; prim->width = p->width; prim->verts = (GL2PSvertex*)gl2psMalloc(p->numverts*sizeof(GL2PSvertex)); memcpy(prim->verts, p->verts, p->numverts * sizeof(GL2PSvertex)); switch(prim->type){ case GL2PS_PIXMAP : prim->data.image = gl2psCopyPixmap(p->data.image); break; case GL2PS_TEXT : case GL2PS_SPECIAL : prim->data.text = gl2psCopyText(p->data.text); break; default: break; } return prim; } static GLboolean gl2psSamePosition(GL2PSxyz p1, GL2PSxyz p2) { if(!GL2PS_ZERO(p1[0] - p2[0]) || !GL2PS_ZERO(p1[1] - p2[1]) || !GL2PS_ZERO(p1[2] - p2[2])) return GL_FALSE; return GL_TRUE; } /********************************************************************* * * 3D sorting routines * *********************************************************************/ static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane) { return(plane[0] * point[0] + plane[1] * point[1] + plane[2] * point[2] + plane[3]); } static GLfloat gl2psPsca(GLfloat *a, GLfloat *b) { return(a[0]*b[0] + a[1]*b[1] + a[2]*b[2]); } static void gl2psPvec(GLfloat *a, GLfloat *b, GLfloat *c) { c[0] = a[1]*b[2] - a[2]*b[1]; c[1] = a[2]*b[0] - a[0]*b[2]; c[2] = a[0]*b[1] - a[1]*b[0]; } static GLfloat gl2psNorm(GLfloat *a) { return (GLfloat)sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]); } static void gl2psGetNormal(GLfloat *a, GLfloat *b, GLfloat *c) { GLfloat norm; gl2psPvec(a, b, c); if(!GL2PS_ZERO(norm = gl2psNorm(c))){ c[0] = c[0] / norm; c[1] = c[1] / norm; c[2] = c[2] / norm; } else{ /* The plane is still wrong despite our tests in gl2psGetPlane. Let's return a dummy value for now (this is a hack: we should do more intelligent tests in GetPlane) */ c[0] = c[1] = 0.0F; c[2] = 1.0F; } } static void gl2psGetPlane(GL2PSprimitive *prim, GL2PSplane plane) { GL2PSxyz v = {0.0F, 0.0F, 0.0F}, w = {0.0F, 0.0F, 0.0F}; switch(prim->type){ case GL2PS_TRIANGLE : case GL2PS_QUADRANGLE : v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; w[0] = prim->verts[2].xyz[0] - prim->verts[0].xyz[0]; w[1] = prim->verts[2].xyz[1] - prim->verts[0].xyz[1]; w[2] = prim->verts[2].xyz[2] - prim->verts[0].xyz[2]; if((GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])) || (GL2PS_ZERO(w[0]) && GL2PS_ZERO(w[1]) && GL2PS_ZERO(w[2]))){ plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; plane[3] = -prim->verts[0].xyz[2]; } else{ gl2psGetNormal(v, w, plane); plane[3] = - plane[0] * prim->verts[0].xyz[0] - plane[1] * prim->verts[0].xyz[1] - plane[2] * prim->verts[0].xyz[2]; } break; case GL2PS_LINE : v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; if(GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])){ plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; plane[3] = -prim->verts[0].xyz[2]; } else{ if(GL2PS_ZERO(v[0])) w[0] = 1.0F; else if(GL2PS_ZERO(v[1])) w[1] = 1.0F; else w[2] = 1.0F; gl2psGetNormal(v, w, plane); plane[3] = - plane[0] * prim->verts[0].xyz[0] - plane[1] * prim->verts[0].xyz[1] - plane[2] * prim->verts[0].xyz[2]; } break; case GL2PS_POINT : case GL2PS_PIXMAP : case GL2PS_TEXT : case GL2PS_SPECIAL : case GL2PS_IMAGEMAP: plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; plane[3] = -prim->verts[0].xyz[2]; break; default : gl2psMsg(GL2PS_ERROR, "Unknown primitive type in BSP tree"); plane[0] = plane[1] = plane[3] = 0.0F; plane[2] = 1.0F; break; } } static void gl2psCutEdge(GL2PSvertex *a, GL2PSvertex *b, GL2PSplane plane, GL2PSvertex *c) { GL2PSxyz v; GLfloat sect; v[0] = b->xyz[0] - a->xyz[0]; v[1] = b->xyz[1] - a->xyz[1]; v[2] = b->xyz[2] - a->xyz[2]; sect = - gl2psComparePointPlane(a->xyz, plane) / gl2psPsca(plane, v); c->xyz[0] = a->xyz[0] + v[0] * sect; c->xyz[1] = a->xyz[1] + v[1] * sect; c->xyz[2] = a->xyz[2] + v[2] * sect; c->rgba[0] = (1 - sect) * a->rgba[0] + sect * b->rgba[0]; c->rgba[1] = (1 - sect) * a->rgba[1] + sect * b->rgba[1]; c->rgba[2] = (1 - sect) * a->rgba[2] + sect * b->rgba[2]; c->rgba[3] = (1 - sect) * a->rgba[3] + sect * b->rgba[3]; } static void gl2psCreateSplitPrimitive(GL2PSprimitive *parent, GL2PSplane plane, GL2PSprimitive *child, GLshort numverts, GLshort *index0, GLshort *index1) { GLshort i; if(parent->type == GL2PS_IMAGEMAP){ child->type = GL2PS_IMAGEMAP; child->data.image = parent->data.image; } else{ if(numverts > 4){ gl2psMsg(GL2PS_WARNING, "%d vertices in polygon", numverts); numverts = 4; } switch(numverts){ case 1 : child->type = GL2PS_POINT; break; case 2 : child->type = GL2PS_LINE; break; case 3 : child->type = GL2PS_TRIANGLE; break; case 4 : child->type = GL2PS_QUADRANGLE; break; default: child->type = GL2PS_NO_TYPE; break; } } child->boundary = 0; /* FIXME: not done! */ child->culled = parent->culled; child->offset = parent->offset; child->pattern = parent->pattern; child->factor = parent->factor; child->width = parent->width; child->numverts = numverts; child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); for(i = 0; i < numverts; i++){ if(index1[i] < 0){ child->verts[i] = parent->verts[index0[i]]; } else{ gl2psCutEdge(&parent->verts[index0[i]], &parent->verts[index1[i]], plane, &child->verts[i]); } } } static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, GLshort i, GLshort j) { GLint k; for(k = 0; k < *nb; k++){ if((index0[k] == i && index1[k] == j) || (index1[k] == i && index0[k] == j)) return; } index0[*nb] = i; index1[*nb] = j; (*nb)++; } static GLshort gl2psGetIndex(GLshort i, GLshort num) { return (i < num - 1) ? i + 1 : 0; } static GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane) { GLint type = GL2PS_COINCIDENT; GLshort i, j; GLfloat d[5]; for(i = 0; i < prim->numverts; i++){ d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); } if(prim->numverts < 2){ return 0; } else{ for(i = 0; i < prim->numverts; i++){ j = gl2psGetIndex(i, prim->numverts); if(d[j] > GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; else if(type != GL2PS_IN_BACK_OF) return 1; if(d[i] < -GL2PS_EPSILON) return 1; } else if(d[j] < -GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; else if(type != GL2PS_IN_FRONT_OF) return 1; if(d[i] > GL2PS_EPSILON) return 1; } } } return 0; } static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, GL2PSprimitive **front, GL2PSprimitive **back) { GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5]; GLint type; GLfloat d[5]; type = GL2PS_COINCIDENT; for(i = 0; i < prim->numverts; i++){ d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); } switch(prim->type){ case GL2PS_POINT : if(d[0] > GL2PS_EPSILON) type = GL2PS_IN_BACK_OF; else if(d[0] < -GL2PS_EPSILON) type = GL2PS_IN_FRONT_OF; else type = GL2PS_COINCIDENT; break; default : for(i = 0; i < prim->numverts; i++){ j = gl2psGetIndex(i, prim->numverts); if(d[j] > GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; if(d[i] < -GL2PS_EPSILON){ gl2psAddIndex(in0, in1, &in, i, j); gl2psAddIndex(out0, out1, &out, i, j); type = GL2PS_SPANNING; } gl2psAddIndex(out0, out1, &out, j, -1); } else if(d[j] < -GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING; if(d[i] > GL2PS_EPSILON){ gl2psAddIndex(in0, in1, &in, i, j); gl2psAddIndex(out0, out1, &out, i, j); type = GL2PS_SPANNING; } gl2psAddIndex(in0, in1, &in, j, -1); } else{ gl2psAddIndex(in0, in1, &in, j, -1); gl2psAddIndex(out0, out1, &out, j, -1); } } break; } if(type == GL2PS_SPANNING){ *back = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); *front = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); gl2psCreateSplitPrimitive(prim, plane, *back, out, out0, out1); gl2psCreateSplitPrimitive(prim, plane, *front, in, in0, in1); } return type; } static void gl2psDivideQuad(GL2PSprimitive *quad, GL2PSprimitive **t1, GL2PSprimitive **t2) { *t1 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); *t2 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); (*t1)->type = (*t2)->type = GL2PS_TRIANGLE; (*t1)->numverts = (*t2)->numverts = 3; (*t1)->culled = (*t2)->culled = quad->culled; (*t1)->offset = (*t2)->offset = quad->offset; (*t1)->pattern = (*t2)->pattern = quad->pattern; (*t1)->factor = (*t2)->factor = quad->factor; (*t1)->width = (*t2)->width = quad->width; (*t1)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex)); (*t2)->verts = (GL2PSvertex*)gl2psMalloc(3 * sizeof(GL2PSvertex)); (*t1)->verts[0] = quad->verts[0]; (*t1)->verts[1] = quad->verts[1]; (*t1)->verts[2] = quad->verts[2]; (*t1)->boundary = ((quad->boundary & 1) ? 1 : 0) | ((quad->boundary & 2) ? 2 : 0); (*t2)->verts[0] = quad->verts[0]; (*t2)->verts[1] = quad->verts[2]; (*t2)->verts[2] = quad->verts[3]; (*t1)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0); } static int gl2psCompareDepth(const void *a, const void *b) { GL2PSprimitive *q, *w; GLfloat dq = 0.0F, dw = 0.0F, diff; int i; q = *(GL2PSprimitive**)a; w = *(GL2PSprimitive**)b; for(i = 0; i < q->numverts; i++){ dq += q->verts[i].xyz[2]; } dq /= (GLfloat)q->numverts; for(i = 0; i < w->numverts; i++){ dw += w->verts[i].xyz[2]; } dw /= (GLfloat)w->numverts; diff = dq - dw; if(diff > 0.){ return -1; } else if(diff < 0.){ return 1; } else{ return 0; } } static int gl2psTrianglesFirst(const void *a, const void *b) { GL2PSprimitive *q, *w; q = *(GL2PSprimitive**)a; w = *(GL2PSprimitive**)b; return(q->type < w->type ? 1 : -1); } static GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root) { GLint i, j, count, best = 1000000, index = 0; GL2PSprimitive *prim1, *prim2; GL2PSplane plane; GLint maxp; if(!gl2psListNbr(primitives)){ gl2psMsg(GL2PS_ERROR, "Cannot fint root in empty primitive list"); return 0; } *root = *(GL2PSprimitive**)gl2psListPointer(primitives, 0); if(gl2ps->options & GL2PS_BEST_ROOT){ maxp = gl2psListNbr(primitives); if(maxp > gl2ps->maxbestroot){ maxp = gl2ps->maxbestroot; } for(i = 0; i < maxp; i++){ prim1 = *(GL2PSprimitive**)gl2psListPointer(primitives, i); gl2psGetPlane(prim1, plane); count = 0; for(j = 0; j < gl2psListNbr(primitives); j++){ if(j != i){ prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j); count += gl2psTestSplitPrimitive(prim2, plane); } if(count > best) break; } if(count < best){ best = count; index = i; *root = prim1; if(!count) return index; } } /* if(index) gl2psMsg(GL2PS_INFO, "GL2PS_BEST_ROOT was worth it: %d", index); */ return index; } else{ return 0; } } static void gl2psFreeImagemap(GL2PSimagemap *list){ GL2PSimagemap *next; while(list != NULL){ next = list->next; gl2psFree(list->image->pixels); gl2psFree(list->image); gl2psFree(list); list = next; } } static void gl2psFreePrimitive(void *data) { GL2PSprimitive *q; q = *(GL2PSprimitive**)data; gl2psFree(q->verts); if(q->type == GL2PS_TEXT || q->type == GL2PS_SPECIAL){ gl2psFreeText(q->data.text); } else if(q->type == GL2PS_PIXMAP){ gl2psFreePixmap(q->data.image); } gl2psFree(q); } static void gl2psAddPrimitiveInList(GL2PSprimitive *prim, GL2PSlist *list) { GL2PSprimitive *t1, *t2; if(prim->type != GL2PS_QUADRANGLE){ gl2psListAdd(list, &prim); } else{ gl2psDivideQuad(prim, &t1, &t2); gl2psListAdd(list, &t1); gl2psListAdd(list, &t2); gl2psFreePrimitive(&prim); } } static void gl2psFreeBspTree(GL2PSbsptree **tree) { if(*tree){ if((*tree)->back) gl2psFreeBspTree(&(*tree)->back); if((*tree)->primitives){ gl2psListAction((*tree)->primitives, gl2psFreePrimitive); gl2psListDelete((*tree)->primitives); } if((*tree)->front) gl2psFreeBspTree(&(*tree)->front); gl2psFree(*tree); *tree = NULL; } } static GLboolean gl2psGreater(GLfloat f1, GLfloat f2) { if(f1 > f2) return GL_TRUE; else return GL_FALSE; } static GLboolean gl2psLess(GLfloat f1, GLfloat f2) { if(f1 < f2) return GL_TRUE; else return GL_FALSE; } static void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives) { GL2PSprimitive *prim, *frontprim = NULL, *backprim = NULL; GL2PSlist *frontlist, *backlist; GLint i, index; tree->front = NULL; tree->back = NULL; tree->primitives = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); index = gl2psFindRoot(primitives, &prim); gl2psGetPlane(prim, tree->plane); gl2psAddPrimitiveInList(prim, tree->primitives); frontlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); backlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); for(i = 0; i < gl2psListNbr(primitives); i++){ if(i != index){ prim = *(GL2PSprimitive**)gl2psListPointer(primitives,i); switch(gl2psSplitPrimitive(prim, tree->plane, &frontprim, &backprim)){ case GL2PS_COINCIDENT: gl2psAddPrimitiveInList(prim, tree->primitives); break; case GL2PS_IN_BACK_OF: gl2psAddPrimitiveInList(prim, backlist); break; case GL2PS_IN_FRONT_OF: gl2psAddPrimitiveInList(prim, frontlist); break; case GL2PS_SPANNING: gl2psAddPrimitiveInList(backprim, backlist); gl2psAddPrimitiveInList(frontprim, frontlist); gl2psFreePrimitive(&prim); break; } } } if(gl2psListNbr(tree->primitives)){ gl2psListSort(tree->primitives, gl2psTrianglesFirst); } if(gl2psListNbr(frontlist)){ gl2psListSort(frontlist, gl2psTrianglesFirst); tree->front = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); gl2psBuildBspTree(tree->front, frontlist); } else{ gl2psListDelete(frontlist); } if(gl2psListNbr(backlist)){ gl2psListSort(backlist, gl2psTrianglesFirst); tree->back = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); gl2psBuildBspTree(tree->back, backlist); } else{ gl2psListDelete(backlist); } gl2psListDelete(primitives); } static void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon, GLboolean (*compare)(GLfloat f1, GLfloat f2), void (*action)(void *data), int inverse) { GLfloat result; if(!tree) return; result = gl2psComparePointPlane(eye, tree->plane); if(GL_TRUE == compare(result, epsilon)){ gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); if(inverse){ gl2psListActionInverse(tree->primitives, action); } else{ gl2psListAction(tree->primitives, action); } gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); } else if(GL_TRUE == compare(-epsilon, result)){ gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); if(inverse){ gl2psListActionInverse(tree->primitives, action); } else{ gl2psListAction(tree->primitives, action); } gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); } else{ gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); gl2psTraverseBspTree(tree->back, eye, epsilon, compare, action, inverse); } } static void gl2psRescaleAndOffset() { GL2PSprimitive *prim; GLfloat minZ, maxZ, rangeZ, scaleZ; GLfloat factor, units, area, dZ, dZdX, dZdY, maxdZ; int i, j; if(!gl2psListNbr(gl2ps->primitives)) return; /* get z-buffer range */ prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, 0); minZ = maxZ = prim->verts[0].xyz[2]; for(i = 1; i < prim->numverts; i++){ if(prim->verts[i].xyz[2] < minZ) minZ = prim->verts[i].xyz[2]; if(prim->verts[i].xyz[2] > maxZ) maxZ = prim->verts[i].xyz[2]; } for(i = 1; i < gl2psListNbr(gl2ps->primitives); i++){ prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i); for(j = 0; j < prim->numverts; j++){ if(prim->verts[j].xyz[2] < minZ) minZ = prim->verts[j].xyz[2]; if(prim->verts[j].xyz[2] > maxZ) maxZ = prim->verts[j].xyz[2]; } } rangeZ = (maxZ - minZ); /* rescale z-buffer coordinate in [0,GL2PS_ZSCALE], to make it of the same order of magnitude as the x and y coordinates */ scaleZ = GL2PS_ZERO(rangeZ) ? GL2PS_ZSCALE : (GL2PS_ZSCALE / rangeZ); /* avoid precision loss (we use floats!) */ if(scaleZ > 100000.F) scaleZ = 100000.F; /* apply offsets */ for(i = 0; i < gl2psListNbr(gl2ps->primitives); i++){ prim = *(GL2PSprimitive**)gl2psListPointer(gl2ps->primitives, i); for(j = 0; j < prim->numverts; j++){ prim->verts[j].xyz[2] = (prim->verts[j].xyz[2] - minZ) * scaleZ; } if((gl2ps->options & GL2PS_SIMPLE_LINE_OFFSET) && (prim->type == GL2PS_LINE)){ if(gl2ps->sort == GL2PS_SIMPLE_SORT){ prim->verts[0].xyz[2] -= GL2PS_ZOFFSET_LARGE; prim->verts[1].xyz[2] -= GL2PS_ZOFFSET_LARGE; } else{ prim->verts[0].xyz[2] -= GL2PS_ZOFFSET; prim->verts[1].xyz[2] -= GL2PS_ZOFFSET; } } else if(prim->offset && (prim->type == GL2PS_TRIANGLE)){ factor = gl2ps->offset[0]; units = gl2ps->offset[1]; area = (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]); dZdX = ((prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) * (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) - (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) * (prim->verts[2].xyz[2] - prim->verts[1].xyz[2])) / area; dZdY = ((prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * (prim->verts[1].xyz[2] - prim->verts[0].xyz[2])) / area; maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY); dZ = factor * maxdZ + units; prim->verts[0].xyz[2] += dZ; prim->verts[1].xyz[2] += dZ; prim->verts[2].xyz[2] += dZ; } } } /********************************************************************* * * 2D sorting routines (for occlusion culling) * *********************************************************************/ static GLint gl2psGetPlaneFromPoints(GL2PSxyz a, GL2PSxyz b, GL2PSplane plane) { GLfloat n; plane[0] = b[1] - a[1]; plane[1] = a[0] - b[0]; n = (GLfloat)sqrt(plane[0]*plane[0] + plane[1]*plane[1]); plane[2] = 0.0F; if(!GL2PS_ZERO(n)){ plane[0] /= n; plane[1] /= n; plane[3] = -plane[0]*a[0]-plane[1]*a[1]; return 1; } else{ plane[0] = -1.0F; plane[1] = 0.0F; plane[3] = a[0]; return 0; } } static void gl2psFreeBspImageTree(GL2PSbsptree2d **tree) { if(*tree){ if((*tree)->back) gl2psFreeBspImageTree(&(*tree)->back); if((*tree)->front) gl2psFreeBspImageTree(&(*tree)->front); gl2psFree(*tree); *tree = NULL; } } static GLint gl2psCheckPoint(GL2PSxyz point, GL2PSplane plane) { GLfloat pt_dis; pt_dis = gl2psComparePointPlane(point, plane); if(pt_dis > GL2PS_EPSILON) return GL2PS_POINT_INFRONT; else if(pt_dis < -GL2PS_EPSILON) return GL2PS_POINT_BACK; else return GL2PS_POINT_COINCIDENT; } static void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim, GL2PSbsptree2d **tree) { GLint ret = 0; GLint i; GLint offset = 0; GL2PSbsptree2d *head = NULL, *cur = NULL; if((*tree == NULL) && (prim->numverts > 2)){ head = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); for(i = 0; i < prim->numverts-1; i++){ if(!gl2psGetPlaneFromPoints(prim->verts[i].xyz, prim->verts[i+1].xyz, head->plane)){ if(prim->numverts-i > 3){ offset++; } else{ gl2psFree(head); return; } } else{ break; } } head->back = NULL; head->front = NULL; for(i = 2+offset; i < prim->numverts; i++){ ret = gl2psCheckPoint(prim->verts[i].xyz, head->plane); if(ret != GL2PS_POINT_COINCIDENT) break; } switch(ret){ case GL2PS_POINT_INFRONT : cur = head; for(i = 1+offset; i < prim->numverts-1; i++){ if(cur->front == NULL){ cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); } if(gl2psGetPlaneFromPoints(prim->verts[i].xyz, prim->verts[i+1].xyz, cur->front->plane)){ cur = cur->front; cur->front = NULL; cur->back = NULL; } } if(cur->front == NULL){ cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); } if(gl2psGetPlaneFromPoints(prim->verts[i].xyz, prim->verts[offset].xyz, cur->front->plane)){ cur->front->front = NULL; cur->front->back = NULL; } else{ gl2psFree(cur->front); cur->front = NULL; } break; case GL2PS_POINT_BACK : for(i = 0; i < 4; i++){ head->plane[i] = -head->plane[i]; } cur = head; for(i = 1+offset; i < prim->numverts-1; i++){ if(cur->front == NULL){ cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); } if(gl2psGetPlaneFromPoints(prim->verts[i+1].xyz, prim->verts[i].xyz, cur->front->plane)){ cur = cur->front; cur->front = NULL; cur->back = NULL; } } if(cur->front == NULL){ cur->front = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); } if(gl2psGetPlaneFromPoints(prim->verts[offset].xyz, prim->verts[i].xyz, cur->front->plane)){ cur->front->front = NULL; cur->front->back = NULL; } else{ gl2psFree(cur->front); cur->front = NULL; } break; default: gl2psFree(head); return; } (*tree) = head; } } static GLint gl2psCheckPrimitive(GL2PSprimitive *prim, GL2PSplane plane) { GLint i; GLint pos; pos = gl2psCheckPoint(prim->verts[0].xyz, plane); for(i = 1; i < prim->numverts; i++){ pos |= gl2psCheckPoint(prim->verts[i].xyz, plane); if(pos == (GL2PS_POINT_INFRONT | GL2PS_POINT_BACK)) return GL2PS_SPANNING; } if(pos & GL2PS_POINT_INFRONT) return GL2PS_IN_FRONT_OF; else if(pos & GL2PS_POINT_BACK) return GL2PS_IN_BACK_OF; else return GL2PS_COINCIDENT; } static GL2PSprimitive *gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent, GLshort numverts, GL2PSvertex *vertx) { GLint i; GL2PSprimitive *child = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); if(parent->type == GL2PS_IMAGEMAP){ child->type = GL2PS_IMAGEMAP; child->data.image = parent->data.image; } else { switch(numverts){ case 1 : child->type = GL2PS_POINT; break; case 2 : child->type = GL2PS_LINE; break; case 3 : child->type = GL2PS_TRIANGLE; break; case 4 : child->type = GL2PS_QUADRANGLE; break; default: child->type = GL2PS_NO_TYPE; break; /* FIXME */ } } child->boundary = 0; /* FIXME: not done! */ child->culled = parent->culled; child->offset = parent->offset; child->pattern = parent->pattern; child->factor = parent->factor; child->width = parent->width; child->numverts = numverts; child->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); for(i = 0; i < numverts; i++){ child->verts[i] = vertx[i]; } return child; } static void gl2psSplitPrimitive2D(GL2PSprimitive *prim, GL2PSplane plane, GL2PSprimitive **front, GL2PSprimitive **back) { /* cur will hold the position of the current vertex prev will hold the position of the previous vertex prev0 will hold the position of the vertex number 0 v1 and v2 represent the current and previous vertices, respectively flag is set if the current vertex should be checked against the plane */ GLint cur = -1, prev = -1, i, v1 = 0, v2 = 0, flag = 1, prev0 = -1; /* list of vertices that will go in front and back primitive */ GL2PSvertex *front_list = NULL, *back_list = NULL; /* number of vertices in front and back list */ GLshort front_count = 0, back_count = 0; for(i = 0; i <= prim->numverts; i++){ v1 = i; if(v1 == prim->numverts){ if(prim->numverts < 3) break; v1 = 0; v2 = prim->numverts-1; cur = prev0; } else if(flag){ cur = gl2psCheckPoint(prim->verts[v1].xyz, plane); if(i == 0){ prev0 = cur; } } if(((prev == -1) || (prev == cur) || (prev == 0) || (cur == 0)) && (i < prim->numverts)){ if(cur == GL2PS_POINT_INFRONT){ front_count++; front_list = (GL2PSvertex*)gl2psRealloc(front_list, sizeof(GL2PSvertex)*front_count); front_list[front_count-1] = prim->verts[v1]; } else if(cur == GL2PS_POINT_BACK){ back_count++; back_list = (GL2PSvertex*)gl2psRealloc(back_list, sizeof(GL2PSvertex)*back_count); back_list[back_count-1] = prim->verts[v1]; } else{ front_count++; front_list = (GL2PSvertex*)gl2psRealloc(front_list, sizeof(GL2PSvertex)*front_count); front_list[front_count-1] = prim->verts[v1]; back_count++; back_list = (GL2PSvertex*)gl2psRealloc(back_list, sizeof(GL2PSvertex)*back_count); back_list[back_count-1] = prim->verts[v1]; } flag = 1; } else if((prev != cur) && (cur != 0) && (prev != 0)){ if(v1 != 0){ v2 = v1-1; i--; } front_count++; front_list = (GL2PSvertex*)gl2psRealloc(front_list, sizeof(GL2PSvertex)*front_count); gl2psCutEdge(&prim->verts[v2], &prim->verts[v1], plane, &front_list[front_count-1]); back_count++; back_list = (GL2PSvertex*)gl2psRealloc(back_list, sizeof(GL2PSvertex)*back_count); back_list[back_count-1] = front_list[front_count-1]; flag = 0; } prev = cur; } *front = gl2psCreateSplitPrimitive2D(prim, front_count, front_list); *back = gl2psCreateSplitPrimitive2D(prim, back_count, back_list); gl2psFree(front_list); gl2psFree(back_list); } static GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree) { GLint ret = 0; GL2PSprimitive *frontprim = NULL, *backprim = NULL; /* FIXME: until we consider the actual extent of text strings and pixmaps, never cull them. Otherwise the whole string/pixmap gets culled as soon as the reference point is hidden */ if(prim->type == GL2PS_PIXMAP || prim->type == GL2PS_TEXT || prim->type == GL2PS_SPECIAL){ return 1; } if(*tree == NULL){ if((prim->type != GL2PS_IMAGEMAP) && (GL_FALSE == gl2ps->zerosurfacearea)){ gl2psAddPlanesInBspTreeImage(gl2ps->primitivetoadd, tree); } return 1; } else{ switch(gl2psCheckPrimitive(prim, (*tree)->plane)){ case GL2PS_IN_BACK_OF: return gl2psAddInBspImageTree(prim, &(*tree)->back); case GL2PS_IN_FRONT_OF: if((*tree)->front != NULL) return gl2psAddInBspImageTree(prim, &(*tree)->front); else return 0; case GL2PS_SPANNING: gl2psSplitPrimitive2D(prim, (*tree)->plane, &frontprim, &backprim); ret = gl2psAddInBspImageTree(backprim, &(*tree)->back); if((*tree)->front != NULL){ if(gl2psAddInBspImageTree(frontprim, &(*tree)->front)){ ret = 1; } } gl2psFree(frontprim->verts); gl2psFree(frontprim); gl2psFree(backprim->verts); gl2psFree(backprim); return ret; case GL2PS_COINCIDENT: if((*tree)->back != NULL){ gl2ps->zerosurfacearea = GL_TRUE; ret = gl2psAddInBspImageTree(prim, &(*tree)->back); gl2ps->zerosurfacearea = GL_FALSE; if(ret) return ret; } if((*tree)->front != NULL){ gl2ps->zerosurfacearea = GL_TRUE; ret = gl2psAddInBspImageTree(prim, &(*tree)->front); gl2ps->zerosurfacearea = GL_FALSE; if(ret) return ret; } if(prim->type == GL2PS_LINE) return 1; else return 0; } } return 0; } static void gl2psAddInImageTree(void *data) { GL2PSprimitive *prim = *(GL2PSprimitive **)data; gl2ps->primitivetoadd = prim; if(prim->type == GL2PS_IMAGEMAP && prim->data.image->format == GL2PS_IMAGEMAP_VISIBLE){ prim->culled = 1; } else if(!gl2psAddInBspImageTree(prim, &gl2ps->imagetree)){ prim->culled = 1; } else if(prim->type == GL2PS_IMAGEMAP){ prim->data.image->format = GL2PS_IMAGEMAP_VISIBLE; } } /* Boundary construction */ static void gl2psAddBoundaryInList(GL2PSprimitive *prim, GL2PSlist *list) { GL2PSprimitive *b; GLshort i; GL2PSxyz c; c[0] = c[1] = c[2] = 0.0F; for(i = 0; i < prim->numverts; i++){ c[0] += prim->verts[i].xyz[0]; c[1] += prim->verts[i].xyz[1]; } c[0] /= prim->numverts; c[1] /= prim->numverts; for(i = 0; i < prim->numverts; i++){ if(prim->boundary & (GLint)pow(2., i)){ b = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); b->type = GL2PS_LINE; b->offset = prim->offset; b->pattern = prim->pattern; b->factor = prim->factor; b->culled = prim->culled; b->width = prim->width; b->boundary = 0; b->numverts = 2; b->verts = (GL2PSvertex*)gl2psMalloc(2 * sizeof(GL2PSvertex)); #if 0 /* FIXME: need to work on boundary offset... */ v[0] = c[0] - prim->verts[i].xyz[0]; v[1] = c[1] - prim->verts[i].xyz[1]; v[2] = 0.0F; norm = gl2psNorm(v); v[0] /= norm; v[1] /= norm; b->verts[0].xyz[0] = prim->verts[i].xyz[0] +0.1*v[0]; b->verts[0].xyz[1] = prim->verts[i].xyz[1] +0.1*v[1]; b->verts[0].xyz[2] = prim->verts[i].xyz[2]; v[0] = c[0] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0]; v[1] = c[1] - prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1]; norm = gl2psNorm(v); v[0] /= norm; v[1] /= norm; b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0] +0.1*v[0]; b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1] +0.1*v[1]; b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2]; #else b->verts[0].xyz[0] = prim->verts[i].xyz[0]; b->verts[0].xyz[1] = prim->verts[i].xyz[1]; b->verts[0].xyz[2] = prim->verts[i].xyz[2]; b->verts[1].xyz[0] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[0]; b->verts[1].xyz[1] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[1]; b->verts[1].xyz[2] = prim->verts[gl2psGetIndex(i, prim->numverts)].xyz[2]; #endif b->verts[0].rgba[0] = 0.0F; b->verts[0].rgba[1] = 0.0F; b->verts[0].rgba[2] = 0.0F; b->verts[0].rgba[3] = 0.0F; b->verts[1].rgba[0] = 0.0F; b->verts[1].rgba[1] = 0.0F; b->verts[1].rgba[2] = 0.0F; b->verts[1].rgba[3] = 0.0F; gl2psListAdd(list, &b); } } } static void gl2psBuildPolygonBoundary(GL2PSbsptree *tree) { GLint i; GL2PSprimitive *prim; if(!tree) return; gl2psBuildPolygonBoundary(tree->back); for(i = 0; i < gl2psListNbr(tree->primitives); i++){ prim = *(GL2PSprimitive**)gl2psListPointer(tree->primitives, i); if(prim->boundary) gl2psAddBoundaryInList(prim, tree->primitives); } gl2psBuildPolygonBoundary(tree->front); } /********************************************************************* * * Feedback buffer parser * *********************************************************************/ static void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, GL2PSvertex *verts, GLint offset, GLushort pattern, GLint factor, GLfloat width, char boundary) { GL2PSprimitive *prim; prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = type; prim->numverts = numverts; prim->verts = (GL2PSvertex*)gl2psMalloc(numverts * sizeof(GL2PSvertex)); memcpy(prim->verts, verts, numverts * sizeof(GL2PSvertex)); prim->boundary = boundary; prim->offset = offset; prim->pattern = pattern; prim->factor = factor; prim->width = width; prim->culled = 0; /* FIXME: here we should have an option to split stretched tris/quads to enhance SIMPLE_SORT */ gl2psListAdd(gl2ps->primitives, &prim); } static GLint gl2psGetVertex(GL2PSvertex *v, GLfloat *p) { GLint i; v->xyz[0] = p[0]; v->xyz[1] = p[1]; v->xyz[2] = p[2]; if(gl2ps->colormode == GL_COLOR_INDEX && gl2ps->colorsize > 0){ i = (GLint)(p[3] + 0.5); v->rgba[0] = gl2ps->colormap[i][0]; v->rgba[1] = gl2ps->colormap[i][1]; v->rgba[2] = gl2ps->colormap[i][2]; v->rgba[3] = gl2ps->colormap[i][3]; return 4; } else{ v->rgba[0] = p[3]; v->rgba[1] = p[4]; v->rgba[2] = p[5]; v->rgba[3] = p[6]; return 7; } } static void gl2psParseFeedbackBuffer(GLint used) { char flag; GLushort pattern = 0; GLboolean boundary; GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0; GLfloat lwidth = 1.0F, psize = 1.0F; GLfloat *current; GL2PSvertex vertices[3]; GL2PSprimitive *prim; GL2PSimagemap *node; current = gl2ps->feedback; boundary = gl2ps->boundary = GL_FALSE; while(used > 0){ if(GL_TRUE == boundary) gl2ps->boundary = GL_TRUE; switch((GLint)*current){ case GL_POINT_TOKEN : current ++; used --; i = gl2psGetVertex(&vertices[0], current); current += i; used -= i; gl2psAddPolyPrimitive(GL2PS_POINT, 1, vertices, 0, pattern, factor, psize, 0); break; case GL_LINE_TOKEN : case GL_LINE_RESET_TOKEN : current ++; used --; i = gl2psGetVertex(&vertices[0], current); current += i; used -= i; i = gl2psGetVertex(&vertices[1], current); current += i; used -= i; gl2psAddPolyPrimitive(GL2PS_LINE, 2, vertices, 0, pattern, factor, lwidth, 0); break; case GL_POLYGON_TOKEN : count = (GLint)current[1]; current += 2; used -= 2; v = vtot = 0; while(count > 0 && used > 0){ i = gl2psGetVertex(&vertices[v], current); gl2psAdaptVertexForBlending(&vertices[v]); current += i; used -= i; count --; vtot++; if(v == 2){ if(GL_TRUE == boundary){ if(!count && vtot == 2) flag = 1|2|4; else if(!count) flag = 2|4; else if(vtot == 2) flag = 1|2; else flag = 2; } else flag = 0; gl2psAddPolyPrimitive(GL2PS_TRIANGLE, 3, vertices, offset, pattern, factor, 1, flag); vertices[1] = vertices[2]; } else v ++; } break; case GL_BITMAP_TOKEN : case GL_DRAW_PIXEL_TOKEN : case GL_COPY_PIXEL_TOKEN : current ++; used --; i = gl2psGetVertex(&vertices[0], current); current += i; used -= i; break; case GL_PASS_THROUGH_TOKEN : switch((GLint)current[1]){ case GL2PS_BEGIN_OFFSET_TOKEN : offset = 1; break; case GL2PS_END_OFFSET_TOKEN : offset = 0; break; case GL2PS_BEGIN_BOUNDARY_TOKEN : boundary = GL_TRUE; break; case GL2PS_END_BOUNDARY_TOKEN : boundary = GL_FALSE; break; case GL2PS_END_STIPPLE_TOKEN : pattern = factor = 0; break; case GL2PS_BEGIN_BLEND_TOKEN : gl2ps->blending = GL_TRUE; break; case GL2PS_END_BLEND_TOKEN : gl2ps->blending = GL_FALSE; break; case GL2PS_BEGIN_STIPPLE_TOKEN : current += 2; used -= 2; pattern = (GLushort)current[1]; current += 2; used -= 2; factor = (GLint)current[1]; break; case GL2PS_SRC_BLEND_TOKEN : current += 2; used -= 2; gl2ps->blendfunc[0] = (GLint)current[1]; break; case GL2PS_DST_BLEND_TOKEN : current += 2; used -= 2; gl2ps->blendfunc[1] = (GLint)current[1]; break; case GL2PS_POINT_SIZE_TOKEN : current += 2; used -= 2; psize = current[1]; break; case GL2PS_LINE_WIDTH_TOKEN : current += 2; used -= 2; lwidth = current[1]; break; case GL2PS_IMAGEMAP_TOKEN : prim = (GL2PSprimitive *)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = GL2PS_IMAGEMAP; prim->boundary = 0; prim->numverts = 4; prim->verts = (GL2PSvertex *)gl2psMalloc(4 * sizeof(GL2PSvertex)); prim->culled = 0; prim->offset = 0; prim->pattern = 0; prim->factor = 0; prim->width = 1; node = (GL2PSimagemap*)gl2psMalloc(sizeof(GL2PSimagemap)); node->image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); node->image->type = 0; node->image->format = 0; node->next = NULL; if(gl2ps->imagemap_head == NULL) gl2ps->imagemap_head = node; else gl2ps->imagemap_tail->next = node; gl2ps->imagemap_tail = node; prim->data.image = node->image; current += 2; used -= 2; i = gl2psGetVertex(&prim->verts[0], ¤t[1]); current += i; used -= i; node->image->width = (GLint)current[2]; current += 2; used -= 2; node->image->height = (GLint)current[2]; prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5; prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5; for(i = 1; i < 4; i++){ for(v = 0; v < 3; v++){ prim->verts[i].xyz[v] = prim->verts[0].xyz[v]; prim->verts[i].rgba[v] = prim->verts[0].rgba[v]; } prim->verts[i].rgba[v] = prim->verts[0].rgba[v]; } prim->verts[1].xyz[0] = prim->verts[1].xyz[0] + node->image->width; prim->verts[2].xyz[0] = prim->verts[1].xyz[0]; prim->verts[2].xyz[1] = prim->verts[2].xyz[1] + node->image->height; prim->verts[3].xyz[1] = prim->verts[2].xyz[1]; sizeoffloat = sizeof(GLfloat); v = 2 * sizeoffloat; vtot = node->image->height + node->image->height * ((node->image->width-1)/8); node->image->pixels = (GLfloat*)gl2psMalloc(v + vtot); node->image->pixels[0] = prim->verts[0].xyz[0]; node->image->pixels[1] = prim->verts[0].xyz[1]; for(i = 0; i < vtot; i += sizeoffloat){ current += 2; used -= 2; if((vtot - i) >= 4) memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), sizeoffloat); else memcpy(&(((char*)(node->image->pixels))[i + v]), &(current[2]), vtot - i); } current++; used--; gl2psListAdd(gl2ps->primitives, &prim); break; case GL2PS_DRAW_PIXELS_TOKEN : case GL2PS_TEXT_TOKEN : if(auxindex < gl2psListNbr(gl2ps->auxprimitives)) gl2psListAdd(gl2ps->primitives, gl2psListPointer(gl2ps->auxprimitives, auxindex++)); else gl2psMsg(GL2PS_ERROR, "Wrong number of auxiliary tokens in buffer"); break; } current += 2; used -= 2; break; default : gl2psMsg(GL2PS_WARNING, "Unknown token in buffer"); current ++; used --; break; } } gl2psListReset(gl2ps->auxprimitives); } /********************************************************************* * * PostScript routines * *********************************************************************/ static void gl2psWriteByte(unsigned char byte) { unsigned char h = byte / 16; unsigned char l = byte % 16; gl2psPrintf("%x%x", h, l); } static void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GL2PSimage *im) { GLuint nbhex, nbyte, nrgb, nbits; GLuint row, col, ibyte, icase; GLfloat dr, dg, db, fgrey; unsigned char red = 0, green = 0, blue = 0, b, grey; GLuint width = (GLuint)im->width; GLuint height = (GLuint)im->height; /* FIXME: should we define an option for these? Or just keep the 8-bit per component case? */ int greyscale = 0; /* set to 1 to output greyscale image */ int nbit = 8; /* number of bits per color compoment (2, 4 or 8) */ if((width <= 0) || (height <= 0)) return; gl2psPrintf("gsave\n"); gl2psPrintf("%.2f %.2f translate\n", x, y); gl2psPrintf("%d %d scale\n", width, height); if(greyscale){ /* greyscale */ gl2psPrintf("/picstr %d string def\n", width); gl2psPrintf("%d %d %d\n", width, height, 8); gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile picstr readhexstring pop }\n"); gl2psPrintf("image\n"); for(row = 0; row < height; row++){ for(col = 0; col < width; col++){ gl2psGetRGB(im, col, row, &dr, &dg, &db); fgrey = (0.30 * dr + 0.59 * dg + 0.11 * db); grey = (unsigned char)(255. * fgrey); gl2psWriteByte(grey); } gl2psPrintf("\n"); } nbhex = width * height * 2; gl2psPrintf("%%%% nbhex digit :%d\n", nbhex); } else if(nbit == 2){ /* color, 2 bits for r and g and b; rgbs following each other */ nrgb = width * 3; nbits = nrgb * nbit; nbyte = nbits/8; if((nbyte * 8) != nbits) nbyte++; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, nbit); gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); gl2psPrintf("false 3\n"); gl2psPrintf("colorimage\n"); for(row = 0; row < height; row++){ icase = 1; col = 0; b = 0; for(ibyte = 0; ibyte < nbyte; ibyte++){ if(icase == 1) { if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(3. * dr); green = (unsigned char)(3. * dg); blue = (unsigned char)(3. * db); b = red; b = (b<<2) + green; b = (b<<2) + blue; if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(3. * dr); green = (unsigned char)(3. * dg); blue = (unsigned char)(3. * db); b = (b<<2) + red; gl2psWriteByte(b); b = 0; icase++; } else if(icase == 2) { b = green; b = (b<<2) + blue; if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(3. * dr); green = (unsigned char)(3. * dg); blue = (unsigned char)(3. * db); b = (b<<2) + red; b = (b<<2) + green; gl2psWriteByte(b); b = 0; icase++; } else if(icase == 3) { b = blue; if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(3. * dr); green = (unsigned char)(3. * dg); blue = (unsigned char)(3. * db); b = (b<<2) + red; b = (b<<2) + green; b = (b<<2) + blue; gl2psWriteByte(b); b = 0; icase = 1; } } gl2psPrintf("\n"); } } else if(nbit == 4){ /* color, 4 bits for r and g and b; rgbs following each other */ nrgb = width * 3; nbits = nrgb * nbit; nbyte = nbits/8; if((nbyte * 8) != nbits) nbyte++; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, nbit); gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); gl2psPrintf("false 3\n"); gl2psPrintf("colorimage\n"); for(row = 0; row < height; row++){ col = 0; icase = 1; for(ibyte = 0; ibyte < nbyte; ibyte++){ if(icase == 1) { if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(15. * dr); green = (unsigned char)(15. * dg); gl2psPrintf("%x%x", red, green); icase++; } else if(icase == 2) { blue = (unsigned char)(15. * db); if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); } else { dr = dg = db = 0; } col++; red = (unsigned char)(15. * dr); gl2psPrintf("%x%x", blue, red); icase++; } else if(icase == 3) { green = (unsigned char)(15. * dg); blue = (unsigned char)(15. * db); gl2psPrintf("%x%x", green, blue); icase = 1; } } gl2psPrintf("\n"); } } else{ /* 8 bit for r and g and b */ nbyte = width * 3; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, 8); gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); gl2psPrintf("false 3\n"); gl2psPrintf("colorimage\n"); for(row = 0; row < height; row++){ for(col = 0; col < width; col++){ gl2psGetRGB(im, col, row, &dr, &dg, &db); red = (unsigned char)(255. * dr); gl2psWriteByte(red); green = (unsigned char)(255. * dg); gl2psWriteByte(green); blue = (unsigned char)(255. * db); gl2psWriteByte(blue); } gl2psPrintf("\n"); } } gl2psPrintf("grestore\n"); } static void gl2psPrintPostScriptImagemap(GLfloat x, GLfloat y, GLsizei width, GLsizei height, const unsigned char *imagemap){ int i, size; if((width <= 0) || (height <= 0)) return; size = height + height * (width-1)/8; gl2psPrintf("gsave\n"); gl2psPrintf("%.2f %.2f translate\n", x, y); gl2psPrintf("%d %d scale\n%d %d\ntrue\n", width, height,width, height); gl2psPrintf("[ %d 0 0 -%d 0 %d ] {<", width, height); for(i = 0; i < size; i++){ gl2psWriteByte(*imagemap); imagemap++; } gl2psPrintf(">} imagemask\ngrestore\n"); } static void gl2psPrintPostScriptHeader(void) { time_t now; /* Since compression is not part of the PostScript standard, compressed PostScript files are just gzipped PostScript files ("ps.gz" or "eps.gz") */ gl2psPrintGzipHeader(); time(&now); if(gl2ps->format == GL2PS_PS){ gl2psPrintf("%%!PS-Adobe-3.0\n"); } else{ gl2psPrintf("%%!PS-Adobe-3.0 EPSF-3.0\n"); } gl2psPrintf("%%%%Title: %s\n" "%%%%Creator: GL2PS %d.%d.%d%s, %s\n" "%%%%For: %s\n" "%%%%CreationDate: %s" "%%%%LanguageLevel: 3\n" "%%%%DocumentData: Clean7Bit\n" "%%%%Pages: 1\n", gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); if(gl2ps->format == GL2PS_PS){ gl2psPrintf("%%%%Orientation: %s\n" "%%%%DocumentMedia: Default %d %d 0 () ()\n", (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait", (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : (int)gl2ps->viewport[2], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : (int)gl2ps->viewport[3]); } gl2psPrintf("%%%%BoundingBox: %d %d %d %d\n" "%%%%EndComments\n", (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[1] : (int)gl2ps->viewport[0], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[0] : (int)gl2ps->viewport[1], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : (int)gl2ps->viewport[2], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : (int)gl2ps->viewport[3]); /* RGB color: r g b C (replace C by G in output to change from rgb to gray) Grayscale: r g b G Font choose: size fontname FC Text string: (string) x y size fontname S?? Rotated text string: (string) angle x y size fontname S??R Point primitive: x y size P Line width: width W Line start: x y LS Line joining last point: x y L Line end: x y LE Flat-shaded triangle: x3 y3 x2 y2 x1 y1 T Smooth-shaded triangle: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 ST */ gl2psPrintf("%%%%BeginProlog\n" "/gl2psdict 64 dict def gl2psdict begin\n" "0 setlinecap 0 setlinejoin\n" "/tryPS3shading %s def %% set to false to force subdivision\n" "/rThreshold %g def %% red component subdivision threshold\n" "/gThreshold %g def %% green component subdivision threshold\n" "/bThreshold %g def %% blue component subdivision threshold\n", (gl2ps->options & GL2PS_NO_PS3_SHADING) ? "false" : "true", gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2]); gl2psPrintf("/BD { bind def } bind def\n" "/C { setrgbcolor } BD\n" "/G { 0.082 mul exch 0.6094 mul add exch 0.3086 mul add neg 1.0 add setgray } BD\n" "/W { setlinewidth } BD\n"); gl2psPrintf("/FC { findfont exch /SH exch def SH scalefont setfont } BD\n" "/SW { dup stringwidth pop } BD\n" "/S { FC moveto show } BD\n" "/SBC{ FC moveto SW -2 div 0 rmoveto show } BD\n" "/SBR{ FC moveto SW neg 0 rmoveto show } BD\n" "/SCL{ FC moveto 0 SH -2 div rmoveto show } BD\n" "/SCC{ FC moveto SW -2 div SH -2 div rmoveto show } BD\n" "/SCR{ FC moveto SW neg SH -2 div rmoveto show } BD\n" "/STL{ FC moveto 0 SH neg rmoveto show } BD\n" "/STC{ FC moveto SW -2 div SH neg rmoveto show } BD\n" "/STR{ FC moveto SW neg SH neg rmoveto show } BD\n"); /* rotated text routines: same nameanem with R appended */ gl2psPrintf("/FCT { FC translate 0 0 } BD\n" "/SR { gsave FCT moveto rotate show grestore } BD\n" "/SBCR{ gsave FCT moveto rotate SW -2 div 0 rmoveto show grestore } BD\n" "/SBRR{ gsave FCT moveto rotate SW neg 0 rmoveto show grestore } BD\n" "/SCLR{ gsave FCT moveto rotate 0 SH -2 div rmoveto show grestore} BD\n"); gl2psPrintf("/SCCR{ gsave FCT moveto rotate SW -2 div SH -2 div rmoveto show grestore} BD\n" "/SCRR{ gsave FCT moveto rotate SW neg SH -2 div rmoveto show grestore} BD\n" "/STLR{ gsave FCT moveto rotate 0 SH neg rmoveto show grestore } BD\n" "/STCR{ gsave FCT moveto rotate SW -2 div SH neg rmoveto show grestore } BD\n" "/STRR{ gsave FCT moveto rotate SW neg SH neg rmoveto show grestore } BD\n"); gl2psPrintf("/P { newpath 0.0 360.0 arc closepath fill } BD\n" "/LS { newpath moveto } BD\n" "/L { lineto } BD\n" "/LE { lineto stroke } BD\n" "/T { newpath moveto lineto lineto closepath fill } BD\n"); /* Smooth-shaded triangle with PostScript level 3 shfill operator: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STshfill */ gl2psPrintf("/STshfill {\n" " /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n" " /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n" " /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n" " gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n" " /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n" " shfill grestore } BD\n"); /* Flat-shaded triangle with middle color: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 Tm */ gl2psPrintf(/* stack : x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 */ "/Tm { 3 -1 roll 8 -1 roll 13 -1 roll add add 3 div\n" /* r = (r1+r2+r3)/3 */ /* stack : x3 y3 g3 b3 x2 y2 g2 b2 x1 y1 g1 b1 r */ " 3 -1 roll 7 -1 roll 11 -1 roll add add 3 div\n" /* g = (g1+g2+g3)/3 */ /* stack : x3 y3 b3 x2 y2 b2 x1 y1 b1 r g b */ " 3 -1 roll 6 -1 roll 9 -1 roll add add 3 div" /* b = (b1+b2+b3)/3 */ /* stack : x3 y3 x2 y2 x1 y1 r g b */ " C T } BD\n"); /* Split triangle in four sub-triangles (at sides middle points) and call the STnoshfill procedure on each, interpolating the colors in RGB space: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STsplit (in procedure comments key: (Vi) = xi yi ri gi bi) */ gl2psPrintf("/STsplit {\n" " 4 index 15 index add 0.5 mul\n" /* x13 = (x1+x3)/2 */ " 4 index 15 index add 0.5 mul\n" /* y13 = (y1+y3)/2 */ " 4 index 15 index add 0.5 mul\n" /* r13 = (r1+r3)/2 */ " 4 index 15 index add 0.5 mul\n" /* g13 = (g1+g3)/2 */ " 4 index 15 index add 0.5 mul\n" /* b13 = (b1+b3)/2 */ " 5 copy 5 copy 25 15 roll\n"); /* at his point, stack = (V3) (V13) (V13) (V13) (V2) (V1) */ gl2psPrintf(" 9 index 30 index add 0.5 mul\n" /* x23 = (x2+x3)/2 */ " 9 index 30 index add 0.5 mul\n" /* y23 = (y2+y3)/2 */ " 9 index 30 index add 0.5 mul\n" /* r23 = (r2+r3)/2 */ " 9 index 30 index add 0.5 mul\n" /* g23 = (g2+g3)/2 */ " 9 index 30 index add 0.5 mul\n" /* b23 = (b2+b3)/2 */ " 5 copy 5 copy 35 5 roll 25 5 roll 15 5 roll\n"); /* stack = (V3) (V13) (V23) (V13) (V23) (V13) (V23) (V2) (V1) */ gl2psPrintf(" 4 index 10 index add 0.5 mul\n" /* x12 = (x1+x2)/2 */ " 4 index 10 index add 0.5 mul\n" /* y12 = (y1+y2)/2 */ " 4 index 10 index add 0.5 mul\n" /* r12 = (r1+r2)/2 */ " 4 index 10 index add 0.5 mul\n" /* g12 = (g1+g2)/2 */ " 4 index 10 index add 0.5 mul\n" /* b12 = (b1+b2)/2 */ " 5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n"); /* stack = (V3) (V13) (V23) (V13) (V12) (V23) (V13) (V1) (V12) (V23) (V12) (V2) */ gl2psPrintf(" STnoshfill STnoshfill STnoshfill STnoshfill } BD\n"); /* Gouraud shaded triangle using recursive subdivision until the difference between corner colors does not exceed the thresholds: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STnoshfill */ gl2psPrintf("/STnoshfill {\n" " 2 index 8 index sub abs rThreshold gt\n" /* |r1-r2|>rth */ " { STsplit }\n" " { 1 index 7 index sub abs gThreshold gt\n" /* |g1-g2|>gth */ " { STsplit }\n" " { dup 6 index sub abs bThreshold gt\n" /* |b1-b2|>bth */ " { STsplit }\n" " { 2 index 13 index sub abs rThreshold gt\n" /* |r1-r3|>rht */ " { STsplit }\n" " { 1 index 12 index sub abs gThreshold gt\n" /* |g1-g3|>gth */ " { STsplit }\n" " { dup 11 index sub abs bThreshold gt\n" /* |b1-b3|>bth */ " { STsplit }\n" " { 7 index 13 index sub abs rThreshold gt\n"); /* |r2-r3|>rht */ gl2psPrintf(" { STsplit }\n" " { 6 index 12 index sub abs gThreshold gt\n" /* |g2-g3|>gth */ " { STsplit }\n" " { 5 index 11 index sub abs bThreshold gt\n" /* |b2-b3|>bth */ " { STsplit }\n" " { Tm }\n" /* all colors sufficiently similar */ " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse }\n" " ifelse } BD\n"); gl2psPrintf("tryPS3shading\n" "{ /shfill where\n" " { /ST { STshfill } BD }\n" " { /ST { STnoshfill } BD }\n" " ifelse }\n" "{ /ST { STnoshfill } BD }\n" "ifelse\n"); gl2psPrintf("end\n" "%%%%EndProlog\n" "%%%%BeginSetup\n" "/DeviceRGB setcolorspace\n" "gl2psdict begin\n" "%%%%EndSetup\n" "%%%%Page: 1 1\n" "%%%%BeginPageSetup\n"); if(gl2ps->options & GL2PS_LANDSCAPE){ gl2psPrintf("%d 0 translate 90 rotate\n", (int)gl2ps->viewport[3]); } gl2psPrintf("%%%%EndPageSetup\n" "mark\n" "gsave\n" "1.0 1.0 scale\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ gl2psPrintf("%g %g %g C\n" "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath fill\n", gl2ps->bgcolor[0], gl2ps->bgcolor[1], gl2ps->bgcolor[2], (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); } } static void gl2psPrintPostScriptColor(GL2PSrgba rgba) { if(!gl2psSameColor(gl2ps->lastrgba, rgba)){ gl2psSetLastColor(rgba); gl2psPrintf("%g %g %g C\n", rgba[0], rgba[1], rgba[2]); } } static void gl2psResetPostScriptColor(void) { gl2ps->lastrgba[0] = gl2ps->lastrgba[1] = gl2ps->lastrgba[2] = -1.; } static void gl2psEndPostScriptLine(void) { int i; if(gl2ps->lastvertex.rgba[0] >= 0.){ gl2psPrintf("%g %g LE\n", gl2ps->lastvertex.xyz[0], gl2ps->lastvertex.xyz[1]); for(i = 0; i < 3; i++) gl2ps->lastvertex.xyz[i] = -1.; for(i = 0; i < 4; i++) gl2ps->lastvertex.rgba[i] = -1.; } } static void gl2psParseStipplePattern(GLushort pattern, GLint factor, int *nb, int array[10]) { int i, n; int on[8] = {0, 0, 0, 0, 0, 0, 0, 0}; int off[8] = {0, 0, 0, 0, 0, 0, 0, 0}; char tmp[16]; /* extract the 16 bits from the OpenGL stipple pattern */ for(n = 15; n >= 0; n--){ tmp[n] = (char)(pattern & 0x01); pattern >>= 1; } /* compute the on/off pixel sequence */ n = 0; for(i = 0; i < 8; i++){ while(n < 16 && !tmp[n]){ off[i]++; n++; } while(n < 16 && tmp[n]){ on[i]++; n++; } if(n >= 15){ i++; break; } } /* store the on/off array from right to left, starting with off pixels. The PostScript specification allows for at most 11 elements in the on/off array, so we limit ourselves to 5 on/off couples (our longest possible array is thus [on4 off4 on3 off3 on2 off2 on1 off1 on0 off0]) */ *nb = 0; for(n = i - 1; n >= 0; n--){ array[(*nb)++] = factor * on[n]; array[(*nb)++] = factor * off[n]; if(*nb == 10) break; } } static int gl2psPrintPostScriptDash(GLushort pattern, GLint factor, char *str) { int len = 0, i, n, array[10]; if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor) return 0; gl2ps->lastpattern = pattern; gl2ps->lastfactor = factor; if(!pattern || !factor){ /* solid line */ len += gl2psPrintf("[] 0 %s\n", str); } else{ gl2psParseStipplePattern(pattern, factor, &n, array); len += gl2psPrintf("["); for(i = 0; i < n; i++){ if(i) len += gl2psPrintf(" "); len += gl2psPrintf("%d", array[i]); } len += gl2psPrintf("] 0 %s\n", str); } return len; } static void gl2psPrintPostScriptPrimitive(void *data) { int newline; GL2PSprimitive *prim; prim = *(GL2PSprimitive**)data; if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; /* Every effort is made to draw lines as connected segments (i.e., using a single PostScript path): this is the only way to get nice line joins and to not restart the stippling for every line segment. So if the primitive to print is not a line we must first finish the current line (if any): */ if(prim->type != GL2PS_LINE) gl2psEndPostScriptLine(); switch(prim->type){ case GL2PS_POINT : gl2psPrintPostScriptColor(prim->verts[0].rgba); gl2psPrintf("%g %g %g P\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], 0.5 * prim->width); break; case GL2PS_LINE : if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) || !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) || gl2ps->lastlinewidth != prim->width || gl2ps->lastpattern != prim->pattern || gl2ps->lastfactor != prim->factor){ /* End the current line if the new segment does not start where the last one ended, or if the color, the width or the stippling have changed (multi-stroking lines with changing colors is necessary until we use /shfill for lines; unfortunately this means that at the moment we can screw up line stippling for smooth-shaded lines) */ gl2psEndPostScriptLine(); newline = 1; } else{ newline = 0; } if(gl2ps->lastlinewidth != prim->width){ gl2ps->lastlinewidth = prim->width; gl2psPrintf("%g W\n", gl2ps->lastlinewidth); } gl2psPrintPostScriptDash(prim->pattern, prim->factor, "setdash"); gl2psPrintPostScriptColor(prim->verts[0].rgba); gl2psPrintf("%g %g %s\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], newline ? "LS" : "L"); gl2ps->lastvertex = prim->verts[1]; break; case GL2PS_TRIANGLE : if(!gl2psVertsSameColor(prim)){ gl2psResetPostScriptColor(); gl2psPrintf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n", prim->verts[2].xyz[0], prim->verts[2].xyz[1], prim->verts[2].rgba[0], prim->verts[2].rgba[1], prim->verts[2].rgba[2], prim->verts[1].xyz[0], prim->verts[1].xyz[1], prim->verts[1].rgba[0], prim->verts[1].rgba[1], prim->verts[1].rgba[2], prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2]); } else{ gl2psPrintPostScriptColor(prim->verts[0].rgba); gl2psPrintf("%g %g %g %g %g %g T\n", prim->verts[2].xyz[0], prim->verts[2].xyz[1], prim->verts[1].xyz[0], prim->verts[1].xyz[1], prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } break; case GL2PS_QUADRANGLE : gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print"); break; case GL2PS_PIXMAP : gl2psPrintPostScriptPixmap(prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->data.image); break; case GL2PS_IMAGEMAP : if(prim->data.image->type != GL2PS_IMAGEMAP_WRITTEN){ gl2psPrintPostScriptColor(prim->verts[0].rgba); gl2psPrintPostScriptImagemap(prim->data.image->pixels[0], prim->data.image->pixels[1], prim->data.image->width, prim->data.image->height, (const unsigned char*)(&(prim->data.image->pixels[2]))); prim->data.image->type = GL2PS_IMAGEMAP_WRITTEN; } break; case GL2PS_TEXT : gl2psPrintPostScriptColor(prim->verts[0].rgba); gl2psPrintf("(%s) ", prim->data.text->str); if(prim->data.text->angle) gl2psPrintf("%g ", prim->data.text->angle); gl2psPrintf("%g %g %d /%s ", prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->data.text->fontsize, prim->data.text->fontname); switch(prim->data.text->alignment){ case GL2PS_TEXT_C: gl2psPrintf(prim->data.text->angle ? "SCCR\n" : "SCC\n"); break; case GL2PS_TEXT_CL: gl2psPrintf(prim->data.text->angle ? "SCLR\n" : "SCL\n"); break; case GL2PS_TEXT_CR: gl2psPrintf(prim->data.text->angle ? "SCRR\n" : "SCR\n"); break; case GL2PS_TEXT_B: gl2psPrintf(prim->data.text->angle ? "SBCR\n" : "SBC\n"); break; case GL2PS_TEXT_BR: gl2psPrintf(prim->data.text->angle ? "SBRR\n" : "SBR\n"); break; case GL2PS_TEXT_T: gl2psPrintf(prim->data.text->angle ? "STCR\n" : "STC\n"); break; case GL2PS_TEXT_TL: gl2psPrintf(prim->data.text->angle ? "STLR\n" : "STL\n"); break; case GL2PS_TEXT_TR: gl2psPrintf(prim->data.text->angle ? "STRR\n" : "STR\n"); break; case GL2PS_TEXT_BL: default: gl2psPrintf(prim->data.text->angle ? "SR\n" : "S\n"); break; } break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text is intended */ if(prim->data.text->alignment == GL2PS_PS || prim->data.text->alignment == GL2PS_EPS) gl2psPrintf("%s\n", prim->data.text->str); break; default : break; } } static void gl2psPrintPostScriptFooter(void) { gl2psPrintf("grestore\n" "showpage\n" "cleartomark\n" "%%%%PageTrailer\n" "%%%%Trailer\n" "end\n" "%%%%EOF\n"); gl2psPrintGzipFooter(); } static void gl2psPrintPostScriptBeginViewport(GLint viewport[4]) { GLint index; GLfloat rgba[4]; int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; glRenderMode(GL_FEEDBACK); if(gl2ps->header){ gl2psPrintPostScriptHeader(); gl2ps->header = GL_FALSE; } gl2psPrintf("gsave\n" "1.0 1.0 scale\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); } else{ glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index); rgba[0] = gl2ps->colormap[index][0]; rgba[1] = gl2ps->colormap[index][1]; rgba[2] = gl2ps->colormap[index][2]; rgba[3] = 1.0F; } gl2psPrintf("%g %g %g C\n" "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath fill\n", rgba[0], rgba[1], rgba[2], x, y, x+w, y, x+w, y+h, x, y+h); } gl2psPrintf("newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath clip\n", x, y, x+w, y, x+w, y+h, x, y+h); } static GLint gl2psPrintPostScriptEndViewport(void) { GLint res; res = gl2psPrintPrimitives(); gl2psPrintf("grestore\n"); return res; } static void gl2psPrintPostScriptFinalPrimitive(void) { /* End any remaining line, if any */ gl2psEndPostScriptLine(); } /* definition of the PostScript and Encapsulated PostScript backends */ static GL2PSbackend gl2psPS = { gl2psPrintPostScriptHeader, gl2psPrintPostScriptFooter, gl2psPrintPostScriptBeginViewport, gl2psPrintPostScriptEndViewport, gl2psPrintPostScriptPrimitive, gl2psPrintPostScriptFinalPrimitive, "ps", "Postscript" }; static GL2PSbackend gl2psEPS = { gl2psPrintPostScriptHeader, gl2psPrintPostScriptFooter, gl2psPrintPostScriptBeginViewport, gl2psPrintPostScriptEndViewport, gl2psPrintPostScriptPrimitive, gl2psPrintPostScriptFinalPrimitive, "eps", "Encapsulated Postscript" }; /********************************************************************* * * LaTeX routines * *********************************************************************/ static void gl2psPrintTeXHeader(void) { char name[256]; time_t now; int i; if(gl2ps->filename && strlen(gl2ps->filename) < 256){ for(i = strlen(gl2ps->filename)-1; i >= 0; i--){ if(gl2ps->filename[i] == '.'){ strncpy(name, gl2ps->filename, i); name[i] = '\0'; break; } } if(i <= 0) strcpy(name, gl2ps->filename); } else{ strcpy(name, "untitled"); } time(&now); fprintf(gl2ps->stream, "%% Title: %s\n" "%% Creator: GL2PS %d.%d.%d%s, %s\n" "%% For: %s\n" "%% CreationDate: %s", gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); fprintf(gl2ps->stream, "\\setlength{\\unitlength}{1pt}\n" "\\begin{picture}(0,0)\n" "\\includegraphics{%s}\n" "\\end{picture}%%\n" "%s\\begin{picture}(%d,%d)(0,0)\n", name, (gl2ps->options & GL2PS_LANDSCAPE) ? "\\rotatebox{90}{" : "", (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); } static void gl2psPrintTeXPrimitive(void *data) { GL2PSprimitive *prim; prim = *(GL2PSprimitive**)data; switch(prim->type){ case GL2PS_TEXT : fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", prim->data.text->fontsize); fprintf(gl2ps->stream, "\\put(%g,%g){\\makebox(0,0)", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); switch(prim->data.text->alignment){ case GL2PS_TEXT_C: fprintf(gl2ps->stream, "{"); break; case GL2PS_TEXT_CL: fprintf(gl2ps->stream, "[l]{"); break; case GL2PS_TEXT_CR: fprintf(gl2ps->stream, "[r]{"); break; case GL2PS_TEXT_B: fprintf(gl2ps->stream, "[b]{"); break; case GL2PS_TEXT_BR: fprintf(gl2ps->stream, "[br]{"); break; case GL2PS_TEXT_T: fprintf(gl2ps->stream, "[t]{"); break; case GL2PS_TEXT_TL: fprintf(gl2ps->stream, "[tl]{"); break; case GL2PS_TEXT_TR: fprintf(gl2ps->stream, "[tr]{"); break; case GL2PS_TEXT_BL: default: fprintf(gl2ps->stream, "[bl]{"); break; } if(prim->data.text->angle) fprintf(gl2ps->stream, "\\rotatebox{%g}{", prim->data.text->angle); fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}", prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2], prim->data.text->str); if(prim->data.text->angle) fprintf(gl2ps->stream, "}"); fprintf(gl2ps->stream, "}}\n"); break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text is intended */ if (prim->data.text->alignment == GL2PS_TEX) fprintf(gl2ps->stream, "%s\n", prim->data.text->str); break; default : break; } } static void gl2psPrintTeXFooter(void) { fprintf(gl2ps->stream, "\\end{picture}%s\n", (gl2ps->options & GL2PS_LANDSCAPE) ? "}" : ""); } static void gl2psPrintTeXBeginViewport(GLint viewport[4]) { glRenderMode(GL_FEEDBACK); if(gl2ps->header){ gl2psPrintTeXHeader(); gl2ps->header = GL_FALSE; } } static GLint gl2psPrintTeXEndViewport(void) { return gl2psPrintPrimitives(); } static void gl2psPrintTeXFinalPrimitive(void) { } /* definition of the LaTeX backend */ static GL2PSbackend gl2psTEX = { gl2psPrintTeXHeader, gl2psPrintTeXFooter, gl2psPrintTeXBeginViewport, gl2psPrintTeXEndViewport, gl2psPrintTeXPrimitive, gl2psPrintTeXFinalPrimitive, "tex", "LaTeX text" }; /********************************************************************* * * PDF routines * *********************************************************************/ static int gl2psPrintPDFCompressorType(void) { #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ return fprintf(gl2ps->stream, "/Filter [/FlateDecode]\n"); } #endif return 0; } static int gl2psPrintPDFStrokeColor(GL2PSrgba rgba) { int i, offs = 0; gl2psSetLastColor(rgba); for(i = 0; i < 3; ++i){ if(GL2PS_ZERO(rgba[i])) offs += gl2psPrintf("%.0f ", 0.); else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */ offs += gl2psPrintf("%f ", rgba[i]); else offs += gl2psPrintf("%g ", rgba[i]); } offs += gl2psPrintf("RG\n"); return offs; } static int gl2psPrintPDFFillColor(GL2PSrgba rgba) { int i, offs = 0; for(i = 0; i < 3; ++i){ if(GL2PS_ZERO(rgba[i])) offs += gl2psPrintf("%.0f ", 0.); else if(rgba[i] < 1e-4 || rgba[i] > 1e6) /* avoid %e formatting */ offs += gl2psPrintf("%f ", rgba[i]); else offs += gl2psPrintf("%g ", rgba[i]); } offs += gl2psPrintf("rg\n"); return offs; } static int gl2psPrintPDFLineWidth(GLfloat lw) { if(GL2PS_ZERO(lw)) return gl2psPrintf("%.0f w\n", 0.); else if(lw < 1e-4 || lw > 1e6) /* avoid %e formatting */ return gl2psPrintf("%f w\n", lw); else return gl2psPrintf("%g w\n", lw); } static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y) { gl2ps->streamlength += gl2psPrintf("BT\n" "/F%d %d Tf\n" "%f %f Td\n" "(%s) Tj\n" "ET\n", cnt, text->fontsize, x, y, text->str); } static void gl2psPutPDFImage(GL2PSimage *image, int cnt, GLfloat x, GLfloat y) { gl2ps->streamlength += gl2psPrintf("q\n" "%d 0 0 %d %f %f cm\n" "/Im%d Do\n" "Q\n", (int)image->width, (int)image->height, x, y, cnt); } static void gl2psPDFstacksInit(void) { gl2ps->objects_stack = 7 /* FIXED_XREF_ENTRIES */ + 1; gl2ps->extgs_stack = 0; gl2ps->font_stack = 0; gl2ps->im_stack = 0; gl2ps->trgroupobjects_stack = 0; gl2ps->shader_stack = 0; gl2ps->mshader_stack = 0; } static void gl2psPDFgroupObjectInit(GL2PSpdfgroup *gro) { if(!gro) return; gro->ptrlist = NULL; gro->fontno = gro->gsno = gro->imno = gro->maskshno = gro->shno = gro->trgroupno = gro->fontobjno = gro->imobjno = gro->shobjno = gro->maskshobjno = gro->gsobjno = gro->trgroupobjno = -1; } /* Build up group objects and assign name and object numbers */ static void gl2psPDFgroupListInit(void) { int i; GL2PSprimitive *p = NULL; GL2PSpdfgroup gro; int lasttype = GL2PS_NO_TYPE; GL2PSrgba lastrgba = {-1.0F, -1.0F, -1.0F, -1.0F}; GLushort lastpattern = 0; GLint lastfactor = 0; GLfloat lastwidth = 1; GL2PStriangle lastt, tmpt; int lastTriangleWasNotSimpleWithSameColor = 0; if(!gl2ps->pdfprimlist) return; gl2ps->pdfgrouplist = gl2psListCreate(500, 500, sizeof(GL2PSpdfgroup)); gl2psInitTriangle(&lastt); for(i = 0; i < gl2psListNbr(gl2ps->pdfprimlist); ++i){ p = *(GL2PSprimitive**)gl2psListPointer(gl2ps->pdfprimlist, i); switch(p->type){ case GL2PS_PIXMAP: gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); gro.imno = gl2ps->im_stack++; gl2psListAdd(gro.ptrlist, &p); gl2psListAdd(gl2ps->pdfgrouplist, &gro); break; case GL2PS_TEXT: gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); gro.fontno = gl2ps->font_stack++; gl2psListAdd(gro.ptrlist, &p); gl2psListAdd(gl2ps->pdfgrouplist, &gro); break; case GL2PS_LINE: if(lasttype != p->type || lastwidth != p->width || lastpattern != p->pattern || lastfactor != p->factor || !gl2psSameColor(p->verts[0].rgba, lastrgba)){ gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); gl2psListAdd(gro.ptrlist, &p); gl2psListAdd(gl2ps->pdfgrouplist, &gro); } else{ gl2psListAdd(gro.ptrlist, &p); } lastpattern = p->pattern; lastfactor = p->factor; lastwidth = p->width; lastrgba[0] = p->verts[0].rgba[0]; lastrgba[1] = p->verts[0].rgba[1]; lastrgba[2] = p->verts[0].rgba[2]; break; case GL2PS_POINT: if(lasttype != p->type || lastwidth != p->width || !gl2psSameColor(p->verts[0].rgba, lastrgba)){ gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1,2,sizeof(GL2PSprimitive*)); gl2psListAdd(gro.ptrlist, &p); gl2psListAdd(gl2ps->pdfgrouplist, &gro); } else{ gl2psListAdd(gro.ptrlist, &p); } lastwidth = p->width; lastrgba[0] = p->verts[0].rgba[0]; lastrgba[1] = p->verts[0].rgba[1]; lastrgba[2] = p->verts[0].rgba[2]; break; case GL2PS_TRIANGLE: gl2psFillTriangleFromPrimitive(&tmpt, p, GL_TRUE); lastTriangleWasNotSimpleWithSameColor = !(tmpt.prop & T_CONST_COLOR && tmpt.prop & T_ALPHA_1) || !gl2psSameColor(tmpt.vertex[0].rgba, lastt.vertex[0].rgba); if(lasttype == p->type && tmpt.prop == lastt.prop && lastTriangleWasNotSimpleWithSameColor){ /* TODO Check here for last alpha */ gl2psListAdd(gro.ptrlist, &p); } else{ gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1, 2, sizeof(GL2PSprimitive*)); gl2psListAdd(gro.ptrlist, &p); gl2psListAdd(gl2ps->pdfgrouplist, &gro); } lastt = tmpt; break; default: break; } lasttype = p->type; } } static void gl2psSortOutTrianglePDFgroup(GL2PSpdfgroup *gro) { GL2PStriangle t; GL2PSprimitive *prim = NULL; if(!gro) return; if(!gl2psListNbr(gro->ptrlist)) return; prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); if(prim->type != GL2PS_TRIANGLE) return; gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack ++; } else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; gro->trgroupno = gl2ps->trgroupobjects_stack++; gro->trgroupobjno = gl2ps->objects_stack++; gro->maskshno = gl2ps->mshader_stack++; gro->maskshobjno = gl2ps->objects_stack++; } else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; } else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; } else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; gro->trgroupno = gl2ps->trgroupobjects_stack++; gro->trgroupobjno = gl2ps->objects_stack++; gro->maskshno = gl2ps->mshader_stack++; gro->maskshobjno = gl2ps->objects_stack++; } } /* Main stream data */ static void gl2psPDFgroupListWriteMainStream(void) { int i, j, lastel; GL2PSprimitive *prim = NULL, *prev = NULL; GL2PSpdfgroup *gro; GL2PStriangle t; if(!gl2ps->pdfgrouplist) return; for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); lastel = gl2psListNbr(gro->ptrlist) - 1; if(lastel < 0) continue; prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); switch(prim->type){ case GL2PS_POINT: gl2ps->streamlength += gl2psPrintf("1 J\n"); gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width); gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2ps->streamlength += gl2psPrintf("%f %f m %f %f l\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } gl2ps->streamlength += gl2psPrintf("S\n"); gl2ps->streamlength += gl2psPrintf("0 J\n"); break; case GL2PS_LINE: /* We try to use as few paths as possible to draw lines, in order to get nice stippling even when the individual segments are smaller than the stipple */ gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width); gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); gl2ps->streamlength += gl2psPrintPostScriptDash(prim->pattern, prim->factor, "d"); /* start new path */ gl2ps->streamlength += gl2psPrintf("%f %f m\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); for(j = 1; j <= lastel; ++j){ prev = prim; prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); if(!gl2psSamePosition(prim->verts[0].xyz, prev->verts[1].xyz)){ /* the starting point of the new segment does not match the end point of the previous line, so we end the current path and start a new one */ gl2ps->streamlength += gl2psPrintf("%f %f l\n", prev->verts[1].xyz[0], prev->verts[1].xyz[1]); gl2ps->streamlength += gl2psPrintf("%f %f m\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } else{ /* the two segements are connected, so we just append to the current path */ gl2ps->streamlength += gl2psPrintf("%f %f l\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } } /* end last path */ gl2ps->streamlength += gl2psPrintf("%f %f l\n", prim->verts[1].xyz[0], prim->verts[1].xyz[1]); gl2ps->streamlength += gl2psPrintf("S\n"); break; case GL2PS_TRIANGLE: gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); gl2psSortOutTrianglePDFgroup(gro); /* No alpha and const color: Simple PDF draw orders */ if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_1){ gl2ps->streamlength += gl2psPrintPDFFillColor(t.vertex[0].rgba); for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" "h f\n", t.vertex[0].xyz[0], t.vertex[0].xyz[1], t.vertex[1].xyz[0], t.vertex[1].xyz[1], t.vertex[2].xyz[0], t.vertex[2].xyz[1]); } } /* Const alpha < 1 and const color: Simple PDF draw orders and an extra extended Graphics State for the alpha const */ else if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n", gro->gsno); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" "h f\n", t.vertex[0].xyz[0], t.vertex[0].xyz[1], t.vertex[1].xyz[0], t.vertex[1].xyz[1], t.vertex[2].xyz[0], t.vertex[2].xyz[1]); } gl2ps->streamlength += gl2psPrintf("Q\n"); } /* Variable alpha and const color: Simple PDF draw orders and an extra extended Graphics State + Xobject + Shader object for the alpha mask */ else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/TrG%d Do\n", gro->gsno, gro->trgroupno); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" "h f\n", t.vertex[0].xyz[0], t.vertex[0].xyz[1], t.vertex[1].xyz[0], t.vertex[1].xyz[1], t.vertex[2].xyz[0], t.vertex[2].xyz[1]); } gl2ps->streamlength += gl2psPrintf("Q\n"); } /* Variable color and no alpha: Shader Object for the colored triangle(s) */ else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ gl2ps->streamlength += gl2psPrintf("/Sh%d sh\n", gro->shno); } /* Variable color and const alpha < 1: Shader Object for the colored triangle(s) and an extra extended Graphics State for the alpha const */ else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/Sh%d sh\n" "Q\n", gro->gsno, gro->shno); } /* Variable alpha and color: Shader Object for the colored triangle(s) and an extra extended Graphics State + Xobject + Shader object for the alpha mask */ else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/TrG%d Do\n" "/Sh%d sh\n" "Q\n", gro->gsno, gro->trgroupno, gro->shno); } break; case GL2PS_PIXMAP: for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psPutPDFImage(prim->data.image, gro->imno, prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } break; case GL2PS_TEXT: for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } break; default: break; } } } /* Graphics State names */ static int gl2psPDFgroupListWriteGStateResources(void) { GL2PSpdfgroup *gro; int offs = 0; int i; offs += fprintf(gl2ps->stream, "/ExtGState\n" "<<\n" "/GSa 7 0 R\n"); for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->gsno >= 0) offs += fprintf(gl2ps->stream, "/GS%d %d 0 R\n", gro->gsno, gro->gsobjno); } offs += fprintf(gl2ps->stream, ">>\n"); return offs; } /* Main Shader names */ static int gl2psPDFgroupListWriteShaderResources(void) { GL2PSpdfgroup *gro; int offs = 0; int i; offs += fprintf(gl2ps->stream, "/Shading\n" "<<\n"); for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->shno >= 0) offs += fprintf(gl2ps->stream, "/Sh%d %d 0 R\n", gro->shno, gro->shobjno); if(gro->maskshno >= 0) offs += fprintf(gl2ps->stream, "/TrSh%d %d 0 R\n", gro->maskshno, gro->maskshobjno); } offs += fprintf(gl2ps->stream,">>\n"); return offs; } /* Images & Mask Shader XObject names */ static int gl2psPDFgroupListWriteXObjectResources(void) { int i; GL2PSprimitive *p = NULL; GL2PSpdfgroup *gro; int offs = 0; offs += fprintf(gl2ps->stream, "/XObject\n" "<<\n"); for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(!gl2psListNbr(gro->ptrlist)) continue; p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); switch(p->type){ case GL2PS_PIXMAP: gro->imobjno = gl2ps->objects_stack++; if(GL_RGBA == p->data.image->format) /* reserve one object for image mask */ gl2ps->objects_stack++; offs += fprintf(gl2ps->stream, "/Im%d %d 0 R\n", gro->imno, gro->imobjno); case GL2PS_TRIANGLE: if(gro->trgroupno >=0) offs += fprintf(gl2ps->stream, "/TrG%d %d 0 R\n", gro->trgroupno, gro->trgroupobjno); break; default: break; } } offs += fprintf(gl2ps->stream,">>\n"); return offs; } /* Font names */ static int gl2psPDFgroupListWriteFontResources(void) { int i; GL2PSpdfgroup *gro; int offs = 0; offs += fprintf(gl2ps->stream, "/Font\n<<\n"); for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->fontno < 0) continue; gro->fontobjno = gl2ps->objects_stack++; offs += fprintf(gl2ps->stream, "/F%d %d 0 R\n", gro->fontno, gro->fontobjno); } offs += fprintf(gl2ps->stream, ">>\n"); return offs; } static void gl2psPDFgroupListDelete(void) { int i; GL2PSpdfgroup *gro = NULL; if(!gl2ps->pdfgrouplist) return; for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist,i); gl2psListDelete(gro->ptrlist); } gl2psListDelete(gl2ps->pdfgrouplist); gl2ps->pdfgrouplist = NULL; } /* Print 1st PDF object - file info */ static int gl2psPrintPDFInfo(void) { int offs; time_t now; struct tm *newtime; time(&now); newtime = gmtime(&now); offs = fprintf(gl2ps->stream, "1 0 obj\n" "<<\n" "/Title (%s)\n" "/Creator (GL2PS %d.%d.%d%s, %s)\n" "/Producer (%s)\n", gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer); if(!newtime){ offs += fprintf(gl2ps->stream, ">>\n" "endobj\n"); return offs; } offs += fprintf(gl2ps->stream, "/CreationDate (D:%d%02d%02d%02d%02d%02d)\n" ">>\n" "endobj\n", newtime->tm_year+1900, newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); return offs; } /* Create catalog and page structure - 2nd and 3th PDF object */ static int gl2psPrintPDFCatalog(void) { return fprintf(gl2ps->stream, "2 0 obj\n" "<<\n" "/Type /Catalog\n" "/Pages 3 0 R\n" ">>\n" "endobj\n"); } static int gl2psPrintPDFPages(void) { return fprintf(gl2ps->stream, "3 0 obj\n" "<<\n" "/Type /Pages\n" "/Kids [6 0 R]\n" "/Count 1\n" ">>\n" "endobj\n"); } /* Open stream for data - graphical objects, fonts etc. PDF object 4 */ static int gl2psOpenPDFDataStream(void) { int offs = 0; offs += fprintf(gl2ps->stream, "4 0 obj\n" "<<\n" "/Length 5 0 R\n" ); offs += gl2psPrintPDFCompressorType(); offs += fprintf(gl2ps->stream, ">>\n" "stream\n"); return offs; } /* Stream setup - Graphics state, fill background if allowed */ static int gl2psOpenPDFDataStreamWritePreface(void) { int offs; offs = gl2psPrintf("/GSa gs\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ offs += gl2psPrintPDFFillColor(gl2ps->bgcolor); offs += gl2psPrintf("%d %d %d %d re\n", (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); offs += gl2psPrintf("f\n"); } return offs; } /* Use the functions above to create the first part of the PDF*/ static void gl2psPrintPDFHeader(void) { int offs = 0; gl2ps->pdfprimlist = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); gl2psPDFstacksInit(); gl2ps->xreflist = (int*)gl2psMalloc(sizeof(int) * gl2ps->objects_stack); #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psSetupCompress(); } #endif gl2ps->xreflist[0] = 0; offs += fprintf(gl2ps->stream, "%%PDF-1.4\n"); gl2ps->xreflist[1] = offs; offs += gl2psPrintPDFInfo(); gl2ps->xreflist[2] = offs; offs += gl2psPrintPDFCatalog(); gl2ps->xreflist[3] = offs; offs += gl2psPrintPDFPages(); gl2ps->xreflist[4] = offs; offs += gl2psOpenPDFDataStream(); gl2ps->xreflist[5] = offs; /* finished in gl2psPrintPDFFooter */ gl2ps->streamlength = gl2psOpenPDFDataStreamWritePreface(); } /* The central primitive drawing */ static void gl2psPrintPDFPrimitive(void *data) { GL2PSprimitive *prim = *(GL2PSprimitive**)data; if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; prim = gl2psCopyPrimitive(prim); /* deep copy */ gl2psListAdd(gl2ps->pdfprimlist, &prim); } /* close stream and ... */ static int gl2psClosePDFDataStream(void) { int offs = 0; #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ if(Z_OK != gl2psDeflate()) gl2psMsg(GL2PS_ERROR, "Zlib deflate error"); else fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream); gl2ps->streamlength += gl2ps->compress->destLen; offs += gl2ps->streamlength; gl2psFreeCompress(); } #endif offs += fprintf(gl2ps->stream, "endstream\n" "endobj\n"); return offs; } /* ... write the now known length object */ static int gl2psPrintPDFDataStreamLength(int val) { return fprintf(gl2ps->stream, "5 0 obj\n" "%d\n" "endobj\n", val); } /* Put the info created before in PDF objects */ static int gl2psPrintPDFOpenPage(void) { int offs; /* Write fixed part */ offs = fprintf(gl2ps->stream, "6 0 obj\n" "<<\n" "/Type /Page\n" "/Parent 3 0 R\n" "/MediaBox [%d %d %d %d]\n", (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); if(gl2ps->options & GL2PS_LANDSCAPE) offs += fprintf(gl2ps->stream, "/Rotate -90\n"); offs += fprintf(gl2ps->stream, "/Contents 4 0 R\n" "/Resources\n" "<<\n" "/ProcSet [/PDF /Text /ImageB /ImageC] %%/ImageI\n"); return offs; /* End fixed part, proceeds in gl2psPDFgroupListWriteVariableResources() */ } static int gl2psPDFgroupListWriteVariableResources(void) { int offs = 0; /* a) Graphics States for shader alpha masks*/ offs += gl2psPDFgroupListWriteGStateResources(); /* b) Shader and shader masks */ offs += gl2psPDFgroupListWriteShaderResources(); /* c) XObjects (Images & Shader Masks) */ offs += gl2psPDFgroupListWriteXObjectResources(); /* d) Fonts */ offs += gl2psPDFgroupListWriteFontResources(); /* End resources and page */ offs += fprintf(gl2ps->stream, ">>\n" ">>\n" "endobj\n"); return offs; } /* Standard Graphics State */ static int gl2psPrintPDFGSObject(void) { return fprintf(gl2ps->stream, "7 0 obj\n" "<<\n" "/Type /ExtGState\n" "/SA false\n" "/SM 0.02\n" "/OP false\n" "/op false\n" "/OPM 0\n" "/BG2 /Default\n" "/UCR2 /Default\n" "/TR2 /Default\n" ">>\n" "endobj\n"); } /* Put vertex' edge flag (8bit) and coordinates (32bit) in shader stream */ static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, size_t (*action)(unsigned long data, size_t size), GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin) { int offs = 0; unsigned long imap; GLfloat diff; double dmax = ~1UL; char edgeflag = 0; /* FIXME: temp bux fix for 64 bit archs: */ if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; offs += (*action)(edgeflag, 1); /* The Shader stream in PDF requires to be in a 'big-endian' order */ if(GL2PS_ZERO(dx*dy)){ offs += (*action)(0, 4); offs += (*action)(0, 4); } else{ diff = (vertex->xyz[0] - xmin) / dx; if(diff > 1) diff = 1.0F; else if(diff < 0) diff = 0.0F; imap = (unsigned long)(diff * dmax); offs += (*action)(imap, 4); diff = (vertex->xyz[1] - ymin) / dy; if(diff > 1) diff = 1.0F; else if(diff < 0) diff = 0.0F; imap = (unsigned long)(diff * dmax); offs += (*action)(imap, 4); } return offs; } /* Put vertex' rgb value (8bit for every component) in shader stream */ static int gl2psPrintPDFShaderStreamDataRGB(GL2PSvertex *vertex, size_t (*action)(unsigned long data, size_t size)) { int offs = 0; unsigned long imap; double dmax = ~1UL; /* FIXME: temp bux fix for 64 bit archs: */ if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; imap = (unsigned long)((vertex->rgba[0]) * dmax); offs += (*action)(imap, 1); imap = (unsigned long)((vertex->rgba[1]) * dmax); offs += (*action)(imap, 1); imap = (unsigned long)((vertex->rgba[2]) * dmax); offs += (*action)(imap, 1); return offs; } /* Put vertex' alpha (8/16bit) in shader stream */ static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, size_t (*action)(unsigned long data, size_t size), int sigbyte) { int offs = 0; unsigned long imap; double dmax = ~1UL; /* FIXME: temp bux fix for 64 bit archs: */ if(sizeof(unsigned long) == 8) dmax = dmax - 2048.; if(sigbyte != 8 && sigbyte != 16) sigbyte = 8; sigbyte /= 8; imap = (unsigned long)((vertex->rgba[3]) * dmax); offs += (*action)(imap, sigbyte); return offs; } /* Put a triangles raw data in shader stream */ static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin, size_t (*action)(unsigned long data, size_t size), int gray) { int i, offs = 0; GL2PSvertex v; if(gray && gray != 8 && gray != 16) gray = 8; for(i = 0; i < 3; ++i){ offs += gl2psPrintPDFShaderStreamDataCoord(&triangle->vertex[i], action, dx, dy, xmin, ymin); if(gray){ v = triangle->vertex[i]; offs += gl2psPrintPDFShaderStreamDataAlpha(&v, action, gray); } else{ offs += gl2psPrintPDFShaderStreamDataRGB(&triangle->vertex[i], action); } } return offs; } static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, GLfloat *ymin, GLfloat *ymax, GL2PStriangle *triangles, int cnt) { int i, j; *xmin = triangles[0].vertex[0].xyz[0]; *xmax = triangles[0].vertex[0].xyz[0]; *ymin = triangles[0].vertex[0].xyz[1]; *ymax = triangles[0].vertex[0].xyz[1]; for(i = 0; i < cnt; ++i){ for(j = 0; j < 3; ++j){ if(*xmin > triangles[i].vertex[j].xyz[0]) *xmin = triangles[i].vertex[j].xyz[0]; if(*xmax < triangles[i].vertex[j].xyz[0]) *xmax = triangles[i].vertex[j].xyz[0]; if(*ymin > triangles[i].vertex[j].xyz[1]) *ymin = triangles[i].vertex[j].xyz[1]; if(*ymax < triangles[i].vertex[j].xyz[1]) *ymax = triangles[i].vertex[j].xyz[1]; } } } /* Writes shaded triangle gray == 0 means write RGB triangles gray == 8 8bit-grayscale (for alpha masks) gray == 16 16bit-grayscale (for alpha masks) */ static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, int size, int gray) { int i, offs = 0, vertexbytes, done = 0; GLfloat xmin, xmax, ymin, ymax; switch(gray){ case 0: vertexbytes = 1+4+4+1+1+1; break; case 8: vertexbytes = 1+4+4+1; break; case 16: vertexbytes = 1+4+4+2; break; default: gray = 8; vertexbytes = 1+4+4+1; break; } gl2psPDFRectHull(&xmin, &xmax, &ymin, &ymax, triangles, size); offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<< " "/ShadingType 4 " "/ColorSpace %s " "/BitsPerCoordinate 32 " "/BitsPerComponent %d " "/BitsPerFlag 8 " "/Decode [%f %f %f %f 0 1 %s] ", obj, (gray) ? "/DeviceGray" : "/DeviceRGB", (gray) ? gray : 8, xmin, xmax, ymin, ymax, (gray) ? "" : "0 1 0 1"); #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psAllocCompress(vertexbytes * size * 3); for(i = 0; i < size; ++i) gl2psPrintPDFShaderStreamData(&triangles[i], xmax-xmin, ymax-ymin, xmin, ymin, gl2psWriteBigEndianCompress, gray); if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ offs += gl2psPrintPDFCompressorType(); offs += fprintf(gl2ps->stream, "/Length %d " ">>\n" "stream\n", (int)gl2ps->compress->destLen); offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream); done = 1; } gl2psFreeCompress(); } #endif if(!done){ /* no compression, or too long after compression, or compress error -> write non-compressed entry */ offs += fprintf(gl2ps->stream, "/Length %d " ">>\n" "stream\n", vertexbytes * 3 * size); for(i = 0; i < size; ++i) offs += gl2psPrintPDFShaderStreamData(&triangles[i], xmax-xmin, ymax-ymin, xmin, ymin, gl2psWriteBigEndian, gray); } offs += fprintf(gl2ps->stream, "\nendstream\n" "endobj\n"); return offs; } /* Writes a XObject for a shaded triangle mask */ static int gl2psPrintPDFShaderMask(int obj, int childobj) { int offs = 0, len; offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" "/Type /XObject\n" "/Subtype /Form\n" "/BBox [ %d %d %d %d ]\n" "/Group \n<<\n/S /Transparency /CS /DeviceRGB\n" ">>\n", obj, (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); len = (childobj>0) ? strlen("/TrSh sh\n") + (int)log10((double)childobj)+1 : strlen("/TrSh0 sh\n"); offs += fprintf(gl2ps->stream, "/Length %d\n" ">>\n" "stream\n", len); offs += fprintf(gl2ps->stream, "/TrSh%d sh\n", childobj); offs += fprintf(gl2ps->stream, "endstream\n" "endobj\n"); return offs; } /* Writes a Extended graphics state for a shaded triangle mask if simplealpha ist true the childobj argument is ignored and a /ca statement will be written instead */ static int gl2psPrintPDFShaderExtGS(int obj, int childobj) { int offs = 0; offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n", obj); offs += fprintf(gl2ps->stream, "/SMask << /S /Alpha /G %d 0 R >> ", childobj); offs += fprintf(gl2ps->stream, ">>\n" "endobj\n"); return offs; } /* a simple graphics state */ static int gl2psPrintPDFShaderSimpleExtGS(int obj, GLfloat alpha) { int offs = 0; offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" "/ca %g" ">>\n" "endobj\n", obj, alpha); return offs; } /* Similar groups of functions for pixmaps and text */ static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im, size_t (*action)(unsigned long data, size_t size), int gray) { int x, y; GLfloat r, g, b, a; if(im->format != GL_RGBA && gray) return 0; if(gray && gray !=8 && gray != 16) gray = 8; gray /= 8; for(y = 0; y < im->height; ++y){ for(x = 0; x < im->width; ++x){ a = gl2psGetRGB(im, x, y, &r, &g, &b); if(im->format == GL_RGBA && gray){ (*action)((unsigned long)(a*255) << 24, gray); } else{ (*action)((unsigned long)(r*255) << 24, 1); (*action)((unsigned long)(g*255) << 24, 1); (*action)((unsigned long)(b*255) << 24, 1); } } } switch(gray){ case 0: return 3 * im->width * im->height; case 1: return im->width * im->height; case 2: return 2 * im->width * im->height; default: return 3 * im->width * im->height; } } static int gl2psPrintPDFPixmap(int obj, int childobj, GL2PSimage *im, int gray) { int offs = 0, done = 0, sigbytes = 3; if(gray && gray !=8 && gray != 16) gray = 8; if(gray) sigbytes = gray / 8; offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" "/Type /XObject\n" "/Subtype /Image\n" "/Width %d\n" "/Height %d\n" "/ColorSpace %s \n" "/BitsPerComponent 8\n", obj, (int)im->width, (int)im->height, (gray) ? "/DeviceGray" : "/DeviceRGB" ); if(GL_RGBA == im->format && gray == 0){ offs += fprintf(gl2ps->stream, "/SMask %d 0 R\n", childobj); } #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psAllocCompress((int)(im->width * im->height * sigbytes)); gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndianCompress, gray); if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ offs += gl2psPrintPDFCompressorType(); offs += fprintf(gl2ps->stream, "/Length %d " ">>\n" "stream\n", (int)gl2ps->compress->destLen); offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream); done = 1; } gl2psFreeCompress(); } #endif if(!done){ /* no compression, or too long after compression, or compress error -> write non-compressed entry */ offs += fprintf(gl2ps->stream, "/Length %d " ">>\n" "stream\n", (int)(im->width * im->height * sigbytes)); offs += gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndian, gray); } offs += fprintf(gl2ps->stream, "\nendstream\n" "endobj\n"); return offs; } static int gl2psPrintPDFText(int obj, GL2PSstring *s, int fontnumber) { int offs = 0; offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" "/Type /Font\n" "/Subtype /Type1\n" "/Name /F%d\n" "/BaseFont /%s\n" "/Encoding /MacRomanEncoding\n" ">>\n" "endobj\n", obj, fontnumber, s->fontname); return offs; } /* Write the physical objects */ static int gl2psPDFgroupListWriteObjects(int entryoffs) { int i,j; GL2PSprimitive *p = NULL; GL2PSpdfgroup *gro; int offs = entryoffs; GL2PStriangle *triangles; int size = 0; if(!gl2ps->pdfgrouplist) return offs; for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(!gl2psListNbr(gro->ptrlist)) continue; p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); switch(p->type){ case GL2PS_POINT: break; case GL2PS_LINE: break; case GL2PS_TRIANGLE: size = gl2psListNbr(gro->ptrlist); triangles = (GL2PStriangle*)gl2psMalloc(sizeof(GL2PStriangle) * size); for(j = 0; j < size; ++j){ p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&triangles[j], p, GL_TRUE); } if(triangles[0].prop & T_VAR_COLOR){ gl2ps->xreflist[gro->shobjno] = offs; offs += gl2psPrintPDFShader(gro->shobjno, triangles, size, 0); } if(triangles[0].prop & T_ALPHA_LESS_1){ gl2ps->xreflist[gro->gsobjno] = offs; offs += gl2psPrintPDFShaderSimpleExtGS(gro->gsobjno, triangles[0].vertex[0].rgba[3]); } if(triangles[0].prop & T_VAR_ALPHA){ gl2ps->xreflist[gro->gsobjno] = offs; offs += gl2psPrintPDFShaderExtGS(gro->gsobjno, gro->trgroupobjno); gl2ps->xreflist[gro->trgroupobjno] = offs; offs += gl2psPrintPDFShaderMask(gro->trgroupobjno, gro->maskshno); gl2ps->xreflist[gro->maskshobjno] = offs; offs += gl2psPrintPDFShader(gro->maskshobjno, triangles, size, 8); } gl2psFree(triangles); break; case GL2PS_PIXMAP: gl2ps->xreflist[gro->imobjno] = offs; offs += gl2psPrintPDFPixmap(gro->imobjno, gro->imobjno+1, p->data.image, 0); if(p->data.image->format == GL_RGBA){ gl2ps->xreflist[gro->imobjno+1] = offs; offs += gl2psPrintPDFPixmap(gro->imobjno+1, -1, p->data.image, 8); } break; case GL2PS_TEXT: gl2ps->xreflist[gro->fontobjno] = offs; offs += gl2psPrintPDFText(gro->fontobjno,p->data.text,gro->fontno); break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text is intended */ if(p->data.text->alignment == GL2PS_PDF) offs += fprintf(gl2ps->stream, "%s\n", p->data.text->str); break; default: break; } } return offs; } /* All variable data has been written at this point and all required functioninality has been gathered, so we can write now file footer with cross reference table and trailer */ static void gl2psPrintPDFFooter(void) { int i, offs; gl2psPDFgroupListInit(); gl2psPDFgroupListWriteMainStream(); offs = gl2ps->xreflist[5] + gl2ps->streamlength; offs += gl2psClosePDFDataStream(); gl2ps->xreflist[5] = offs; offs += gl2psPrintPDFDataStreamLength(gl2ps->streamlength); gl2ps->xreflist[6] = offs; gl2ps->streamlength = 0; offs += gl2psPrintPDFOpenPage(); offs += gl2psPDFgroupListWriteVariableResources(); gl2ps->xreflist = (int*)gl2psRealloc(gl2ps->xreflist, sizeof(int) * (gl2ps->objects_stack + 1)); gl2ps->xreflist[7] = offs; offs += gl2psPrintPDFGSObject(); gl2ps->xreflist[8] = offs; gl2ps->xreflist[gl2ps->objects_stack] = gl2psPDFgroupListWriteObjects(gl2ps->xreflist[8]); /* Start cross reference table. The file has to been opened in binary mode to preserve the 20 digit string length! */ fprintf(gl2ps->stream, "xref\n" "0 %d\n" "%010d 65535 f \n", gl2ps->objects_stack, 0); for(i = 1; i < gl2ps->objects_stack; ++i) fprintf(gl2ps->stream, "%010d 00000 n \n", gl2ps->xreflist[i]); fprintf(gl2ps->stream, "trailer\n" "<<\n" "/Size %d\n" "/Info 1 0 R\n" "/Root 2 0 R\n" ">>\n" "startxref\n%d\n" "%%%%EOF\n", gl2ps->objects_stack, gl2ps->xreflist[gl2ps->objects_stack]); /* Free auxiliary lists and arrays */ gl2psFree(gl2ps->xreflist); gl2psListDelete(gl2ps->pdfprimlist); gl2psPDFgroupListDelete(); #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psFreeCompress(); gl2psFree(gl2ps->compress); gl2ps->compress = NULL; } #endif } /* PDF begin viewport */ static void gl2psPrintPDFBeginViewport(GLint viewport[4]) { int offs = 0; GLint index; GLfloat rgba[4]; int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; glRenderMode(GL_FEEDBACK); if(gl2ps->header){ gl2psPrintPDFHeader(); gl2ps->header = GL_FALSE; } offs += gl2psPrintf("q\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); } else{ glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index); rgba[0] = gl2ps->colormap[index][0]; rgba[1] = gl2ps->colormap[index][1]; rgba[2] = gl2ps->colormap[index][2]; rgba[3] = 1.0F; } offs += gl2psPrintPDFFillColor(rgba); offs += gl2psPrintf("%d %d %d %d re\n" "W\n" "f\n", x, y, w, h); } else{ offs += gl2psPrintf("%d %d %d %d re\n" "W\n" "n\n", x, y, w, h); } gl2ps->streamlength += offs; } static GLint gl2psPrintPDFEndViewport(void) { GLint res; res = gl2psPrintPrimitives(); gl2ps->streamlength += gl2psPrintf("Q\n"); return res; } static void gl2psPrintPDFFinalPrimitive(void) { } /* definition of the PDF backend */ static GL2PSbackend gl2psPDF = { gl2psPrintPDFHeader, gl2psPrintPDFFooter, gl2psPrintPDFBeginViewport, gl2psPrintPDFEndViewport, gl2psPrintPDFPrimitive, gl2psPrintPDFFinalPrimitive, "pdf", "Portable Document Format" }; /********************************************************************* * * SVG routines * *********************************************************************/ static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, GL2PSxyz *xyz, GL2PSrgba *rgba) { int i, j; for(i = 0; i < n; i++){ xyz[i][0] = verts[i].xyz[0]; xyz[i][1] = gl2ps->viewport[3] - verts[i].xyz[1]; xyz[i][2] = 0.0F; for(j = 0; j < 4; j++) rgba[i][j] = verts[i].rgba[j]; } } static void gl2psSVGGetColorString(GL2PSrgba rgba, char str[32]) { int r = (int)(255. * rgba[0]); int g = (int)(255. * rgba[1]); int b = (int)(255. * rgba[2]); int rc = (r < 0) ? 0 : (r > 255) ? 255 : r; int gc = (g < 0) ? 0 : (g > 255) ? 255 : g; int bc = (b < 0) ? 0 : (b > 255) ? 255 : b; sprintf(str, "#%2.2x%2.2x%2.2x", rc, gc, bc); } static void gl2psPrintSVGHeader(void) { int x, y, width, height; char col[32]; time_t now; time(&now); if (gl2ps->options & GL2PS_LANDSCAPE){ x = (int)gl2ps->viewport[1]; y = (int)gl2ps->viewport[0]; width = (int)gl2ps->viewport[3]; height = (int)gl2ps->viewport[2]; } else{ x = (int)gl2ps->viewport[0]; y = (int)gl2ps->viewport[1]; width = (int)gl2ps->viewport[2]; height = (int)gl2ps->viewport[3]; } /* Compressed SVG files (.svgz) are simply gzipped SVG files */ gl2psPrintGzipHeader(); gl2psPrintf("\n"); gl2psPrintf("\n", width, height, x, y, width, height); gl2psPrintf("%s\n", gl2ps->title); gl2psPrintf("\n"); gl2psPrintf("Creator: GL2PS %d.%d.%d%s, %s\n" "For: %s\n" "CreationDate: %s", GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); gl2psPrintf("\n"); gl2psPrintf("\n"); gl2psPrintf("\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ gl2psSVGGetColorString(gl2ps->bgcolor, col); gl2psPrintf("\n", col, (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); } gl2psPrintf("\n"); } static void gl2psPrintSVGSmoothTriangle(GL2PSxyz xyz[3], GL2PSrgba rgba[3]) { int i; GL2PSxyz xyz2[3]; GL2PSrgba rgba2[3]; char col[32]; /* Apparently there is no easy way to do Gouraud shading in SVG without explicitly pre-defining gradients, so for now we just do recursive subdivision */ if(gl2psSameColorThreshold(3, rgba, gl2ps->threshold)){ gl2psSVGGetColorString(rgba[0], col); gl2psPrintf("\n", xyz[0][0], xyz[0][1], xyz[1][0], xyz[1][1], xyz[2][0], xyz[2][1]); } else{ /* subdivide into 4 subtriangles */ for(i = 0; i < 3; i++){ xyz2[0][i] = xyz[0][i]; xyz2[1][i] = 0.5 * (xyz[0][i] + xyz[1][i]); xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = rgba[0][i]; rgba2[1][i] = 0.5 * (rgba[0][i] + rgba[1][i]); rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]); xyz2[1][i] = xyz[1][i]; xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]); rgba2[1][i] = rgba[1][i]; rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[2][i]); xyz2[1][i] = xyz[2][i]; xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[2][i]); rgba2[1][i] = rgba[2][i]; rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]); xyz2[1][i] = 0.5 * (xyz[1][i] + xyz[2][i]); xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]); rgba2[1][i] = 0.5 * (rgba[1][i] + rgba[2][i]); rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); } } static void gl2psPrintSVGDash(GLushort pattern, GLint factor) { int i, n, array[10]; if(!pattern || !factor) return; /* solid line */ gl2psParseStipplePattern(pattern, factor, &n, array); gl2psPrintf("stroke-dasharray=\""); for(i = 0; i < n; i++){ if(i) gl2psPrintf(","); gl2psPrintf("%d", array[i]); } gl2psPrintf("\" "); } static void gl2psEndSVGLine(void) { int i; if(gl2ps->lastvertex.rgba[0] >= 0.){ gl2psPrintf("%g,%g\"/>\n", gl2ps->lastvertex.xyz[0], gl2ps->viewport[3] - gl2ps->lastvertex.xyz[1]); for(i = 0; i < 3; i++) gl2ps->lastvertex.xyz[i] = -1.; for(i = 0; i < 4; i++) gl2ps->lastvertex.rgba[i] = -1.; } } static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap) { #if defined(GL2PS_HAVE_LIBPNG) GL2PSlist *png; unsigned char c; int i; /* The only image types supported by the SVG standard are JPEG, PNG and SVG. Here we choose PNG, and since we want to embed the image directly in the SVG stream (and not link to an external image file), we need to encode the pixmap into PNG in memory, then encode it into base64. */ png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, sizeof(unsigned char)); gl2psConvertPixmapToPNG(pixmap, png); gl2psListEncodeBase64(png); gl2psPrintf("height, pixmap->width, pixmap->height); gl2psPrintf("xlink:href=\"data:image/png;base64,"); for(i = 0; i < gl2psListNbr(png); i++){ gl2psListRead(png, i, &c); gl2psPrintf("%c", c); } gl2psPrintf("\"/>\n"); gl2psListDelete(png); #else gl2psMsg(GL2PS_WARNING, "GL2PS has to be compiled with PNG support in " "order to embed images in SVG streams"); #endif } static void gl2psPrintSVGPrimitive(void *data) { GL2PSprimitive *prim; GL2PSxyz xyz[4]; GL2PSrgba rgba[4]; char col[32]; int newline; prim = *(GL2PSprimitive**)data; if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; /* We try to draw connected lines as a single path to get nice line joins and correct stippling. So if the primitive to print is not a line we must first finish the current line (if any): */ if(prim->type != GL2PS_LINE) gl2psEndSVGLine(); gl2psSVGGetCoordsAndColors(prim->numverts, prim->verts, xyz, rgba); switch(prim->type){ case GL2PS_POINT : gl2psSVGGetColorString(rgba[0], col); gl2psPrintf("\n", xyz[0][0], xyz[0][1], 0.5 * prim->width); break; case GL2PS_LINE : if(!gl2psSamePosition(gl2ps->lastvertex.xyz, prim->verts[0].xyz) || !gl2psSameColor(gl2ps->lastrgba, prim->verts[0].rgba) || gl2ps->lastlinewidth != prim->width || gl2ps->lastpattern != prim->pattern || gl2ps->lastfactor != prim->factor){ /* End the current line if the new segment does not start where the last one ended, or if the color, the width or the stippling have changed (we will need to use multi-point gradients for smooth-shaded lines) */ gl2psEndSVGLine(); newline = 1; } else{ newline = 0; } gl2ps->lastvertex = prim->verts[1]; gl2psSetLastColor(prim->verts[0].rgba); gl2ps->lastlinewidth = prim->width; gl2ps->lastpattern = prim->pattern; gl2ps->lastfactor = prim->factor; if(newline){ gl2psSVGGetColorString(rgba[0], col); gl2psPrintf("width); if(rgba[0][3] < 1.0F) gl2psPrintf("stroke-opacity=\"%g\" ", rgba[0][3]); gl2psPrintSVGDash(prim->pattern, prim->factor); gl2psPrintf("points=\"%g,%g ", xyz[0][0], xyz[0][1]); } else{ gl2psPrintf("%g,%g ", xyz[0][0], xyz[0][1]); } break; case GL2PS_TRIANGLE : gl2psPrintSVGSmoothTriangle(xyz, rgba); break; case GL2PS_QUADRANGLE : gl2psMsg(GL2PS_WARNING, "There should not be any quad left to print"); break; case GL2PS_PIXMAP : gl2psPrintSVGPixmap(xyz[0][0], xyz[0][1], prim->data.image); break; case GL2PS_TEXT : gl2psSVGGetColorString(prim->verts[0].rgba, col); gl2psPrintf("%s\n", col, xyz[0][0], xyz[0][1], prim->data.text->fontsize, prim->data.text->fontname, prim->data.text->str); break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text is intended */ if(prim->data.text->alignment == GL2PS_SVG) gl2psPrintf("%s\n", prim->data.text->str); break; default : break; } } static void gl2psPrintSVGFooter(void) { gl2psPrintf("\n"); gl2psPrintf("\n"); gl2psPrintGzipFooter(); } static void gl2psPrintSVGBeginViewport(GLint viewport[4]) { GLint index; char col[32]; GLfloat rgba[4]; int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; glRenderMode(GL_FEEDBACK); if(gl2ps->header){ gl2psPrintSVGHeader(); gl2ps->header = GL_FALSE; } if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); } else{ glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index); rgba[0] = gl2ps->colormap[index][0]; rgba[1] = gl2ps->colormap[index][1]; rgba[2] = gl2ps->colormap[index][2]; rgba[3] = 1.0F; } gl2psSVGGetColorString(rgba, col); gl2psPrintf("\n", col, x, gl2ps->viewport[3] - y, x + w, gl2ps->viewport[3] - y, x + w, gl2ps->viewport[3] - (y + h), x, gl2ps->viewport[3] - (y + h)); } gl2psPrintf("\n", x, y, w, h); gl2psPrintf(" \n", x, gl2ps->viewport[3] - y, x + w, gl2ps->viewport[3] - y, x + w, gl2ps->viewport[3] - (y + h), x, gl2ps->viewport[3] - (y + h)); gl2psPrintf("\n"); gl2psPrintf("\n", x, y, w, h); } static GLint gl2psPrintSVGEndViewport(void) { GLint res; res = gl2psPrintPrimitives(); gl2psPrintf("\n"); return res; } static void gl2psPrintSVGFinalPrimitive(void) { /* End any remaining line, if any */ gl2psEndSVGLine(); } /* definition of the SVG backend */ static GL2PSbackend gl2psSVG = { gl2psPrintSVGHeader, gl2psPrintSVGFooter, gl2psPrintSVGBeginViewport, gl2psPrintSVGEndViewport, gl2psPrintSVGPrimitive, gl2psPrintSVGFinalPrimitive, "svg", "Scalable Vector Graphics" }; /********************************************************************* * * PGF routines * *********************************************************************/ static void gl2psPrintPGFColor(GL2PSrgba rgba) { if(!gl2psSameColor(gl2ps->lastrgba, rgba)){ gl2psSetLastColor(rgba); fprintf(gl2ps->stream, "\\color[rgb]{%f,%f,%f}\n", rgba[0], rgba[1], rgba[2]); } } static void gl2psPrintPGFHeader(void) { time_t now; time(&now); fprintf(gl2ps->stream, "%% Title: %s\n" "%% Creator: GL2PS %d.%d.%d%s, %s\n" "%% For: %s\n" "%% CreationDate: %s", gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); fprintf(gl2ps->stream, "\\begin{pgfpicture}\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ gl2psPrintPGFColor(gl2ps->bgcolor); fprintf(gl2ps->stream, "\\pgfpathrectanglecorners{" "\\pgfpoint{%dpt}{%dpt}}{\\pgfpoint{%dpt}{%dpt}}\n" "\\pgfusepath{fill}\n", (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); } } static void gl2psPrintPGFDash(GLushort pattern, GLint factor) { int i, n, array[10]; if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor) return; gl2ps->lastpattern = pattern; gl2ps->lastfactor = factor; if(!pattern || !factor){ /* solid line */ fprintf(gl2ps->stream, "\\pgfsetdash{}{0pt}\n"); } else{ gl2psParseStipplePattern(pattern, factor, &n, array); fprintf(gl2ps->stream, "\\pgfsetdash{"); for(i = 0; i < n; i++) fprintf(gl2ps->stream, "{%dpt}", array[i]); fprintf(gl2ps->stream, "}{0pt}\n"); } } static const char *gl2psPGFTextAlignment(int align) { switch(align){ case GL2PS_TEXT_C : return "center"; case GL2PS_TEXT_CL : return "west"; case GL2PS_TEXT_CR : return "east"; case GL2PS_TEXT_B : return "south"; case GL2PS_TEXT_BR : return "south east"; case GL2PS_TEXT_T : return "north"; case GL2PS_TEXT_TL : return "north west"; case GL2PS_TEXT_TR : return "north east"; case GL2PS_TEXT_BL : default : return "south west"; } } static void gl2psPrintPGFPrimitive(void *data) { GL2PSprimitive *prim; prim = *(GL2PSprimitive**)data; switch(prim->type){ case GL2PS_POINT : /* Points in openGL are rectangular */ gl2psPrintPGFColor(prim->verts[0].rgba); fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%fpt}{%fpt}}" "{\\pgfpoint{%fpt}{%fpt}}\n\\pgfusepath{fill}\n", prim->verts[0].xyz[0]-0.5*prim->width, prim->verts[0].xyz[1]-0.5*prim->width, prim->width,prim->width); break; case GL2PS_LINE : gl2psPrintPGFColor(prim->verts[0].rgba); if(gl2ps->lastlinewidth != prim->width){ gl2ps->lastlinewidth = prim->width; fprintf(gl2ps->stream, "\\pgfsetlinewidth{%fpt}\n", gl2ps->lastlinewidth); } gl2psPrintPGFDash(prim->pattern, prim->factor); fprintf(gl2ps->stream, "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgfusepath{stroke}\n", prim->verts[1].xyz[0], prim->verts[1].xyz[1], prim->verts[0].xyz[0], prim->verts[0].xyz[1]); break; case GL2PS_TRIANGLE : if(gl2ps->lastlinewidth != 0){ gl2ps->lastlinewidth = 0; fprintf(gl2ps->stream, "\\pgfsetlinewidth{0.01pt}\n"); } gl2psPrintPGFColor(prim->verts[0].rgba); fprintf(gl2ps->stream, "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgfpathclose\n" "\\pgfusepath{fill,stroke}\n", prim->verts[2].xyz[0], prim->verts[2].xyz[1], prim->verts[1].xyz[0], prim->verts[1].xyz[1], prim->verts[0].xyz[0], prim->verts[0].xyz[1]); break; case GL2PS_TEXT : fprintf(gl2ps->stream, "{\n\\pgftransformshift{\\pgfpoint{%fpt}{%fpt}}\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); if(prim->data.text->angle) fprintf(gl2ps->stream, "\\pgftransformrotate{%f}{", prim->data.text->angle); fprintf(gl2ps->stream, "\\pgfnode{rectangle}{%s}{\\fontsize{%d}{0}\\selectfont", gl2psPGFTextAlignment(prim->data.text->alignment), prim->data.text->fontsize); fprintf(gl2ps->stream, "\\textcolor[rgb]{%g,%g,%g}{{%s}}", prim->verts[0].rgba[0], prim->verts[0].rgba[1], prim->verts[0].rgba[2], prim->data.text->str); fprintf(gl2ps->stream, "}{}{\\pgfusepath{discard}}}\n"); break; case GL2PS_SPECIAL : /* alignment contains the format for which the special output text is intended */ if (prim->data.text->alignment == GL2PS_PGF) fprintf(gl2ps->stream, "%s\n", prim->data.text->str); break; default : break; } } static void gl2psPrintPGFFooter(void) { fprintf(gl2ps->stream, "\\end{pgfpicture}\n"); } static void gl2psPrintPGFBeginViewport(GLint viewport[4]) { GLint index; GLfloat rgba[4]; int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; glRenderMode(GL_FEEDBACK); if(gl2ps->header){ gl2psPrintPGFHeader(); gl2ps->header = GL_FALSE; } fprintf(gl2ps->stream, "\\begin{pgfscope}\n"); if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); } else{ glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index); rgba[0] = gl2ps->colormap[index][0]; rgba[1] = gl2ps->colormap[index][1]; rgba[2] = gl2ps->colormap[index][2]; rgba[3] = 1.0F; } gl2psPrintPGFColor(rgba); fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" "{\\pgfpoint{%dpt}{%dpt}}\n" "\\pgfusepath{fill}\n", x, y, w, h); } fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" "{\\pgfpoint{%dpt}{%dpt}}\n" "\\pgfusepath{clip}\n", x, y, w, h); } static GLint gl2psPrintPGFEndViewport(void) { GLint res; res = gl2psPrintPrimitives(); fprintf(gl2ps->stream, "\\end{pgfscope}\n"); return res; } static void gl2psPrintPGFFinalPrimitive(void) { } /* definition of the PGF backend */ static GL2PSbackend gl2psPGF = { gl2psPrintPGFHeader, gl2psPrintPGFFooter, gl2psPrintPGFBeginViewport, gl2psPrintPGFEndViewport, gl2psPrintPGFPrimitive, gl2psPrintPGFFinalPrimitive, "tex", "PGF Latex Graphics" }; /********************************************************************* * * General primitive printing routine * *********************************************************************/ /* Warning: the ordering of the backends must match the format #defines in gl2ps.h */ static GL2PSbackend *gl2psbackends[] = { &gl2psPS, /* 0 */ &gl2psEPS, /* 1 */ &gl2psTEX, /* 2 */ &gl2psPDF, /* 3 */ &gl2psSVG, /* 4 */ &gl2psPGF /* 5 */ }; static void gl2psComputeTightBoundingBox(void *data) { GL2PSprimitive *prim; int i; prim = *(GL2PSprimitive**)data; for(i = 0; i < prim->numverts; i++){ if(prim->verts[i].xyz[0] < gl2ps->viewport[0]) gl2ps->viewport[0] = (GLint)prim->verts[i].xyz[0]; if(prim->verts[i].xyz[0] > gl2ps->viewport[2]) gl2ps->viewport[2] = (GLint)(prim->verts[i].xyz[0] + 0.5F); if(prim->verts[i].xyz[1] < gl2ps->viewport[1]) gl2ps->viewport[1] = (GLint)prim->verts[i].xyz[1]; if(prim->verts[i].xyz[1] > gl2ps->viewport[3]) gl2ps->viewport[3] = (GLint)(prim->verts[i].xyz[1] + 0.5F); } } static GLint gl2psPrintPrimitives(void) { GL2PSbsptree *root; GL2PSxyz eye = {0.0F, 0.0F, 100.0F * GL2PS_ZSCALE}; GLint used; used = glRenderMode(GL_RENDER); if(used < 0){ gl2psMsg(GL2PS_INFO, "OpenGL feedback buffer overflow"); return GL2PS_OVERFLOW; } if(used > 0) gl2psParseFeedbackBuffer(used); gl2psRescaleAndOffset(); if(gl2ps->header){ if(gl2psListNbr(gl2ps->primitives) && (gl2ps->options & GL2PS_TIGHT_BOUNDING_BOX)){ gl2ps->viewport[0] = gl2ps->viewport[1] = 100000; gl2ps->viewport[2] = gl2ps->viewport[3] = -100000; gl2psListAction(gl2ps->primitives, gl2psComputeTightBoundingBox); } (gl2psbackends[gl2ps->format]->printHeader)(); gl2ps->header = GL_FALSE; } if(!gl2psListNbr(gl2ps->primitives)){ /* empty feedback buffer and/or nothing else to print */ return GL2PS_NO_FEEDBACK; } switch(gl2ps->sort){ case GL2PS_NO_SORT : gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive); gl2psListAction(gl2ps->primitives, gl2psFreePrimitive); /* reset the primitive list, waiting for the next viewport */ gl2psListReset(gl2ps->primitives); break; case GL2PS_SIMPLE_SORT : gl2psListSort(gl2ps->primitives, gl2psCompareDepth); if(gl2ps->options & GL2PS_OCCLUSION_CULL){ gl2psListActionInverse(gl2ps->primitives, gl2psAddInImageTree); gl2psFreeBspImageTree(&gl2ps->imagetree); } gl2psListAction(gl2ps->primitives, gl2psbackends[gl2ps->format]->printPrimitive); gl2psListAction(gl2ps->primitives, gl2psFreePrimitive); /* reset the primitive list, waiting for the next viewport */ gl2psListReset(gl2ps->primitives); break; case GL2PS_BSP_SORT : root = (GL2PSbsptree*)gl2psMalloc(sizeof(GL2PSbsptree)); gl2psBuildBspTree(root, gl2ps->primitives); if(GL_TRUE == gl2ps->boundary) gl2psBuildPolygonBoundary(root); if(gl2ps->options & GL2PS_OCCLUSION_CULL){ gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess, gl2psAddInImageTree, 1); gl2psFreeBspImageTree(&gl2ps->imagetree); } gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, gl2psbackends[gl2ps->format]->printPrimitive, 0); gl2psFreeBspTree(&root); /* reallocate the primitive list (it's been deleted by gl2psBuildBspTree) in case there is another viewport */ gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); break; } gl2psbackends[gl2ps->format]->printFinalPrimitive(); return GL2PS_SUCCESS; } /********************************************************************* * * Public routines * *********************************************************************/ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename) { GLint index; int i; if(gl2ps){ gl2psMsg(GL2PS_ERROR, "gl2psBeginPage called in wrong program state"); return GL2PS_ERROR; } gl2ps = (GL2PScontext*)gl2psMalloc(sizeof(GL2PScontext)); if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))){ gl2ps->format = format; } else { gl2psMsg(GL2PS_ERROR, "Unknown output format: %d", format); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } switch(sort){ case GL2PS_NO_SORT : case GL2PS_SIMPLE_SORT : case GL2PS_BSP_SORT : gl2ps->sort = sort; break; default : gl2psMsg(GL2PS_ERROR, "Unknown sorting algorithm: %d", sort); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } if(stream){ gl2ps->stream = stream; } else{ gl2psMsg(GL2PS_ERROR, "Bad file pointer"); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } gl2ps->header = GL_TRUE; gl2ps->maxbestroot = 10; gl2ps->options = options; gl2ps->compress = NULL; gl2ps->imagemap_head = NULL; gl2ps->imagemap_tail = NULL; if(gl2ps->options & GL2PS_USE_CURRENT_VIEWPORT){ glGetIntegerv(GL_VIEWPORT, gl2ps->viewport); } else{ for(i = 0; i < 4; i++){ gl2ps->viewport[i] = viewport[i]; } } if(!gl2ps->viewport[2] || !gl2ps->viewport[3]){ gl2psMsg(GL2PS_ERROR, "Incorrect viewport (x=%d, y=%d, width=%d, height=%d)", gl2ps->viewport[0], gl2ps->viewport[1], gl2ps->viewport[2], gl2ps->viewport[3]); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } gl2ps->threshold[0] = nr ? 1.0F/(GLfloat)nr : 0.064F; gl2ps->threshold[1] = ng ? 1.0F/(GLfloat)ng : 0.034F; gl2ps->threshold[2] = nb ? 1.0F/(GLfloat)nb : 0.100F; gl2ps->colormode = colormode; gl2ps->buffersize = buffersize > 0 ? buffersize : 2048 * 2048; for(i = 0; i < 3; i++){ gl2ps->lastvertex.xyz[i] = -1.0F; } for(i = 0; i < 4; i++){ gl2ps->lastvertex.rgba[i] = -1.0F; gl2ps->lastrgba[i] = -1.0F; } gl2ps->lastlinewidth = -1.0F; gl2ps->lastpattern = 0; gl2ps->lastfactor = 0; gl2ps->imagetree = NULL; gl2ps->primitivetoadd = NULL; gl2ps->zerosurfacearea = GL_FALSE; gl2ps->pdfprimlist = NULL; gl2ps->pdfgrouplist = NULL; gl2ps->xreflist = NULL; /* get default blending mode from current OpenGL state (enabled by default for SVG) */ gl2ps->blending = (gl2ps->format == GL2PS_SVG) ? GL_TRUE : glIsEnabled(GL_BLEND); glGetIntegerv(GL_BLEND_SRC, &gl2ps->blendfunc[0]); glGetIntegerv(GL_BLEND_DST, &gl2ps->blendfunc[1]); if(gl2ps->colormode == GL_RGBA){ gl2ps->colorsize = 0; gl2ps->colormap = NULL; glGetFloatv(GL_COLOR_CLEAR_VALUE, gl2ps->bgcolor); } else if(gl2ps->colormode == GL_COLOR_INDEX){ if(!colorsize || !colormap){ gl2psMsg(GL2PS_ERROR, "Missing colormap for GL_COLOR_INDEX rendering"); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } gl2ps->colorsize = colorsize; gl2ps->colormap = (GL2PSrgba*)gl2psMalloc(gl2ps->colorsize * sizeof(GL2PSrgba)); memcpy(gl2ps->colormap, colormap, gl2ps->colorsize * sizeof(GL2PSrgba)); glGetIntegerv(GL_INDEX_CLEAR_VALUE, &index); gl2ps->bgcolor[0] = gl2ps->colormap[index][0]; gl2ps->bgcolor[1] = gl2ps->colormap[index][1]; gl2ps->bgcolor[2] = gl2ps->colormap[index][2]; gl2ps->bgcolor[3] = 1.0F; } else{ gl2psMsg(GL2PS_ERROR, "Unknown color mode in gl2psBeginPage"); gl2psFree(gl2ps); gl2ps = NULL; return GL2PS_ERROR; } if(!title){ gl2ps->title = (char*)gl2psMalloc(sizeof(char)); gl2ps->title[0] = '\0'; } else{ gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char)); strcpy(gl2ps->title, title); } if(!producer){ gl2ps->producer = (char*)gl2psMalloc(sizeof(char)); gl2ps->producer[0] = '\0'; } else{ gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char)); strcpy(gl2ps->producer, producer); } if(!filename){ gl2ps->filename = (char*)gl2psMalloc(sizeof(char)); gl2ps->filename[0] = '\0'; } else{ gl2ps->filename = (char*)gl2psMalloc((strlen(filename)+1)*sizeof(char)); strcpy(gl2ps->filename, filename); } gl2ps->primitives = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); gl2ps->auxprimitives = gl2psListCreate(100, 100, sizeof(GL2PSprimitive*)); gl2ps->feedback = (GLfloat*)gl2psMalloc(gl2ps->buffersize * sizeof(GLfloat)); glFeedbackBuffer(gl2ps->buffersize, GL_3D_COLOR, gl2ps->feedback); glRenderMode(GL_FEEDBACK); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psEndPage(void) { GLint res; if(!gl2ps) return GL2PS_UNINITIALIZED; res = gl2psPrintPrimitives(); if(res != GL2PS_OVERFLOW) (gl2psbackends[gl2ps->format]->printFooter)(); fflush(gl2ps->stream); gl2psListDelete(gl2ps->primitives); gl2psListDelete(gl2ps->auxprimitives); gl2psFreeImagemap(gl2ps->imagemap_head); gl2psFree(gl2ps->colormap); gl2psFree(gl2ps->title); gl2psFree(gl2ps->producer); gl2psFree(gl2ps->filename); gl2psFree(gl2ps->feedback); gl2psFree(gl2ps); gl2ps = NULL; return res; } GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]) { if(!gl2ps) return GL2PS_UNINITIALIZED; (gl2psbackends[gl2ps->format]->beginViewport)(viewport); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psEndViewport(void) { GLint res; if(!gl2ps) return GL2PS_UNINITIALIZED; res = (gl2psbackends[gl2ps->format]->endViewport)(); return res; } GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle) { return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle); } GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize) { return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, GL2PS_TEXT_BL, 0.0F); } GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str) { return gl2psAddText(GL2PS_SPECIAL, str, "", 0, format, 0.0F); } GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels) { int size, i; GLfloat pos[4], *piv; GL2PSprimitive *prim; GLboolean valid; if(!gl2ps || !pixels) return GL2PS_UNINITIALIZED; if((width <= 0) || (height <= 0)) return GL2PS_ERROR; if(gl2ps->options & GL2PS_NO_PIXMAP) return GL2PS_SUCCESS; if((format != GL_RGB && format != GL_RGBA) || type != GL_FLOAT){ gl2psMsg(GL2PS_ERROR, "gl2psDrawPixels only implemented for " "GL_RGB/GL_RGBA, GL_FLOAT pixels"); return GL2PS_ERROR; } glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid); if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */ glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = GL2PS_PIXMAP; prim->boundary = 0; prim->numverts = 1; prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); prim->verts[0].xyz[0] = pos[0] + xorig; prim->verts[0].xyz[1] = pos[1] + yorig; prim->verts[0].xyz[2] = pos[2]; prim->culled = 0; prim->offset = 0; prim->pattern = 0; prim->factor = 0; prim->width = 1; glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); prim->data.image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); prim->data.image->width = width; prim->data.image->height = height; prim->data.image->format = format; prim->data.image->type = type; switch(format){ case GL_RGBA: if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ /* special case: blending turned off */ prim->data.image->format = GL_RGB; size = height * width * 3; prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); piv = (GLfloat*)pixels; for(i = 0; i < size; ++i, ++piv){ prim->data.image->pixels[i] = *piv; if(!((i+1)%3)) ++piv; } } else{ size = height * width * 4; prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); } break; case GL_RGB: default: size = height * width * 3; prim->data.image->pixels = (GLfloat*)gl2psMalloc(size * sizeof(GLfloat)); memcpy(prim->data.image->pixels, pixels, size * sizeof(GLfloat)); break; } gl2psListAdd(gl2ps->auxprimitives, &prim); glPassThrough(GL2PS_DRAW_PIXELS_TOKEN); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, const GLfloat position[3], const unsigned char *imagemap){ int size, i; int sizeoffloat = sizeof(GLfloat); if(!gl2ps || !imagemap) return GL2PS_UNINITIALIZED; if((width <= 0) || (height <= 0)) return GL2PS_ERROR; size = height + height * ((width-1)/8); glPassThrough(GL2PS_IMAGEMAP_TOKEN); glBegin(GL_POINTS); glVertex3f(position[0], position[1],position[2]); glEnd(); glPassThrough((GLfloat)width); glPassThrough((GLfloat)height); for(i = 0; i < size; i += sizeoffloat){ float *value = (float*)imagemap; glPassThrough(*value); imagemap += sizeoffloat; } return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psEnable(GLint mode) { GLint tmp; if(!gl2ps) return GL2PS_UNINITIALIZED; switch(mode){ case GL2PS_POLYGON_OFFSET_FILL : glPassThrough(GL2PS_BEGIN_OFFSET_TOKEN); glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &gl2ps->offset[0]); glGetFloatv(GL_POLYGON_OFFSET_UNITS, &gl2ps->offset[1]); break; case GL2PS_POLYGON_BOUNDARY : glPassThrough(GL2PS_BEGIN_BOUNDARY_TOKEN); break; case GL2PS_LINE_STIPPLE : glPassThrough(GL2PS_BEGIN_STIPPLE_TOKEN); glGetIntegerv(GL_LINE_STIPPLE_PATTERN, &tmp); glPassThrough((GLfloat)tmp); glGetIntegerv(GL_LINE_STIPPLE_REPEAT, &tmp); glPassThrough((GLfloat)tmp); break; case GL2PS_BLEND : glPassThrough(GL2PS_BEGIN_BLEND_TOKEN); break; default : gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psEnable: %d", mode); return GL2PS_WARNING; } return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psDisable(GLint mode) { if(!gl2ps) return GL2PS_UNINITIALIZED; switch(mode){ case GL2PS_POLYGON_OFFSET_FILL : glPassThrough(GL2PS_END_OFFSET_TOKEN); break; case GL2PS_POLYGON_BOUNDARY : glPassThrough(GL2PS_END_BOUNDARY_TOKEN); break; case GL2PS_LINE_STIPPLE : glPassThrough(GL2PS_END_STIPPLE_TOKEN); break; case GL2PS_BLEND : glPassThrough(GL2PS_END_BLEND_TOKEN); break; default : gl2psMsg(GL2PS_WARNING, "Unknown mode in gl2psDisable: %d", mode); return GL2PS_WARNING; } return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psPointSize(GLfloat value) { if(!gl2ps) return GL2PS_UNINITIALIZED; glPassThrough(GL2PS_POINT_SIZE_TOKEN); glPassThrough(value); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psLineWidth(GLfloat value) { if(!gl2ps) return GL2PS_UNINITIALIZED; glPassThrough(GL2PS_LINE_WIDTH_TOKEN); glPassThrough(value); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor) { if(!gl2ps) return GL2PS_UNINITIALIZED; if(GL_FALSE == gl2psSupportedBlendMode(sfactor, dfactor)) return GL2PS_WARNING; glPassThrough(GL2PS_SRC_BLEND_TOKEN); glPassThrough((GLfloat)sfactor); glPassThrough(GL2PS_DST_BLEND_TOKEN); glPassThrough((GLfloat)dfactor); return GL2PS_SUCCESS; } GL2PSDLL_API GLint gl2psSetOptions(GLint options) { if(!gl2ps) return GL2PS_UNINITIALIZED; gl2ps->options = options; return GL2PS_SUCCESS; } GL2PSDLL_API const char *gl2psGetFileExtension(GLint format) { if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))) return gl2psbackends[format]->file_extension; else return "Unknown format"; } GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format) { if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0]))) return gl2psbackends[format]->description; else return "Unknown format"; } #endif /* GL */ xmakemol-5.16/bbox.h0000644000175000017500000000245110664010200011275 00000000000000/* Copyright (C) 1998, 1999, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BBOX_H__ #define __BBOX_H__ enum bbox_type {AUTOMATIC, FROM_FILE}; #ifdef __BBOX_C__ bounding_box bbox; enum bbox_type bbox_type = AUTOMATIC; Widget bbox_dialog = NULL; /* wjq */ Widget bbMin[4], bbMax[4]; /* 0: The whole entry line for Min, Max values, 1,2,3: Entry fields for x,y,z respectively */ #else /* __BBOX_C__ */ extern bounding_box bbox; extern enum bbox_type bbox_type; extern Widget bbox_dialog; extern Widget bbMin[4], bbMax[4]; #endif /* __BBOX_C__ */ #endif /* __BBOX_H__ */ xmakemol-5.16/config.h0000644000175000017500000002650610665570701011641 00000000000000/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ #define HAVE_MOTIF 1 #define XPM 1 #define VERSION "5.16" #define GL 1 /* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE /* #undef _ALL_SOURCE */ #endif /* Define if using alloca.c. */ /* #undef C_ALLOCA */ /* Define if type char is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ /* #undef __CHAR_UNSIGNED__ */ #endif /* Define if the closedir function returns void instead of int. */ /* #undef CLOSEDIR_VOID */ /* Define to empty if the keyword does not work. */ /* #undef const */ /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define for DGUX with . */ /* #undef DGUX */ /* Define if you have . */ /* #undef DIRENT */ /* Define to the type of elements in the array set by `getgroups'. Usually this is either `int' or `gid_t'. */ /* #undef GETGROUPS_T */ /* Define if the `getloadavg' function needs to be run setuid or setgid. */ /* #undef GETLOADAVG_PRIVILEGED */ /* Define if the `getpgrp' function takes no argument. */ /* #undef GETPGRP_VOID */ /* Define to `int' if doesn't define. */ /* #undef gid_t */ /* Define if you have alloca, as a function or macro. */ #define HAVE_ALLOCA 1 /* Define if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define if you don't have vprintf but do have _doprnt. */ /* #undef HAVE_DOPRNT */ /* Define if your system has a working fnmatch function. */ /* #undef HAVE_FNMATCH */ /* Define if your system has its own `getloadavg' function. */ /* #undef HAVE_GETLOADAVG */ /* Define if you have the getmntent function. */ /* #undef HAVE_GETMNTENT */ /* Define if the `long double' type works. */ /* #undef HAVE_LONG_DOUBLE */ /* Define if you support file names longer than 14 characters. */ /* #undef HAVE_LONG_FILE_NAMES */ /* Define if you have a working `mmap' system call. */ /* #undef HAVE_MMAP */ /* Define if system calls automatically restart after interruption by a signal. */ /* #undef HAVE_RESTARTABLE_SYSCALLS */ /* Define if your struct stat has st_blksize. */ /* #undef HAVE_ST_BLKSIZE */ /* Define if your struct stat has st_blocks. */ /* #undef HAVE_ST_BLOCKS */ /* Define if you have the strcoll function and it is properly defined. */ /* #undef HAVE_STRCOLL */ /* Define if your struct stat has st_rdev. */ /* #undef HAVE_ST_RDEV */ /* Define if you have the strftime function. */ /* #undef HAVE_STRFTIME */ /* Define if you have the ANSI # stringizing operator in cpp. */ /* #undef HAVE_STRINGIZE */ /* Define if you have that is POSIX.1 compatible. */ /* #undef HAVE_SYS_WAIT_H */ /* Define if your struct tm has tm_zone. */ /* #undef HAVE_TM_ZONE */ /* Define if you don't have tm_zone but do have the external array tzname. */ /* #undef HAVE_TZNAME */ /* Define if you have . */ #define HAVE_UNISTD_H 1 /* Define if utime(file, NULL) sets file's timestamp to the present. */ /* #undef HAVE_UTIME_NULL */ /* Define if you have . */ /* #undef HAVE_VFORK_H */ /* Define if you have the vprintf function. */ /* #undef HAVE_VPRINTF */ /* Define if you have the wait3 system call. */ /* #undef HAVE_WAIT3 */ /* Define as __inline if that's what the C compiler calls it. */ /* #undef inline */ /* Define if int is 16 bits instead of 32. */ /* #undef INT_16_BITS */ /* Define if long int is 64 bits. */ /* #undef LONG_64_BITS */ /* Define if major, minor, and makedev are declared in . */ /* #undef MAJOR_IN_MKDEV */ /* Define if major, minor, and makedev are declared in . */ /* #undef MAJOR_IN_SYSMACROS */ /* Define if on MINIX. */ /* #undef _MINIX */ /* Define to `int' if doesn't define. */ /* #undef mode_t */ /* Define if you don't have , but have . */ /* #undef NDIR */ /* Define if you have , and doesn't declare the mem* functions. */ /* #undef NEED_MEMORY_H */ /* Define if your struct nlist has an n_un member. */ /* #undef NLIST_NAME_UNION */ /* Define if you have . */ /* #undef NLIST_STRUCT */ /* Define if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Define if your Fortran 77 compiler doesn't accept -c and -o together. */ /* #undef F77_NO_MINUS_C_MINUS_O */ /* Define to `long' if doesn't define. */ /* #undef off_t */ /* Define to `int' if doesn't define. */ /* #undef pid_t */ /* Define if the system does not provide POSIX.1 features except with this defined. */ /* #undef _POSIX_1_SOURCE */ /* Define if you need to in order for stat and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define as the return type of signal handlers (int or void). */ /* #undef RETSIGTYPE */ /* Define to the type of arg1 for select(). */ /* #undef SELECT_TYPE_ARG1 */ /* Define to the type of args 2, 3 and 4 for select(). */ /* #undef SELECT_TYPE_ARG234 */ /* Define to the type of arg5 for select(). */ /* #undef SELECT_TYPE_ARG5 */ /* Define if the `setpgrp' function takes no argument. */ /* #undef SETPGRP_VOID */ /* Define if the setvbuf function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ /* #undef SETVBUF_REVERSED */ /* Define to `unsigned' if doesn't define. */ /* #undef size_t */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define on System V Release 4. */ /* #undef SVR4 */ /* Define if you don't have , but have . */ /* #undef SYSDIR */ /* Define if you don't have , but have . */ /* #undef SYSNDIR */ /* Define if `sys_siglist' is declared by . */ /* #undef SYS_SIGLIST_DECLARED */ /* Define if you can safely include both and . */ /* #undef TIME_WITH_SYS_TIME */ /* Define if your declares struct tm. */ /* #undef TM_IN_SYS_TIME */ /* Define to `int' if doesn't define. */ /* #undef uid_t */ /* Define for Encore UMAX. */ /* #undef UMAX */ /* Define for Encore UMAX 4.3 that has instead of . */ /* #undef UMAX4_3 */ /* Define if you do not have , index, bzero, etc.. */ /* #undef USG */ /* Define vfork as fork if vfork does not work. */ /* #undef vfork */ /* Define if the closedir function returns void instead of int. */ /* #undef VOID_CLOSEDIR */ /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ /* Define if the X Window System is missing or not being used. */ /* #undef X_DISPLAY_MISSING */ /* Define if lex declares yytext as a char * by default, not a char[]. */ /* #undef YYTEXT_POINTER */ /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define this to use OpenGL widget from */ /* #undef HAVE_GL_GLWDRAWA_H */ /* Define this to use OpenGL widget from */ #define HAVE_GL_GLWMDRAWA_H 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strstr' function. */ #define HAVE_STRSTR 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 /* Define this to use OpenGL widget from */ /* #undef HAVE_X11_GLW_GLWDRAWA_H */ /* Define this to use OpenGL widget from */ /* #undef HAVE_X11_GLW_GLWMDRAWA_H */ /* Name of package */ #define PACKAGE "xmakemol" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "5.16" /* Define this to the Xt/Motif OpenGL widget class to use */ #define XT_GLWIDGET glwMDrawingAreaWidgetClass /* Define to 1 if the X Window System is missing or not being used. */ /* #undef X_DISPLAY_MISSING */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ xmakemol-5.16/draw.h0000644000175000017500000000226010664010176011312 00000000000000/* Copyright (C) 1998, 1999, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __DRAW_H__ #define __DRAW_H__ #ifdef __DRAW_C__ double cartesian_bond_points[6][3]; double cartesian_hbond_points[2][3]; XPoint canvas_bond_points[6]; XPoint canvas_hbond_points[2]; #else /* __DRAW_C__ */ extern double cartesian_bond_points[6][3]; extern double cartesian_hbond_points[2][3]; extern XPoint canvas_bond_points[6]; extern XPoint canvas_hbond_points[2]; #endif /* __DRAW_C__ */ #endif /* __DRAW_H */ xmakemol-5.16/globals.h0000644000175000017500000001557710664010174012015 00000000000000/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __GLOBALS_H__ #define __GLOBALS_H__ #define MAX_VECTORS_PER_ATOM (3) /* enum types */ enum gl_render_types { DEFAULT, BALL_AND_STICK, TUBES }; struct atoms { char label[4]; char uppercase_label[4]; double x,y,z; /* real x,y and z */ double ox,oy,oz; /* old x,y and z */ double g[3]; /* in global axis system */ /* Vector */ double v[MAX_VECTORS_PER_ATOM][3]; /* Ellipse */ double euler[3]; double shape[3]; double max_shape; double mass; double cov_rad; /* covalent radius */ double vdw_rad; /* van der Waals radius */ char color[20]; int pixel; Boolean edit; /* is to be edited (ie rotated/translated) ? */ Boolean sel; /* is selected ? */ Boolean visi; /* is visible ? */ unsigned short red,green,blue; Boolean is_hydrogen; /* is the atom Hydrogen? */ int type; /* atom type index */ int has_vector; int is_ellipse; enum gl_render_types gl_render_type; int molecule; }; struct elements { char label[4]; double mass; double cov_rad; double vdw_rad; char color[20]; int pixel; unsigned short red,green,blue; Boolean any_atoms; Boolean color_allocated; Boolean customized; /* aro */ }; typedef struct BOUNDING_BOX bounding_box; struct BOUNDING_BOX { double x_min, x_max; double y_min, y_max; double z_min, z_max; double v[8][3]; }; /* Struct frame contains the number of atoms, the comment and pointers to struct *atom and the next frame */ struct atom { /* Coordinates */ double x; double y; double z; /* Vector */ double vx[MAX_VECTORS_PER_ATOM]; double vy[MAX_VECTORS_PER_ATOM]; double vz[MAX_VECTORS_PER_ATOM]; /* Ellipse */ double euler[3]; double shape[3]; /* Properties */ char label[4]; int has_vector; int is_ellipse; Boolean visi; /* Override default colors: either RGB or name */ Boolean has_rgb; double red, green, blue; Boolean has_color_name; char color_name[32]; enum gl_render_types gl_render_type; int molecule; }; struct frame { int no_atoms; char comment[1024]; struct atom *atom; struct frame *next; int perspective_depth; int perspective_scale; /* This is the bounding box from the input file, if any */ double bbox[3][2]; /* x, y, z; min, max */ Boolean bbox_available; }; enum render_stereo_types { NO_STEREO = 0, SIDE_BY_SIDE = 1, RED_BLUE = 2, SGI_HARDWARE = 3 }; #define ROTATE_ABOUT_ORIGIN 0 #define ROTATE_ABOUT_LOCAL_COM 1 #define MAX_PRINTERS 20 /* aro */ #ifdef __XMAKEMOL_C__ int no_atoms; int no_atom_types; int rotate_about = ROTATE_ABOUT_LOCAL_COM; int *atom_types; int no_frames = 0; int frame_no; int sel_init=0; int selected[4]; int bg_color_parsed;/* aro */ Arg args[20]; /* should be enough! */ Dimension canvas_width=450; Dimension canvas_height=450; char bg_color[30]="lightgray"; char bb_color[30]="darkgray"; char sel_color_name[30]="orange"; XColor sel_color; char current_file_name[1024] = ""; /* aro */ double depth; double global_vector[3]; double global_matrix[3][3]; double angle_axis_matrix[3][3]; double bd_scale=1.0; double bdfd_factor=1.0; double hbdfd_factor=1.0; double ibdfd_factor=1.0; double ihbdfd_factor=1.0; double largest_cov_rad; Boolean redraw; Boolean inhibit_canvas_callback = 0; Boolean centre_each_frame=0; Boolean depth_is_on=1; Boolean never_use_vdw = 0; Boolean atoms_sorted=0; Boolean any_hydrogen; Boolean view_ghost_atoms = False; Widget main_w,toplevel,label,canvas,message_area; Widget frames_dialog = NULL; Widget anim_dialog = NULL; Widget meas_dialog = NULL; Widget pers_dialog = NULL; Widget edit_visi_dialog = NULL; Widget edit_posn_dialog = NULL; Widget edit_atbd_sizes_dialog = NULL; Widget edit_bond_fudges_dialog = NULL; Widget edit_element_props_dialog = NULL; /* aro */ Widget gl_render_dialog = NULL; /* aro */ Widget scale_coords_dialog = NULL; Widget *meas_label_w=NULL; Widget nth_menu[6]; XGCValues gcv; GC gc; Pixmap canvas_pm; Display *display; Screen *screen_ptr; int screen_num; int screen_depth; Drawable root_window; XmString str; struct atoms *atoms; struct elements *element; int *sorted_atoms; bounding_box bbox, file_bbox, bbox_by_hand; Boolean bbox_available; Boolean changing_frame; #else /* __XMAKEMOL_C__ */ extern int no_atoms; extern int no_atom_types; extern int rotate_about; extern int *atom_types; extern int no_frames; extern int frame_no; extern int sel_init; extern int selected[4]; extern int bg_color_parsed; /* aro */ extern Arg args[20]; extern Dimension canvas_width; extern Dimension canvas_height; extern char bg_color[30]; extern char bb_color[30]; extern char sel_color_name[30]; extern XColor sel_color; extern char current_file_name[1024]; /* aro */ extern double depth; extern double global_vector[3]; extern double global_matrix[3][3]; extern double angle_axis_matrix[3][3]; extern double bd_scale; extern double bdfd_factor; extern double hbdfd_factor; extern double ibdfd_factor; extern double ihbdfd_factor; extern double largest_cov_rad; extern Boolean redraw; extern Boolean inhibit_canvas_callback; extern Boolean centre_each_frame; extern Boolean depth_is_on; extern Boolean never_use_vdw; extern Boolean atoms_sorted; extern Boolean any_hydrogen; extern Boolean view_ghost_atoms; extern Widget main_w,toplevel,label,canvas,message_area; extern Widget frames_dialog; extern Widget anim_dialog; extern Widget meas_dialog; extern Widget pers_dialog; extern Widget edit_visi_dialog; extern Widget edit_posn_dialog; extern Widget edit_atbd_sizes_dialog; extern Widget edit_bond_fudges_dialog; extern Widget edit_element_props_dialog;/* aro */ extern Widget gl_render_dialog; /* aro */ extern Widget scale_coords_dialog; extern Widget *meas_label_w; extern Widget nth_menu[6]; extern XGCValues gcv; extern GC gc; extern Pixmap canvas_pm; extern Display *display; extern Screen *screen_ptr; extern int screen_num; extern int screen_depth; extern Drawable root_window; extern struct atoms *atoms; extern struct elements *element; extern int *sorted_atoms; extern bounding_box bbox, file_bbox, bbox_by_hand; extern Boolean bbox_available; extern Boolean changing_frame; #endif /* __XMAKEMOL_C__ */ #endif /* __GLOBALS_H__ */ xmakemol-5.16/view.h0000644000175000017500000000241610664010170011324 00000000000000/* Copyright (C) 1998, 1999, 2003, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __VIEW_H__ #define __VIEW_H__ #ifdef __VIEW_C__ Boolean atom_flag=1; Boolean bond_flag=1; Boolean hbond_flag=1; Boolean vector_flag=1; Boolean at_nos_flag=0; Boolean at_sym_flag=0; Boolean axes_flag=0; Boolean bbox_flag=0; #else /* __VIEW_C__ */ extern Boolean atom_flag; extern Boolean bond_flag; extern Boolean hbond_flag; extern Boolean vector_flag; extern Boolean at_nos_flag; extern Boolean at_sym_flag; extern Boolean axes_flag; extern Boolean bbox_flag; #endif /* __VIEW_C__ */ #endif /* __VIEW_H__ */ xmakemol-5.16/bonds.h0000644000175000017500000000212010664010200011441 00000000000000/* Copyright (C) 1998, 1999, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BONDS_H__ #define __BONDS_H__ struct node { int v; struct node *next; }; #ifdef __FILE_C__ struct node **bond_adjacency_list; struct node **hbond_adjacency_list; #else /* __FILE_C__ */ extern struct node **bond_adjacency_list; extern struct node **hbond_adjacency_list; #endif /* __FILE_C__ */ #endif /* __BONDS_H__ */ xmakemol-5.16/defs.h0000644000175000017500000000235010664010177011277 00000000000000/* Copyright (C) 1998, 1999, 2001, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __DEFS_H__ #define __DEFS_H__ #define DEPTH (50) #define BOND (1.12) /* 1.12 Bond fudge factor */ #define BOND2 (BOND*BOND) #define HBOND (2.5) #define MAX_ELEMENTS 150 #define PI (3.1415926536) #define DEG2RAD (PI / 180.0) #define Z_TOL (0.5) /* The sum of the covalent radii is approximately the length of the bond. This factor determines what proportion of the bond is initially visible. A value of 0.5 is reasonable */ #define DEFAULT_AT_SCALE (0.5) #endif /* __DEFS_H__ */ xmakemol-5.16/gl_funcs.h0000644000175000017500000000251610664010175012160 00000000000000/* Copyright (C) 2000, 2003, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #ifndef __GL_FUNCS_H__ #define __GL_FUNCS_H__ #ifdef __GL_FUNCS_C__ int gl_attrib[] = {GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 16, None}; GLXContext glx_context; XVisualInfo *visinfo; #else /* __GL_FUNCS_C__ */ extern int gl_attrib[]; extern GLXContext glx_context; extern XVisualInfo *visinfo; #endif /* __GL_FUNCS_C__ */ #endif /* __GL_FUNCS_H__ */ xmakemol-5.16/vectors.h0000644000175000017500000000214510664010170012036 00000000000000/* Copyright (C) 1999, 2000, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __VECTORS_H__ #define __VECTORS_H__ enum arrow_types {ARROW_OPEN, ARROW_CLOSED, ARROW_FILLED}; #ifdef __VECTORS_C__ enum arrow_types arrow_type = ARROW_OPEN; XPoint canvas_vector_points[5]; #else /* __VECTORS_C__ */ extern enum arrow_types arrow_type; extern XPoint canvas_vector_points[5]; #endif /* __VECTORS_C__ */ #endif /* __VECTORS_H__ */ xmakemol-5.16/xm_logo.h0000644000175000017500000062075610664010167012041 00000000000000/* XPM */ /* Copyright (C) 1998, 1999, 2005 Matthew P. Hodges This file is part of XMakemol. XMakemol is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XMakemol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XMakemol; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This image was produced by the GIMP (GNU Image Manipulation Program) - see http://www.gimp.org */ static char * xm_logo[] = { "450 450 5 1", " c None", ". c #B9B9B9", "+ c #000000", "@ c #3F4F61", "# c #FF0000", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "...........................................................................................................................................................................................++++++++.............................................................++++++++..........................................................................................................................................................................................", "........................................................................................................................................................................................+++@@@@@@@@+++.......................................................+++@@@@@@@@+++.......................................................................................................................................................................................", "......................................................................................................................................................................................++@@@@@@@@@@@@@@++...................................................++@@@@@@@@@@@@@@++.....................................................................................................................................................................................", "....................................................................................................................................................................................++@@@@@@@@@@@@@@@@@@++...............................................++@@@@@@@@@@@@@@@@@@++...................................................................................................................................................................................", "...................................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@+.............................................+@@@@@@@@@@@@@@@@@@@@@@+..................................................................................................................................................................................", "..................................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@@@@@@@@@@@@@@@@@@@@@+.................................................................................................................................................................................", ".................................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................................................................................................................................................", "................................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................................................................................................................................", "...............................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................................................", "...............................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................................................", "..............................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................................................", "..............................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................................................", ".............................................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................................................................................................................................................", "...............................................................................................................................................................++++++++......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................................................................................................................................................", "...........................................................................................................................................................++++@@@@@@@@++++..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......++++++++..............................................................................................................................................................", ".........................................................................................................................................................++@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++++++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.++++@@@@@@@@++++..........................................................................................................................................................", "........................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@++........................................................................................................................................................", "......................................................................................................................................................++@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+.......................................................................................................................................................", ".....................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@++.....................................................................................................................................................", "....................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................................................................................", "...................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+++@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................................................................................................................", "..................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................................................................................", "..................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@++++++++@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................................................................................................................................", ".................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@+........++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................................................................................................................................", "................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@@@@@@@@@@@@@@@@@@@@@+..........+++@@@@@@@@@+++........+@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................................................................................................................", "................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@+.......+++@@@@@@@@@@@@@@@+++.....+@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@@@@@@@@@@@@@@@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@+.....++@@@@@@@@@@@@@@@@@@@@@@@++...+@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@+@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+++++++@@@@@@@@@++.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...++@@@@@@@@@@@@@+++++@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@++++++@++......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....++@@@@@@+++++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@@+++++....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......++++++@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@+++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++++@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "..............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "...............................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@@@@@+++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................................................................................................", "................................................................................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+++++@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@+++++...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++..............................................................................................................................................", "..............................................................................................................................................++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+++++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+++++........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+.............................................................................................................................................", ".............................................................................................................................................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+++++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+++++..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@++...........................................................................................................................................", "............................................................................................................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++...................++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@+..........................................................................................................................................", "..........................................................................................................................................++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+.........................................................................................................................................", ".........................................................................................................................................+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+++++++....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@++.......................................................................................................................................", ".......................................................................................................................................++@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+++...........+++@@@@@@@+++.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++..............++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+......................................................................................................................................", "......................................................................................................................................+@@@@@@@@@@@@++@++@@@@@@@@@@@@@@@@@@@@@@+++@@++.......++@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+++.........++@@+@+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@+.....................................................................................................................................", ".....................................................................................................................................+@@@@@@@@@@@@++@@@@+@@@@@@@@@@@@@@@@@@@@+@@+@@@@+.....+@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@++......+@@@@+@@++@@@@@@@@@@@@@@@@@@@@@@+++++@@@@@@@@@@@@@++...................................................................................................................................", "...................................................................................................................................++@@@@@@@@@@@@+@@+@@@@++@@@@@@@@@@@@@@@@++@@+@@@@+@++..+@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@+...++@+@@@@+@@@+@@@@@@@@@@@@@@@@@@@@+@++@+++@@@@@@@@@@@@@+..................................................................................................................................", "..................................................................................................................................+@@@@@@@@@@@@++@@@@+@@@@@++++@@@@@@@@++++@@@+@@@@@+@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+++@@@+@@@@@+@@@++@@@@@@@@@@@@@@@@++@++@@@@++@@@@@@@@@@@@@+.................................................................................................................................", ".................................................................................................................................+@+@@@@@@@@@@+@@@@@@@+@@@@@@@@++++++++@@@@@@+++@@@+@@@@@++@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@+@@@@@+@@@@++++@@@@@@@@++++@@+.+@@@@@++@@@@@@@@@@@+@++...............................................................................................................................", "...............................................................................................................................++@@@+@@@@@@@++@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+...++@+@@@@@@@++@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@++@@@@@@@@+@@@+.+@@@@@@@++++++++@@@@@+.+@@@@@@@@++@@@@@@@@@+@@@+..............................................................................................................................", "..............................................................................................................................+@@@@@@+@@@@@+@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@+......+@@@@@@@@@@+@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@+@@@@@@@@@@+@++...+@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@++@@@@@@@+@@@@@+.............................................................................................................................", ".............................................................................................................................+@@@@@@@+@@@@+@@@@@@@@@@++..++@@@@@@@@@@@@@@++........++@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@@@+......++@@@@@@@@@@@@@@++...+@@@@@@@@@@@+@@@@@+@@@@@@@++...........................................................................................................................", "...................................................................................................++++++++................++@@@@@@@@@+@++@@@@@@@@@@+......+++@@@@@@@@+++............+@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+@@@@@@@@++.........+++@@@@@@@@+++......++@@@@@@@@@@++@@+@@@@@@@@@@+...............+++++++++..................................................................................................", "...............................................................................................++++@@@@@@@@++++...........+@@@@@@@@@@@@+@@@@@@@@@@++..........++++++++................++@@@+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@+@@@@@++..............++++++++...........+@@@@@@@@@@@+@+@@@@@@@@@@@++..........+++@@@@@@@@@+++...............................................................................................", ".............................................................................................++@@@@@@@@@@@@@@@@++........+@@@@@@@@@@@@+@+@@@@@@@@+...................................+@@++@+@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@+@@@++....................................+@@@@@@@@@+@+@@@@@@@@@@@@@@+.......++@@@@@@@@@@@@@@@++.............................................................................................", "............................................................................................+@@@@@@@@@@@@@@@@@@@@+.....++@@@@@@@@@@@++@@@+@@@@@++....................................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+++@@+....................................++@@@@@@@+@@++@@@@@@@@@@@@@+....++@@@@@@@@@@@@@@@@@@@++...........................................................................................", "..........................................................................................++@@@@@@@@@@@@@@@@@@@@@@++..+@@@@@@@@@@@@+@@@@@+@@@@+......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@++++++++++@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@+@@@@+......................................+@@@@@+@@@@@+@@@@@@@@@@@@@++.+@@@@@@@@@@@@@@@@@@@@@@@+..........................................................................................", ".........................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@+@@@@@@@+@++.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@+@@@@@@@@+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................+@@@+@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................................................................", "........................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@++@@@@@@@@@+.........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@+@@@@@+@@@@@@@@+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................++@+@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................................................................", ".......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+@@@@@@@@@++..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@+++@@+@@@@@@@@+@@@++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................+@@@@@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................................", "......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@+@@@@@@@@@+............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@+++@@@@@@@@++++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@@@@@@@@++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................................", "......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@++@@@@@@@@@+..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.++++++++++@@@@@@@@++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................++@@@@@@@@@@++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................................", ".....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+@@@@@@@@@++...............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................+@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@@+.................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................+@@@@@@@@@++++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@++@@@@@+...................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................................++@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "...................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@++....................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................+@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................................................", "...................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@++@+.......................................................+@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................+@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................................................", "...................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++.........................................................+@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@+.......................................................++@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+...........................................................+@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@+..........................................................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+..........................................................+@+@@@@@@@@@@@@@@@@@+...............+@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@++..........................................................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.........................................................+@@++@@@@@@@@@@@@@++................+@@@@@@@@+............+@@@@@@@@@@@@@@@@@+@+..........................................................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+........................................................+@@@@@+++@@@@@@@+++..................++++++++++.............++@@@@@@@@@@@@@++@@@+........................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+........................................................+@@@@@@+.+++++++.....................+@@@@@@@@+...............+++@@@@@@@+++@@@@@+........................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.......................................................+@@@@@@@+.............................+@@@@@@@@+..................+++++++..+@@@@@@+.......................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "..................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+......................................................+@@@@@@@+..............................+@@@@@@@@+............................+@@@@@+.......................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "...........................................................................++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+......................................................+@@@@@@+...............................+@@@@@@@@+............................+@@@@@@+......................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................................", "........................................................................+++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.....................................................+@@@@@@@+...............................+@@@@@@@@+.............................+@@@@@+......................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++++............................................................................", "......................................................................++@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.....................................................+@@@@@@+................................+@@@@@@@@+.............................+@@@@@@+.....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+++.........................................................................", ".....................................................................+@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.....................................................+@@@@@@@+................................+@@@@@@@@+..............................+@@@@@+.....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@++.......................................................................", "....................................................................+@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....................................................+@+@@@@@+.................................++++++++++..............................+@@@@@@+.....................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@+......................................................................", "...................................................................+@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....................................................+@@++@@+...............................+++@@@@@@@@@@+++............................+@@@++@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+.....................................................................", "..................................................................+@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....................................................+@@@@@+@+............................+++@@@@@@@@@@@@@@@@+++.........................+@++@@@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+....................................................................", ".................................................................+@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....................................................+@@@@@@+............................+@@@@@@@@@@@@@@@@@@@@@@+.........................+@@@@@@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@+...................................................................", "................................................................+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....................................................+@@@@@@+...........................++@@@@@@@@@@@@@@@@@@@@@@@@++........................+@@@@@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@+..................................................................", "...............................................................+@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+.....................................................+@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................+@@@@@@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@+.................................................................", "...............................................................+@@@@@@@@@@@@@@@@@@@@+@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+.....................................................+@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................+@@@@@@+....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@+................................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+......................................................+@@@@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@@+.....................................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+@@@@@@@@@@@@@@@@@+................................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+.............................................++++++++.+@@@@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@@+++++++++.............................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+@@@@@@@@@@@@@@@@@@@+...............................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@+++++@@@@@@@@@@@@@@@+@++............................................++@@@@@@@@++@@@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@+@@@@@@@@++............................................+@@@@@@+@@@@@@@@@@@@@@@@+++@@@@+@@@@++@@@@@@@@@@@@@@@@@@@@+...............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@+@@@++@@@@+@@@@+++++@@@@@@@@+++++...........................................++@@@@@@@@@@+@@@@@@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@@+@@@@@@@@@++...........................................++@@@@@++@@@@@@@@@@++++@@+@@+++@@@+@@@@@@@@@@@@@@@@@@@@@@+...............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@+@@+@@@+@@@@@@@@+@@@@@@@++@@@+..........................................+@@@@@@@@@@@@@++@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@++@@@@@@@@@@@@+...........................................++++@@@@++@@@@@@++@@@@@@+++@@@+@+@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@++@+@@@@@@@@+@@@@@++@@@@@@+........................................+@@@@@@@@@@@@@@@@++@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................+@++@@@@@@@@@@@@@@@+..........................................+@@@+++++++++@@@+@@@@@@@+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@++++.+@@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@++.......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@+@@@@@@@@@@@@@@@@@@+.........................................+@@@@@@+.....++++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+++.....+@@@@@++......................................+@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@+.......................................+@@@@@@+.........+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+........+@+++@+.....................................+@@@@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@+......................................++++@@@+..........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+........++@@@@+.....................................+@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@+......................................+@@@++++..........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+........+@@@@@@+...................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................+@@@@@@+..........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", ".............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+........+@@@@@@+...................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................+@@@@@@+...........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+.........+@@@@@++++...............................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................+++++@@@@@@+...........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+.........+@@@@@+@@@+++............................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................+++@@@@+@@@@@@+...........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................", "..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+.......+++@@@@@+@@@@@@++..........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................++@@@@@@@+@@@@@++...........+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................", "...............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+.......+@@+@@@@@@+@@@@@@@+.........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................+@@@@@@@@+@@@@@@+@+...........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................................", "...............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+......+@@@@+@@@@@+@@@@@@@@+.......................+++@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@++.......................+@@@@@@@@@+@@@@@@+@@+..........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................................", "................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++@@@@+.....+@@@@@+@@++++@@@@@@@@@+................++++++@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@++++..................+@@@@@@@@@@++@@@@@+@@@+.........+@@@+++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................................", ".................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@+++++....+@@@@@@+++@@@@@@@@@@@@@@+..........+++++@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++++.............+@@@@@@@@@@@@@+++@+@@@@@+........++++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................................................", "..................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@+.....++++@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@++++........+@@@@@@@@@@@@@@@@@++@@@@@@+.......+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................", "...................................................................+@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@+.++++@@@@@@+@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@@++++++..+@@@@@@@@@@@@@@@@@@@@@@@@@+.......+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@+@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@@@@@++++.+@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@+.....................................................................", "......................................................................++@@@@@@@@@@@@@@@++....+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@++++.....+@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@+.++++@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@+......................................................................", ".......................................................................++++@@@@@@@@@+++......+@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+++..........+@@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@+......++++@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@+..++@@@@@@@@@@@@@@@++.......................................................................", ".......................................................................+@+++++++++++.........+@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@++++..............+@@@@@@@@@@@@@@@@@@@@+.......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@@@@@+...........+++++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@+....+++@@@@@@@@@+++++.......................................................................", "......................................................................+@@@@@@++..............+@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@++++...................+@@@@@@@@@@@@@@@@@@+@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................++@@@@@@@@@@@@@@@@@@+.................++++++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@+.......++++++++++++@+.......................................................................", "......................................................................+@@@@@@@+..........++++++++++@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++........................+@@@@@@@@@@@@@@@@+@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++..................+@+@@@@@@@@@@@@@@@@+........................++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@+.............++@@@@@@+......................................................................", "......................................................................+@@@@@@+........+++@@@@@@@@@@++++..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................++@@@@@@@@@@@@++@@@@+...................++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+................+@@@++@@@@@@@@@@@@++..........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@++++++++++..........+@@@@@@@+......................................................................", ".....................................................................+@@@@@@@+......++@@@@@@@@@@@@@@@@++.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................++@@@@@@@@+++@@@@@@+.................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@++.............+@@@@@@++@@@@@@@@++............................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....+++@@@@@@@@@@+++........+@@@@@@+......................................................................", ".....................................................................+@@@@@@@+....++@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................++++++++...+@@@@@@+...............+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@+............+@@@@@+..++++++++..............................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...++@@@@@@@@@@@@@@@@++......+@@@@@@@+.....................................................................", ".....................................................................+@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................+@@@@@@@+............++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+..........+@@@@@@+.........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..++@@@@@@@@@@@@@@@@@@@@++....+@@@@@@@+.....................................................................", "....................................................................+@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@@@+...........+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@++.......+@@@@@@+..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@+.....................................................................", "....................................................................+@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+............................................+@@@@@@+........++@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@+......+@@@@@+...........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@+....................................................................", "....................................................................+@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+..............................................+@@@@+@+......+@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@+....+@@@@@+.............................................+@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@+....................................................................", "...................................................................+@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@+..............................................+@@@+@@@+...++@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@++.+@+@@@@+.............................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@+....................................................................", "...................................................................+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+................................................+@+@@@@+..+@@@@@@@@@@@@@@@@++..++@@@@@@@@@@@@@@@@@@@@@@@@++...++@@@@@@@@@@@@@@@+@@@++@+...............................................+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@+...................................................................", "...................................................................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@+..................................................+@@@@@@++@@@@@@@@@@@@@@@@+......+@@@@@@@@@@@@@@@@@@@@@@+.......+@@@@@@@@@@@@@@@+@@@@+.................................................+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+...................................................................", "..................................................................+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@+....................................................+@@@@++@@@@@@@@@@@@@@@@+........+++@@@@@@@@@@@@@@@@+++.........+@@@@@@@@@@@@@@@++@+...................................................+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@+...................................................................", "..................................................................++@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+.....................................................+@@@+@@@@@@@@@@@@@@@@++............+++@@@@@@@@@@+++.............++@@@@@@@@@@@@@@@++....................................................+@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+..................................................................", "..................................................................+@++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@++.......................................................+++@+@@@@@@@@@@@@@@+.................++++++++++...............++++@@@@@@@@@@@@@+@+.....................................................++@@@@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++..................................................................", ".................................................................+@@@@++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@+++.........................................................+@@@@+@@@@@@@@@@@+++........................................++@@@@++@@@@@@@@@@@+@@++.....................................................+++@@@@@@@++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@++++@+..................................................................", ".................................................................+@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++...........................................................+@@@@@+@@@@@@@@@@+@@@++....................................++@@@@@@@@+@@@@@@@@@+@@@@@+.......................................................++++++++++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@+.................................................................", ".................................................................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++.............................................................++@@@@@@@+@@@@@@@++@@@@@@+..................................+@@@@@@@@@@@++@@@@@@+@@@@@@@+...........................................................++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+.................................................................", "................................................................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+............................................................+@@@@@@@@@@+@@@@@+@@@@@@@@@+................................+@@@@@@@@@@@@@@+@@@@@+@@@@@@@@++.........................................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@+.................................................................", "................................................................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+...............................++++++++++...................+@@@@@@@@@@@@+@@@+@@@@@@@@@@@+..............................+@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@@@+.........................................................+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+................................................................", "................................................................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+............................+++@@@@@@@@@@+++..............++@@@@@@@@@@@@@+@++@@@@@@@@@@@@@+............................+@@@@@@@@@@@@@@@@@@++@+@@@@@@@@@@@@+...................++++++++++...........................+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+................................................................", "...............................................................+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+.........................+++@@@@@@@@@@@@@@@@+++..........+@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+............................+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@++..............+++@@@@@@@@@@+++........................+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@+................................................................", "...............................................................+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+.........................+@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@+..........+++@@@@@@@@@@@@@@@@+++......................+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+...............................................................", "...............................................................+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+.......................++@@@@@@@@@@@@@@@@@@@@@@@@++....++@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@+.....................+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+...............................................................", "...............................................................+@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@++....++@@@@@@@@@@@@@@@@@@@@@@@@++...................+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@+...............................................................", "..............................................................+@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+++......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@+@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@+..............................................................", "..............................................................+@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+++...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+.++@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@++++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@+..............................................................", "..............................................................+@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+++...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................++++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@+..............................................................", ".............................................................+@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@++............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+++@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@+.............................................................", ".......................................................++++++++@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@+++........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++.+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+.....++@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+++@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@+++++++........................................................", "....................................................+++@@@@@@@@++++@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@++++....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+.......+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...++++@+@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@++++@@@@@@@+++.....................................................", "..................................................++@@@@@@@@@@@@@@@++.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@+@@@@@@++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@+@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+++@@@@@@@@@@@@@@++...................................................", ".................................................+@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@++......+@@@@@@@@@@@@@@@@@@@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@@@+..........++@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@+..................................................", "................................................+@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@+..........................+@@@@@@@@@@@@@@@@@@@@@@@@+............++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@+.................................................", "...............................................+@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@+............................+@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@+................................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+++++@@@@@+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@+............................+@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+....+++@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@+..............................+@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+@@@@+++@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+........+++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@+................................+@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@++...+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", "...........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+...........+++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@+..................................+@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+++.....+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................", "...........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+..............++@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........++@@@@@@@@@@@@++....................................++@@@@@@@@@@@@++................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@++++........+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................", "..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@++++@+.................+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+++@@@@@@@@++........................................++@@@@@@@@++..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++.............+@++++@@@@@@@@@@@@@@@@@@@@@@@@@@++.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", "..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@++@@@@@@@@@@@@@@@@@@@@++@@@@++...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@+++++++++............................................++++++++.+++................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", "..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@++@@@@@@@@@@@@@@@@++@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@++.......................................................+++@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@++@@@@@@@@@@@@@@@@@@@@++@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@+++@@@@@@@@@@+++@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@+.......................................................+@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@++@@@@@@@@@@@@@@@@++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@+++++++++++@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@+.........................................................+@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@+++@@@@@@@@@@+++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@+.........................................................+@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@++++++++++..+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@+.........................................................+@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@+..........................................................+@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@+...........................................................+@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@+...........................................................+@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@++@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@+............................................................+@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", ".........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@+............................................................+@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@@@++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................", "..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........++@@@@+.............................................................+@@@@++..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......+@@@++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", "..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@++@+..............................................................+@+++@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......+++@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", "..........................................+@@@@@@@@@@@@@@@@@@@@++@@@@@@@@+@@@@@@@@+.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@++..............................................................++@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................", "...........................................+@@@@@@@@@@@@@@@++++@+@@@@@@@@+@@@@@@@@+.....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@+..............................................................+@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@+@@@@@@@++++@@@@@@@@@@@@@@@@+............................................", "...........................................+@@@@@@@@@@@@@++@@@@@@+@@@@@@+@@@@@@@@+......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@+................................................................+@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@@@@+@@@@@@@+@@@++++@@@@@@@@@@@@+............................................", "............................................+@@@@@@@@@@@@+@@@@@@@+@@@@@@+@@@@@@@@+......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@+................................................................+@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@+@@@@@+@@@@@@@+@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@+@@@+++++++++@+@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@+................................................................+@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@+@+++++++++@@@+@@@@@@@@@@+..............................................", "..............................................+@@@@@@@@@@++++@@@@@@@@@++@@@@@@@@+........+@@@@+@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@+..................................................................+@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@+@@@+...........+@@@@@@@@+@@@@@@@@@++++@@@@@@@@@+...............................................", "...............................................+@@@@@@@@++@@@@@@@@@@@@+@@@@@@@@+.........+@@@+@+@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@+..................................................................+@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@+@+@@+...........+@@@@@@@@+@@@@@@@@@@@@++@@@@@@@+................................................", "................................................+@@@@@++@@@@@@@@@@@@@@+@@@@@@@@+..........+@+@@@+@@@@@@@@@@@@@@@@@@@+.......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@+....................................................................+@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@+@@@++.............+@@@@@@@@+@@@@@@@@@@@@@++@@@@+.................................................", ".................................................+@@@+@@@@@@@@@@@@@@@+@@@@@@@@+...........++@@@@@+@@@@@@@@@@@@@@@@@@+........................++@@@@@@@@@@@@@@@@@@@@@@@@++...............+@@@@+....................................................................+@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@+@@@@++............+@@@@@@@@+@@@@@@@@@@@@@@@+@@+..................................................", "..................................................+++@@@@@@@@@@@@@@@@+@@@@@@@@+..........+@@@@@@@@+@@@@@@@@@@@@@@@@+...........................+@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@+....................................................................+@@@@@+...................++@@@@@@@@@@@@@@@@@@@@@@@@++....................+@@@@@@@@@@@@@@@@@@+@@@@@@@+...........++@@@@@@@@+@@@@@@@@@@@@@@@++...................................................", "...................................................+@@@@@@@@@@@@@@@@@@++@@@@@+@+........+@@@@@@@@+@@@@@@@@@@@@@@@@+@+...........................+++@@@@@@@@@@@@@@@@++++...........++++++++@@+......................................................................+@@++++++++...............++@@@@@@@@@@@@@@@@@@@@@@+......................++@@@@@@@@@@@@@@@@+@@@@@@@@@+.........+@+@@@@@@++@@@@@@@@@@@@@@@@@+...................................................", "..................................................+@@@@@@@@@@@@@@@@@@@@@++@@@+@@+......+@@@@@@@@+@@@@@@@@@@@@@@@@+@@@+.............................+++@@@@@@@@@@+++++@+.........++@@@@@@@@+++......................................................................+++@@@@@@@@++.............+@+++@@@@@@@@@@@@@@@@+++......................+@@+@@@@@@@@@@@@@@@@+@@@@@@@@@+......++@@@+@@@++@@@@@@@@@@@@@@@@@@@@+..................................................", ".................................................+@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@++...+@+@@@@@@+@@@@@@@@@@@@@@@@+@@@@@+...............................++++++++++++@@@@@+......++@@@@@@@@@@@@++....................................................................++@@@@@@@@@@@@++..........+@@@@@+++@@@@@@@@@@+++........................+@@@@+@@@@@@@@@@@@@@@@+@@@@@@@+@+...+++@@@@+@++@@@@@@@@@@@@@@@@@@@@@@@+.................................................", "................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@++.+@@@+@@@@+++@@@@@@@@@@@@@++@@@@@@@+.....................................++@@@@@@@@+.....+@@@@@@@@@@@@@@@@+..................................................................+@@@@@@@@@@@@@@@@+.........+@@@@@@@@++++++++++..........................+@@@@@@++@@@@@@@@@@@@@++++@@@@+@@@+.+@+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................", "................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@+@@@+...+++@@@@@@@+++.+@@@@@@@+.....................................+@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@+................................................................+@@@@@@@@@@@@@@@@@@+........+@@@@@@@@@+..................................+@@@@@@@++++@@@@@@@+++....+@@@+@@@@+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................", "...............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@+@+.......+++++++.....+@@@@@@@+.....................................+@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@+......+@@@@@@@@@+..................................+@@@@@@@+....+++++++........+@+@@@@+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................", "...............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@@+.....................+@@@@@@@+....................................+@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@+............................................................+@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@@+.................................+@@@@@@@+.....................+@@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@+.......................+@@@@@@@+...................................+@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@+............................................................+@@@@@@@@@@@@@@@@@@@@@@+.....+@@@@@@@@@+................................+@@@@@@@+.......................+@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++........................+@@@@@@@@+...................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+..........................................................+@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@+................................+@@@@@@@@+........................++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+..........................+@@@@@@+@+..................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+..........................................................+@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@+...............................+@+@@@@@@+..........................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+..........................+@@@++@@@+..................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@+..............................+@@@++@@@+..........................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+...........................+@+@@@@@+..................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@+.............................+@@@@@@+@+...........................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+............................+@@@@@@@+.................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@+.............................+@@@@@@@@+............................+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+............................+@@@@@@@+.................................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@+.............................+@@@@@@@+............................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+.............................+@@@@@@@+....++++++++....................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@+...............++++++++.....+@@@@@@@+.............................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+..............................+@@@@@@+..++@@@@@@@@++..................+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@+..............++@@@@@@@@++..+@@@@@@@+..............................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+...............................+@@@@@@++@@@@@@@@@@@@++.................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@+............++@@@@@@@@@@@@++@@@@@@@+...............................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+...............................+@@@@@@@+@@@@@@@@@@@@@@+...............++@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@+........................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@@@@@@+...........+@@@@@@@@@@@@@@+@@@@@@@@+...............................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", ".............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+................................+@@@@@+@@@@@@@@@@@@@@@@+...........+++@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+..........................................................+@@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@@@@@++..........+@@@@@@@@@@@@@@@@+@@@@@@+................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.................................+@@@+@@@@@@@@@@@@@@@@@@+.......+++@+@@@+@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+..........................................................+@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@@@@@@+@++.......+@@@@@@@@@@@@@@@@@@++@@@+.................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+..................................+@+@@@@@@@@@@@@@@@@@@@@+....++@@@@+@@@+@@@@@+++@+@@@@@@@@@@@@@@@@@@@++..........................................................++@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@@@+@@@+++...+@@@@@@@@@@@@@@@@@@@@@+@+..................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "..............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+..................................+@+@@@@@@@@@@@@@@@@@@@@@@++++@@@@@@@+@@@+@+++@@@@@+@@@@@@@@@@@@@@@@@@+@++......................................................++@+@@@@@@@@@@@@@@@@@@@@@@+.+@+++@@@@@+@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@++...................................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................", "...............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+..................................+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+@@@++@@@@@@@@+@@@@@@@@@@@@@@@@@+@@@@+....................................................+@@@@+@@@@@@@@@@@@@@@@@@@@+.+@@@@@+++@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+...................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................", "...............................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@+++@@@@@@@@@+@@@@@@@@@@@@@@@@++@@@@@+.................................................++@@@@@++@@@@@@@@@@@@@@@@@@+..+@@@@@@@@++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................", "................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+..................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+++...+@@@@@@@@@+@@@@@@@@@@@@@@++@@@@@@@++..............................................+@@@@@@@@++@@@@@@@@@@@@@@@@+...+@@@@@@@@@+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................", "................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++++......+@@@@@@@@@+@@@@@@@@@@@@++..++@@@@@@@+............................................+@@@@@@@++..++@@@@@@@@@@@@++...+@@@@@@@@@+.+++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................................................", ".................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+..................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++..........+@@@@@@@@@+++@@@@@@@@++......+@@@@@@@++........................................++@@@@@@@+......++@@@@@@@@++.....+@@@@@@@@@+....+++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................................................", "..................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+...................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@+..++++++++.........+@@@@@@@@+......................................+@@@@@@@++.........++++++++......+@@@@@@@@@@+........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................................................", "...................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+....................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@+...................++@@@@@+@++..................................++@+@@@@@+.........................+@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................................................", "....................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.....................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@+.....................+@@@+@@@@+................................+@@@@+@@@+..........................+@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................", ".....................................................+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@+......................++@+@@@@@+.............................++@@@@@+@++..........................+@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+.....................................................", "......................................................++@@@@@@@@@@@@@@@@@@@++@@@@++.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@+.......................+@@@@@@@++.........++++++++.........+@@@@@@@@+............................+@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................++@@@@@++@@@@@@@@@@@@@@@@@@@++......................................................", "........................................................++@@@@@@@@@@@@@@@++++@+++@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@+........................+@@@@@@@@+......++@@@@@@@@++......+@@@@@@@@+.............................+@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................+++++@@@@++@@@@@@@@@@@@@@@++........................................................", "..........................................................+++@@@@@@@@@+++++@+++@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@+.........................++@@@@@@@++..++@@@@@@@@@@@@++..++@@@@@@@@+.............................+@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................+@++++++++++++@@@@@@@@@+++..........................................................", ".............................................................+++++++++++@@@@@+@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@+..........................+@@@@@@@@++@@@@@@@@@@@@@@@@++@@@@@@@@@+..............................+@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................+@@@@@++.+@+++++++++++++.............................................................", "....................................................................++@@@@@@@+@@@@@+........................................+@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@+...........................+@@@@@@++@@@@@@@@@@@@@@@@@@++@@@@@@++..............................+@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@+.........................................+@@@@@@++@@@@@@+++...................................................................", "....................................................................+@@@@@@@@+@@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@+............................+@@@@@+@@@@@@@@@@@@@@@@@@@@++@@@@+................................+@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@+........................................+@@@@@@+.+@@@@@@@@+...................................................................", ".....................................................................+@@@@@@@@+@@@@@+........................................+@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@@@@+.............................++@@+@@@@@@@@@@@@@@@@@@@@@@+@@@+.................................+@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@+.........................................+@@@@@@+.+@@@@@@@+....................................................................", ".....................................................................+@@@@@@@@+@@@@@@+........................................+@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@@@@@+..............................+@+@@@@@@@@@@@@@@@@@@@@@@++@+.................................+@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@+..........................................+@@@@@@++@@@@@@@@+....................................................................", ".....................................................................+@@@@@@@@+@@@@@@+.........................................+@@@@@@@@@@@@@@@@@@+......................+@@@@@@@@++++++++.........................+@@@@@@@@@@@@@@@@@@@@@@@@++...........................+++++++++@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@+..........................................+@@@@@@@++@@@@@@@+.....................................................................", "......................................................................+@@@@@@@@+@@@@@+..........................................+@@@@@@@@@@@@@@@@+.......................+@@@@@+++@@@@@@@@++++.....................+@@@@@@@@@@@@@@@@@@@@@@@@+........................++++@@@@@@@@@+++@@@@@+...................+@@@@@@@@@@@@@@@@+...........................................+@@@@@@+.+@@@@@@@+.....................................................................", "......................................................................+@@@@@@@@+@@@@@@+..........................................++@@+++@@@@@@@++.........................+@+++@@@@@@@@@@@@@@@++..................+@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................++@@@@@@@@@@@@@@@@+++@+.....................++@@@@@@@@@@@@++............................................+@@@@@@++@@@@@@@@+.....................................................................", "......................................................................+@@@@@@@@+@@@@@@+............................................+++@@++++@++..........................+++@@@@@@@@@@@@@@@@@@@@++................+@@@@@@@@@@@@@@@@@@@@@@@@@@+...................++@@@@@@@@@@@@@@@@@@@@@++.......................++@@++++++++.............................................+@@@@@@@++@@@@@@@+......................................................................", ".......................................................................+@@@@@@@+@@@@@@+..............................................+@@@@@++...........................+@@@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@@@@@@@@@@@@@@@@@@@@@+........................+++@@@@@+..............................................+@@@@@@+.+@@@@@@@+......................................................................", ".......................................................................+@@@@@@@@+@@@@@@+.............................................+@@@@@+...........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................+@@@@@+.............................................+@@@@@@@++@@@@@@@@+......................................................................", ".......................................................................+@@@@@@@@+@@@@@++.............................................+@@@@@+.........................++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++............+@@@@@@@@@@@@@@@@@@@@@@@@@@+...............++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++.......................+@@@@@+.............................................++@@@@@@++@@@@@@@+.......................................................................", ".......................................................................+@@@@@@@@+@++++@+.............................................+@@@@@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@+.............................................+@++@@@@++@@@@@@@+.......................................................................", "........................................................................+@@@@@@@@+@@@@@@+...........................................+@@@@@@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@+............................................+@@@@++@++@@@@@@@+........................................................................", "........................................................................+@@@@@@@++@@@@@@+...........................................+@@@@@+........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................+@@@@@+...........................................+@@@@@@++++@@@@@@+........................................................................", "........................................................................+@@@@+++@+@@@@@@+...........................................+@@@@@+.......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@+...........................................+@@@@@@@++@++@@@@+........................................................................", ".........................................................................+@++@@@@@+@@@@@+...........................................+@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@+...........................................+@@@@@@++@@@@++@+.........................................................................", ".........................................................................++@@@@@@@+@@@@@@+..........................................+@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@+..........................................+@@@@@@@++@@@@@@++.........................................................................", ".........................................................................+@@@@@@@@+@@@@@@+..........................................+@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@+..........................................+@@@@@@++@@@@@@@@+.........................................................................", "..........................................................................+@@@@@@@@+@@@@@+..........................................+++@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@++++..........................................+@@@@@@++@@@@@@@+..........................................................................", "..........................................................................+@@@@@@@@+@@@@@@+.........................................+@@++++....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+++@@@+.........................................+@@@@@@@++@@@@@@@+..........................................................................", "..........................................................................+@@@@@@@@+@@@@@@+.........................................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+.........................................+@@@@@@++@@@@@@@@+..........................................................................", "...........................................................................+@@@@@@@@+@@@@@+.........................................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............++@@@@@@@@@@@@++...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+.........................................+@@@@@@++@@@@@@@+...........................................................................", "...........................................................................+@@@@@@@@+@@@@@+.........................................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............++@+++++++++.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+.........................................+@@@@@@++@@@@@@@+...........................................................................", "...........................................................................+@@@@@@@@+@@@@@@+........................................+@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++++++++++++++++++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@+........................................+@@@@@@++@@@@@@@@+...........................................................................", "............................................................................+@@@@@@@+@@@@@++++++++.................................+@@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@@+.................................++++++++@@@@@++@@@@@@@+............................................................................", "............................................................................+@@@@@@@@+@+++@@@@@@@@+++..............................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+..............................+++@@@@@@@@+++@++@@@@@@@@+............................................................................", "............................................................................+@@@@@@@@++@@@@@@@@@@@@@@++............................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+............................++@@@@@@@@@@@@@@+++@@@@@@@@+............................................................................", "............................................................................+@@@@@@@@+@@@@@@@@@@@@@@@@@+...........................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+...........................+@@@@@@@@@@@@@@@@@@+@@@@@@@@+............................................................................", ".............................................................................+@@@@@@@@+@@@@@@@@@@@@@@@@@+........................+++++++@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+..........................+@@@@@@@@@@@@@@@@@@+@@@@@@@@+.............................................................................", ".............................................................................+@@@@@@@++++++++@@@@@@@@@@@@+....................+++@@@@@@@+++...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................++++++++........................+@@@@@@@@@@@@@++++++++@@@@@@@+.............................................................................", ".............................................................................+@@@@+++@@@@@@@@+++@@@@@@@@@@+.................++@@@@@@@@@@@@@++.................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+................+++@@@@@@@+++....................+@@@@@@@@@@@+++@@@@@@@@++@@@@@+.............................................................................", "..............................................................................+@++@@@@@@@@@@@@@@++@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............++@@@@@@@@@@@@@++.................+@@@@@@@@@@++@@@@@@@@@@@@@+++@+..............................................................................", ".............................................................................+++@@@@@@@@@@@@@@@@@@++@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+++++++++++++++++++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@++@@@@@@@@@@@@@@@@@@+++.............................................................................", "............................................................................+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+++++++...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+............................................................................", "...........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................................................", "..........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.................+@@@@@+...................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................................................", ".........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................................................", "........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..................+@@@@@+....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................................................", ".......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................", ".......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@+.....................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................", "......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@+@@@@+++++@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................+@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@+++++@@@@+@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................", "......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................+@@@@@+.......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@+@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................++++++++........................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@+@@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................++@@@@@@@@++......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+................+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++..................++@@@@@@@@@@@@++.....................++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+............+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+...............+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@+@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+...................+@@@@@@@@@@@@@@@@@@+......................+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@+++++++++++++++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@++@@@@@@@@@@@@@@@@@@@@@++...................+@@@@@@@@@@@@@@@@@@@@+......................++@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........+@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............+@@@@@@@@@++@@@@@@@@@@@@@@@@@++....................+@@@@@@@@@@@@@@@@@@@@@@+.......................++@@@@@@@@@@@@@@@@@++@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............+@@@@@@@@@@@+++++@@@@@@@@@++++.....................+@@@@@@@@@@@@@@@@@@@@@@@@+........................++++@@@@@@@@@++++.+@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@+.+...........+@@@@@@@@@@@+.....+++++++++.........................+@@@@@@@@@@@@@@@@@@@@@@@@+............................+++++++++......+@@@@@@@@@@+.........+@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........+@@@@@@@@@@@@@@@@@@@@@@@@@++@++........+@+@@@@@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@@@@@+@+......++@+@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........+@@@@@@@@@@@@@@@@@@@@@@@++@@@@+.......+@@++@@@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@@@@+@@@+....+@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+............+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", "....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+............+@@@@@@@@@@@@@@@@@@@@@+.+@@@@@+.....+@@@@@+@@@@@+.......................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................+@@@@++@@@@+..++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+.............+@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@++.............+@@@@@@@@@@@@@@@@@@@+.+@@@@@@@++..+@@@@@@@+@@@+........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................+@@+@@@@@@@++@@@@@@@++@@@@@@@@@@@@@@@@@@@@@+...............++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@++............+@@@@@@@@@@@@@@@@++++++++++@@@@+.+@@@@@@@@++@+........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+............................................+@+@@@@@@@@@+@@@@@++++++++++@@@@@@@@@@@@@@+..............++@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", ".....................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@++...........++@@@@@@@@@@@+++@@@@@@@@@@+++@@+@@@@@@@@@@@+.........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.............................................+@@@@@@@@@@@+@+++@@@@@@@@@@+++@@@@@@@@@@+.............++@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................", "......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@++...........+++@@@@@@++@@@@@@@@@@@@@@@@++@@@@@@@@@@@+..........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................+@@@@@@@@@@++@@@@@@@@@@@@@@@@++@@@@@@++............++@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................", "......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@++............++++++@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+...........................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...............................................+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@++@+++............++@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................", ".......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@++.............+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+...........................................+++@@@@@@@@@@@@@@@@@@@@@@@@@++...............................................+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+.............++@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................", ".......................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@+++..........+@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+..........................................+++@+@@@@@@@@@@@@@@@@@@@@@@@@@+@+++.............................................+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+..........+++@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................", "........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@+@@@++.......+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+..........+++++++........................++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@++.......................+++++++............+@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+.......++@@@+@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................................................", ".........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@@@+@@@@@++....+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@++.......+++@@@@@@@+++..................+++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@+++.................+++@@@@@@@+++........+@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@+....++@@@@@+@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................................................", "..........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++@@@@@@@@+@@@@@@@@++.+@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+@@++...++@@@@@@@@@@@@@++.............+++@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+++............++@@@@@@@@@@@@@++....++@@@@++@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@+.++@@@@@@@@+@@@@@@@++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+..........................................................................", "...........................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++@@@@@@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+@+@@@+.+@@@@@@@@@@@@@@@@@+..........++@+@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@@++.........+@@@@@@@@@@@@@@@@@+..+@@@@@+@@+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+@@@@@++@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+...........................................................................", "............................................................................+@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@++@@@@+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+@@+@@@+@@@@@@@@@@@@@@@@@@@+.......++@@@@+@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@@+@@@@++......+@@@@@@@@@@@@@@@@@@@++@@@@@+@@@+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+@@@++@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@+............................................................................", ".............................................................................++@@@@@@@@@@@@@@@@@@@++@+@@@@@@@@@@++@+@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@+@@@+@@+@@@@@@@@@@@@@@@@@@@@@+....++@@@@@@+@@@@@@++...+@@@@@@@@@@@@@@@@@@@@+...++@@@@@@+@@@@@@@++...+@@@@@@@@@@@@@@@@@@@@@++@@@@+@@@@+@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+++@@@@@@@@@@+@++@@@@@@@@@@@@@@@@@@@++.............................................................................", "...............................................................................++@@@@@@@@@@@@@@@++@@@@+@@@@@@@@@@@+++@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@+@+@@@@@@@@@@@@@@@@@@@@@@+.++@@@@@@@@+@@@@++......+@@@@@@@@@@@@@@@@@@+......++@@@@+@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@++@@@@@@@@@@@+@@@@++@@@@@@@@@@@@@@@++...............................................................................", ".................................................................................+++@@@@@@@@@+++@@@@@@+@@@@@@@@@@@@@@++@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+@++.........+@@@@@@@@@@@@@@@@+.........++@+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@++@@@@@@@@@@@@@+@@@@@@+++@@@@@@@@@+++.................................................................................", "....................................................................................+++++++++@+@@@@@++@@@@@@@@@@@@@@@@@++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+++............++@@@@@@@@@@@@++............+++@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@++@@@@@@@@@@@@@@@@++@@@@@+@+++++++++....................................................................................", ".....................................................................................+@@@@@@@@@+@@@+@@@@@@@@@@@@@@@@@@@+.++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@++.................++@@@@@@@@++.................++@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+++@@@@@@@@@@@@@@@@@@@+@@@+@@@@@@@@@+.....................................................................................", ".....................................................................................+@@@@@@@@@+@++@@@@@@@@@@@@@@@@@@@@+...++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@++.....................++++++++.....................++@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++..+@@@@@@@@@@@@@@@@@@@@++@+@@@@@@@@@+.....................................................................................", "....................................................................................+@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+@@@++......................................................++@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+++..........................................................+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+..............................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", "....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....................................................................................", ".....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................................", ".....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@+................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................................", ".....................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+..................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.....................................................................................", "......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@@@@@@@@+@@@@@+..................................................................+@@@@@+@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................................", "......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@@@@@@@@@@+++@@@@+....................................................................+@@@@+++@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+..++@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+......................................................................................", ".......................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@++..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@@@++@@@+@@+......................................................................+@@+@@@++@@@@@@@@@@@@@+....+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.+@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.......................................................................................", "........................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@+..+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+...+@@@@@@@@@@@+@@@@@+@+........................................................................+@+@@@@@++@@@@@@@@@@+......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+++@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@+........................................................................................", ".........................................................................................+@@@@@@@@@@@@@@@@@@@@@@@@@++@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+....+@@@@@@@@@@+@@@@@@+..........................................................................++@@@@@@+@@@@@@@@@+.......+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@+.........................................................................................", "..........................................................................................+@@@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++.....++@@@@@@@@@+@@@@@+..........................................................................+@@@@@@+@@@@@@@@++........++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@@@+..........................................................................................", "...........................................................................................+@@@@@@@@@@@@@@@@@@@@@+.+@@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@+......+++@@@@@@+@@@@@@+.........................................................................+@@@@@@+@@@@@+++.........+@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@@+.+@@@@@@@@@@@@@@@@@@@@@+...........................................................................................", ".............................................................................#..............+@@@@@@@@@@@@@@@@@@@+...++@@@@@@@@@@++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@+........++++++++@@@@@+.........................................................................+@@@@@+++++++...........+@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@++...+@@@@@@@@@@@@@@@@@@@+............................................................................................", "............................############..........................###########.......##############@@@@@@@@@@@@++......+@@@@@@@@###############@@@@@@@@@@@@@@@@@+@@@@@+...............+@@@@@@+..............##########...............................................+@@@@@@+.................+@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+......++@@@@@@@@@@@@@@@++.......................................................##########............................", ".............................############........................############.......##############@@@@@@@@@+++.........++@@@@@@###############@@@@@@@@@@@@@@@@+@@@@@@@+..............+@@@@@++..............##########...............................................++@@@@@+................+@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@++.........+++@@@@@@@@@+++.........................................................##########............................", ".............................############.......................############....+...###############++++++++..............+@@@@################@@@@@@@@@@@@@@@+@@@@@@@@@+..............+@+++@@+.............##########..............................................+@@+++@+................+@@@@@@@@@+@@@@@@@@@@@@@@@@@@@@@@@@+@@@@@@@@@+..............+++++++++............................................................##########............................", "..............................############+....................############+++++....###############++.....................+@@@################+++@@@@@@@@@@+++@@@@@@@@@@+.............++@@@@@+.............##########+++...........................................+@@@@@++...............+@@@@@@@@@@+++@@@@@@@@@@@@@@@@@@@@+++@@@@@@@@+....................................................................................##########+++.........................", "...............................###########++..................############++++++...################++......................++################++++@@@@@@@@++...+@@@@@@@@@@+............+@@@@@@@++++++++....##########++++....................................++++++++@@@@@@+..............+@@@@@@@@@@+...++@@@@@@@@@@@@@@@@++@@@+@@@@@++....................................................................................##########++++.........................", "...............................############+..................###########++++++....################+++.......................################++++@@@@@+++......+@@@@@@@@@@+............+@@@+++@@@@@@@@+++.##########++++.................................+++@@@@@@@@+++@@+..............+@@@@@@@@@@+......+++@@@@@@@@@@+++@@@@@@+@@@+......................................................................................##########++++.........................", "................................###########++................###########++++++.....################+++......................#################+++++++++...++++++++@@@@@@@@+@+...........+@++@@@@@@@@@@@@@@+##########++++...............................++@@@@@@@@@@@@@@+++.............+@+@@@@@@@@++++++.....+++++++++++@@@@@@@@+@++.......................................................................................##########++++.........................", "................................############+...............###########++++++......################+++......................#################+++......+++@@@@@@@@+@@@@@++@@@+...........+@@@@@@@@@@@@@@@@@##########+++...............................+@@@@@@@@@@@@@@@@@@+............+@@@+@@@@@@+@@@@@@+++..........+@@@@@@@@@@@+.........................................................................................##########+++..........................", ".................................###########++.............###########++++++.......#################++.....................##################+++....++@@@@@@@@@@@@+@@@+@@@@@@+.........+@@@@@@@@@@@@@@@@@@##########+++..............................+@@@@@@@@@@@@@@@@@@@@+..........+@@@@@++@@@+@@@@@@@@@@++.......+@@@@@@@@@@@+..........................................................................................##########+++..........................", ".................................############+............############+++++.......##################++.....................#################++++...+@@@@@@@@@@@@@@@+@+@@@@@@@@+.......+@+++++++++@@@@@@@@##########++++.............................+@@@@@@@@@@@@+++++++++@+........+@@@@@@@@+@+@@@@@@@@@@@@@+....++@@@@@@@@@@++..........................................................................................##########++++..........................", "..................................############+..........############+++++........##################++....................##################+++++.+@@@@@@@@@@@@@@@@@+@@@@@@@@@@+.....+++@@@@@@@@@+++@@@@@##########++++............................+@@@@@@@@@@+++@@@@@@@@@+++......+@@@@@@@@@@+@@@@@@@@@@@@@@@+..+@@@@@@@@@@@+............................................................................................##########++++..........................", "..................................############+.........############+++++.........##################+++...................##################++++@+@@@@@@@@@@@@@@@@@@@+@@@@@@@@@@+..++@@@@@@@@@@@@@@@++@@@##########++++...........................+@@@@@@@@@++@@@@@@@@@@@@@@@++...+@@@@@@@@@@+@@@@@@@@@@@@@@@@@++@@@@@@@@@@@+.............................................................................................##########++++..........................", "...................................############+.......############++++++.........##################+++..................###################+++@+@@@@@@@@@@@@@@@@@###########@@@@++@@@@@@@@@@@@@@@@@@@++@##########+++.....................#.....+@@@@@@@@++@@@@@@@#########@@@+++@@@@@@@@@@+@@@@@@@@@@@@@@@@@@@+###########..............############..................................############......................##########+++...........................", "...................................############++......###########++++++..........##################+++.................####################+++@+@@@@@@@@@@@@@@#################@@+@@##########@@@@@@@@@+##########+++..........###########......+@@@@@@@+@@@@@################@+@@@@@@@@@@+@@@@@@@#########@@@###############..........################.............................##################...................##########+++...........................", "....................................############+.....###########++++++...........###################++.................#########+##########++++@@@@@@@@@@@@@####################@@+@##########@@@@@@@@@@##########+++.........###########......+@@@@@@@+@@@@####################@@@@@@@@@+@@@@@@@@#########@##################.......####################.........................#####################..................##########+++...........................", "....................................############++...###########++++++...........##########+#########++................#########+##########++++@@@@@@@@@@@@#######################@@##########@@@@@@@@@@##########++++........###########.....+.+@@@@@@+@@@#######################@@@@@@@+@@@@@@@@#########@####################.....######################......................#########################...............##########++++...........................", ".....................................############+..###########++++++............##########+#########++................#########+##########++++@@@@@@@@@@@#########################+##########++++@@@@@@##########++++.......###########++++++..+@@@@@+@@@##########################@@@@+@@@@@@@@@###############################..#########################....................###########################..............##########++++...........................", ".....................................############++############+++++.............##########+#########+++..............#########++##########++++@@@@@@@@@@#####################################++++@@@@@@##########++++++++++###########+++++++++@@@@@+@@#############################@@+@@@@@@@@@@###############################+##########################+.................##############################.............##########++++...........................", "......................................########################+++++..............##########+#########+++..............########+++##########+++@@@@@@@@@#######################################+++@@@@@@@##########+++@@@@@@@##########++++++@@@+@@@@+@@##############################@+@@@@@@@@@@@###########################################################+...............################################............##########+++............................", "......................................#######################+++++...............##########++########+++.............#########+++##########+++@@@@@@@@########################################+++@@@@@@@##########+++@@@@@@###########+++++@@@@+@@@@+@################################+@@@@@@@@@@@###########################################################++.............#################################+...........##########+++............................", ".......................................#####################++++++..............##########+++#########++.............########+++##########++++@@@@@@@########################################++++@@@@@@##########++++@@@@@###########+++++@@@@@+@@@+@##################################+@@@@@@@@@#############################################################+............###################################+.........##########++++............................", ".......................................####################++++++...............##########+++#########++............#########+++##########++++@@@@@@@##############+++++++++#################++++@@@@@@##########++++@@@@###########+++++@@@@@@+@@@+##############+++++++##############+@@@@@@@@@##############++++++++###################+++++++#############++..........##############++++++++##############++........##########++++............................", "........................................##################++++++................##########+++#########++............########++++##########++++@@@@@@#############+++++++++++++###############++++@@@@@@##########++++@@@###########++++++@@@@@@+@@+#############+++++++++++#############++++@@@@@#############++++++++++#################+++++++++############++.........#############++++++++++++#############+........##########++++............................", "........................................#################++++++.................##########+++#########+++..........#########++++##########+++@@@@@@############++++++++++++++++##############+++@@@@@@@##########+++@@@###########++++++@@@@@@@+@@+###########++++++++++++++############++@+@@@@@############++++++++++++##############++++++++++++###########+++.......#############++++++++++++++############++.......##########+++.............................", ".........................................###############++++++..................##########+++#########+++..........########+++++##########+++@@@@@@###########++++++++@@@+@@@@@+#############+++@@@@@@@##########+++++###########+++++++++++++++@@###########++++++++@@@@@@@+###########++@@+@@@@###########++++++@@@+...#############+++++++......###########+++.......###########++++++++........+############+.......##########+++.............................", ".........................................###############+++++..................##########++++.#########++.........#########++++##########++++@@@@@###########+++++++@+@@+@@@@@@@############++++@@@@@@##########++++++##########+++++++++++++++++###########+++++++@@@@@@@@@@@###########++@+@@@###########++++++@@@@+...#############++++++........##########+++......###########+++++++............###########++.....##########++++.............................", "..........................................#############+++++...................##########++++.#########++........#########+++++##########++++@@@@###########++++++@@@+@@+@@@@@@@@###########++++@@@@@@##########++++@##########++++++@@@@@@@@@@@@##########++++++@@@@@@@@@@@@@###########++@+@@@###########+++++@@@@@+....###########+++++..........##########+++......##########+++++++.............###########++.....##########++++.............................", "..........................................############+++++....................##########++++.#########++........#########++++.##########++++@@@@###########+++++@@@@+@@+@@@@@@@@###########++++@@@@@@##########++++##########++++++@@@@@@@@@@@@##########++++++@@@@@@@@@@@@@@@##########++@+@@@###########++++@@@@@@+....###########++++...........##########+++.....###########+++++...............###########+++....##########++++.............................", ".........................................##############++++....................##########+++..#########+++......#########+++++.##########+++@@@@@##########+++++@@@@+@@@+@@@@@@@@###########+++@@@@@@@##########+++###########+++++@@@@@@@@@@@@@#########++++++@@@@@@@@@@@@@@@@##########+++@+@@##########++++@@@@@@@+....##########+++++...........##########+++.....##########+++++.................##########+++....##########+++..............................", "........................................###############+++.....................##########+++..#########+++......#########++++..##########++++@@@###########++++@@@@@+++++@@@@@@@@@##########+++@@@@@@@##########++###########+++++@@@@@@@@@@@@@##########+++++@@@@@@@@@@@@@@@@@##########+++++@@##########++++@@@@@@+.....##########++++............##########+++....##########+++++..................##########+++....##########+++..............................", ".......................................#################+......................##########+++..#########+++.....#########+++++..##########++++@@@##########+++++@@@@@@@@@+@@@@@@@@@##########+++@@@@@@@##########+###########++++++@@@@@@@@@@@@@#########+++++@@@@@@@@@@@@@@@@@@##########+++@@@@##########++++@@@@@@+....###########++++............##########+++....##########+++++..................##########+++....##########+++..............................", ".......................................#################++....................##########++++...#########++.....#########++++..##########+++++@@###########++++@@@@@@@@@@+@@@@@@@@@#########++++@@@@@@##########+###########+++++++@@@@@@@@@@@@@##########################################+++@@@##########++++@@@@@@@+....##########++++............##########++++....##########++++...................##########+++...##########++++..............................", "......................................###################+....................##########++++...#########++....#########+++++..##########++++.+@##########+++++@@@@@@@@@@+@@@@@@@@@#########++++@@@@@@##########+##########++++++@+@@@@@@@@@@@@###########################################+++@@@##########++++@@@@@@+.....##########++++............##########++++...##########++++....................##########+++...##########++++..............................", ".....................................####################++...................##########++++...#########++....#########++++...##########++++.+@##########++++@@@@@@@@@@@+@@@@@@@@##########++++@@@@@@####################+++++++++++++++++++++###########################################+++@@@##########++++@@@@@@+.....##########++++............##########++++...##########++++....................##########+++...##########++++..............................", "....................................######################+...................##########+++....#########+++..#########+++++...##########+++...+##########++++@@@@@@@@@@@@+@@@@@@@##########+++@@@@@@@####################+++++................###########################################+++@@@##########+++@@@@@@+......##########+++.............##########+++....##########++++....................##########+++...##########+++...............................", "...................................#######################++..................##########+++....#########+++..########+++++....##########+++....##########+++@@@@@@@@@@@@@+@@@@@@@##########+++@@@@@@@#####################+++.................###########################################+++@@@##########+++@@@@@+.......##########+++.............##########+++....##########+++.....................##########+++...##########+++...............................", "..................................############+############+.................##########++++....#########+++.#########+++++...##########++++....##########+++@@@@@@@@@@@@@+@@@@@@@#########++++@@@@@@##########+###########++..................##########################################++++@@##########++++@@@@+.......##########++++............##########++++....##########+++....................##########++++..##########++++...............................", ".................................############++############++................##########++++.....#########++.########+++++....##########++++...###########+++@@@@@@@@@@@@@++@@@@@##########++++@@@@@@##########++###########+.................###########################################++++@@##########++++@@@+........##########++++............##########++++...###########+++....................##########++++..##########++++...............................", "................................############++++############+................##########++++.....#########++#########++++.....##########++++...###########+++@@@@@@@@@@@@+.+@@@@@##########++++@@@@@@##########++############+................###########################################++++@@##########++++@@+.........##########++++............##########++++...###########+++...................###########++++..##########++++...............................", "................................###########+++++############++...............##########+++......#########+#########+++++.....##########+++....###########+++@@@@@@@@@@@+...+@@@###########+++@@@@@@@##########+++###########+................##########++++++++++++++++++++++++++++++++++++@@@##########+++@@+..........##########+++.............##########+++.....##########+++...................##########++++...##########+++................................", "...............................###########++++++.############+...............##########+++......#########+#########++++......##########+++....###########+++@@@@@@@@@++....+@@@###########+++@@@@@@@##########+++############+...............##########+++++++++++++++++++++++++++++++++++++@@##########+++++...........##########+++.............##########+++.....##########+++..................###########++++...##########+++................................", "..............................############+++++..############++..............##########+++......##################+++++......##########+++.....##########+++@@@@@@+++.......+@############+++@@@@@@@##########+++.############+...............#########++++++++++++++++++++++++++++++++++++.++##########+++.............##########+++.............##########+++.....##########+++..................##########+++++...##########+++................................", ".............................############+++++....############+.............##########++++......##################++++......##########++++.....###########++++++++...........############++++@@@@@@##########++++..###########+...............##########++@@@@@@@@@@@@@@@@@##########........##########++++............##########++++............##########++++.....###########++.................###########++++...##########++++................................", "............................############+++++.....############++............##########++++.......################+++++......##########++++.....############+................#############++++@@@@@@##########++++..############+..............###########+@@@@@@@@@@@@@@@@###########........##########++++............##########++++............##########++++.....############+................###########+++++...##########++++................................", "...........................############++++++......############+............##########++++.......################++++.......##########++++.....#############...............##############++++@@@@@@##########++++...###########++.............###########+@@@@@@@@@@@@@@@###########.........##########++++............##########++++............##########++++......###########+...............############++++....##########++++................................", "..........................############++++++........###########++...........##########+++........###############+++++.......##########+++......##############.............###############+++@@@@@@@##########+++....############+.............#############@@@@@@@@@@@@#############++++.....##########+++.............##########+++.............##########+++.......#############............#############+++++....##########+++.................................", ".........................############++++++.........############+...........##########+++........###############++++........##########+++.......##############.........##################+++@@@@@@@##########+++.....############+.............#############@@@@@@@@@##############+++++.....##########+++.............##########+++.............##########+++.......##############.........##############+++++.....##########+++.................................", ".........................############+++++...........###########++.........##########++++........##############+++++.......##########++++.......########################################++++@@@@@@##########++++.....############+.............###################################+++++.....##########++++............##########++++............##########++++........###################################++++++....##########++++.................................", "........................############+++++............############+.........##########++++........##############++++........##########++++........#######################################++++@@@@@+##########++++......############+.............#################################++++++.....##########++++............##########++++............##########++++........##################################++++++.....##########++++.................................", ".......................############+++++..............###########++........##########++++.........############+++++........##########++++........#######################################+++++++++.##########++++......############++.............###############################++++++......##########++++............##########++++............##########++++.........################################++++++......##########++++.................................", "......................############++++++..............############+........##########+++..........###########+++++.........##########+++..........############################+#########+++.......##########+++........############+.............##############################++++++.......##########+++.............##########+++.............##########+++...........##############################++++++.......##########+++..................................", ".....................############++++++................###########++.......##########+++..........###########+++++.........##########+++...........##########################+##########+++.......##########+++........#############+.............###########################+++++++........##########+++.............##########+++.............##########+++............############################++++++........##########+++..................................", "....................############++++++.................############+......##########++++..........##########+++++.........##########++++............#######################+++#########++++......##########++++.........############+..............#########################+++++++........##########++++............##########++++............##########++++.............#########################+++++++........##########++++..................................", "...................############++++++...................###########++.....##########++++..........##########++++..........##########++++.............#####################++++#########++++......##########++++.........#############+..............+#####################++++++++.........##########++++............##########++++............##########++++..............+#####################++++++++.........##########++++..................................", "..................#############+++++....................############+.....##########++++..........#########+++++..........##########++++..............+################++++++##########++++......##########++++..........#############+..............+##################++++++++...........##########++++............##########++++............##########++++...............+##################+++++++++..........##########++++..................................", ".......................++++++++++++.......................++++++++++++.......++++++++++..............++++++++++..............++++++++++................++############+++++++++...+++++++++..........++++++++++.............++++++++++++...............+++############++++++++++...............++++++++++................++++++++++................++++++++++.................+++############++++++++++...............++++++++++...................................", "......................++++++++++++.........................+++++++++++.......++++++++++..............++++++++++..............++++++++++.................+++++++++++++++++++++....+++++++++..........++++++++++.............+++++++++++++................+++++++++++++++++++++.................++++++++++................++++++++++................++++++++++...................+++++++++++++++++++++.................++++++++++...................................", ".....................+++++++++++++.........................++++++++++++......++++++++++..............+++++++++...............++++++++++...................++++++++++++++++......++++++++++..........++++++++++..............+++++++++++++................++++++++++++++++++...................++++++++++................++++++++++................++++++++++....................++++++++++++++++++...................++++++++++...................................", "............................................................................................................................................................++++++++++++....................................................................................++++++++++++...........................................................................................................++++++++++++...................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", ".......................................................................................................................................................++..............................+++...................................+++......................................+++.+++....+++..................++..........................................................................................................................................................", ".....................................................................................................................................................++++..............................+++...................................+++.....................................++++.+++....+++..................++++........................................................................................................................................................", "....................................................................................................................................................+++++..............................+++...................................+++....................................+++++.+++....+++..................++++........................................................................................................................................................", "....................................................................................................................................................++++...............................+++...................................+++....................................+++..........+++...................++++.......................................................................................................................................................", "...................................................................................................................................................++++......+++++........+++++........+++......+++++............+++++......++++++.............+++++..+++.........+++++++.+++....+++......+++++.........++++......................................................................................................................................................", "...................................................................................................................................................+++......+++++++......++++++++......+++.....++++++++........+++++++++....++++++...........++++++++++++.........+++++++.+++....+++.....++++++++.......++++......................................................................................................................................................", "...................................................................................................................................................+++.....++++++++.....++++++++++.....+++....++++++++++......+++++++++++...++++++..........+++++++++++++.........+++++++.+++....+++....++++++++++.......+++......................................................................................................................................................", "..................................................................................................................................................++++.....+++...+++...++++....++++....+++...++++....++++....++++....+++++...+++............++++....+++++...........+++...+++....+++...++++....++++......++++.....................................................................................................................................................", "..................................................................................................................................................+++......+++........++++......++++...+++..++++......++++..++++......++++...+++...........++++......++++...........+++...+++....+++..++++......++++......+++.....................................................................................................................................................", "..................................................................................................................................................+++......++++++.....+++........+++...+++..+++........+++..+++..............+++...........+++........+++...........+++...+++....+++..+++........+++......+++.....................................................................................................................................................", "..................................................................................................................................................+++.......+++++++...++++++++++++++...+++..++++++++++++++..+++..............+++...........+++........+++...........+++...+++....+++..++++++++++++++......+++.....................................................................................................................................................", "..................................................................................................................................................+++........+++++++..++++++++++++++...+++..++++++++++++++..+++..............+++...........+++........+++...........+++...+++....+++..++++++++++++++......+++.....................................................................................................................................................", "..................................................................................................................................................+++...........++++..++++++++++++++...+++..++++++++++++++..+++..............+++...........+++........+++...........+++...+++....+++..++++++++++++++......+++.....................................................................................................................................................", "..................................................................................................................................................+++............+++..+++..............+++..+++.............++++......++++...+++...........++++......++++...........+++...+++....+++..+++................++++.....................................................................................................................................................", "...................................................................................................................................................+++.....+++...+++...++++....++++....+++...++++....++++....++++....+++++...+++............++++....+++++...........+++...+++....+++...++++....++++......+++......................................................................................................................................................", "...................................................................................................................................................+++.....+++++++++...++++++++++++....+++...++++++++++++.....+++++++++++....+++............+++++++++++++...........+++...+++....+++...++++++++++++.....++++......................................................................................................................................................", "...................................................................................................................................................++++.....+++++++.....++++++++++.....+++....++++++++++.......+++++++++.....+++.............++++++++.+++...........+++...+++....+++....++++++++++......++++......................................................................................................................................................", "....................................................................................................................................................++++.....+++++........++++++.......+++......++++++...........+++++.......+++...............+++++..+++...........+++...+++....+++......++++++.......++++.......................................................................................................................................................", ".....................................................................................................................................................++++.............................................................................................................................................++++........................................................................................................................................................", ".....................................................................................................................................................++++.............................................................................................................................................+++.........................................................................................................................................................", "......................................................................................................................................................+++.............................................................................................................................................++..........................................................................................................................................................", "........................................................................................................................................................+.............................................................................................................................................+...........................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "..................................................................................................................................................................................................................................................................................................................................................................................................................................................................", ".................................................................................................................................................................................................................................................................................................................................................................................................................................................................."}; xmakemol-5.16/gl2ps.h0000644000175000017500000001457710664005720011421 00000000000000/* $Id: gl2ps.h,v 1.9 2007/08/25 11:00:32 MPHodges Exp $ */ /* * GL2PS, an OpenGL to PostScript Printing Library * Copyright (C) 1999-2006 Christophe Geuzaine * * This program is free software; you can redistribute it and/or * modify it under the terms of either: * * a) the GNU Library General Public License as published by the Free * Software Foundation, either version 2 of the License, or (at your * option) any later version; or * * b) the GL2PS License as published by Christophe Geuzaine, 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 either * the GNU Library General Public License or the GL2PS License for * more details. * * You should have received a copy of the GNU Library General Public * License along with this library in the file named "COPYING.LGPL"; * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * * You should have received a copy of the GL2PS License with this * library in the file named "COPYING.GL2PS"; if not, I will be glad * to provide one. * * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. * Please report all bugs and problems to . */ #ifndef __GL2PS_H__ #define __GL2PS_H__ #include #include /* Define GL2PSDLL at compile time to build a Windows DLL */ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) # if defined(_MSC_VER) # pragma warning(disable:4115) # endif # include # if defined(GL2PSDLL) # if defined(GL2PSDLL_EXPORTS) # define GL2PSDLL_API __declspec(dllexport) # else # define GL2PSDLL_API __declspec(dllimport) # endif # else # define GL2PSDLL_API # endif #else # define GL2PSDLL_API #endif #if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H) # include #else # include #endif /* Support for compressed PostScript/PDF/SVG and for embedded PNG images in SVG */ #if defined(HAVE_ZLIB) || defined(HAVE_LIBZ) # define GL2PS_HAVE_ZLIB # if defined(HAVE_LIBPNG) || defined(HAVE_PNG) # define GL2PS_HAVE_LIBPNG # endif #endif /* Version number */ #define GL2PS_MAJOR_VERSION 1 #define GL2PS_MINOR_VERSION 3 #define GL2PS_PATCH_VERSION 2 #define GL2PS_EXTRA_VERSION "" #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \ 0.01 * GL2PS_MINOR_VERSION + \ 0.0001 * GL2PS_PATCH_VERSION) #define GL2PS_COPYRIGHT "(C) 1999-2006 Christophe Geuzaine (geuz@geuz.org)" /* Output file formats (the values and the ordering are important!) */ #define GL2PS_PS 0 #define GL2PS_EPS 1 #define GL2PS_TEX 2 #define GL2PS_PDF 3 #define GL2PS_SVG 4 #define GL2PS_PGF 5 /* Sorting algorithms */ #define GL2PS_NO_SORT 1 #define GL2PS_SIMPLE_SORT 2 #define GL2PS_BSP_SORT 3 /* Message levels and error codes */ #define GL2PS_SUCCESS 0 #define GL2PS_INFO 1 #define GL2PS_WARNING 2 #define GL2PS_ERROR 3 #define GL2PS_NO_FEEDBACK 4 #define GL2PS_OVERFLOW 5 #define GL2PS_UNINITIALIZED 6 /* Options for gl2psBeginPage */ #define GL2PS_NONE 0 #define GL2PS_DRAW_BACKGROUND (1<<0) #define GL2PS_SIMPLE_LINE_OFFSET (1<<1) #define GL2PS_SILENT (1<<2) #define GL2PS_BEST_ROOT (1<<3) #define GL2PS_OCCLUSION_CULL (1<<4) #define GL2PS_NO_TEXT (1<<5) #define GL2PS_LANDSCAPE (1<<6) #define GL2PS_NO_PS3_SHADING (1<<7) #define GL2PS_NO_PIXMAP (1<<8) #define GL2PS_USE_CURRENT_VIEWPORT (1<<9) #define GL2PS_COMPRESS (1<<10) #define GL2PS_NO_BLENDING (1<<11) #define GL2PS_TIGHT_BOUNDING_BOX (1<<12) /* Arguments for gl2psEnable/gl2psDisable */ #define GL2PS_POLYGON_OFFSET_FILL 1 #define GL2PS_POLYGON_BOUNDARY 2 #define GL2PS_LINE_STIPPLE 3 #define GL2PS_BLEND 4 /* Text alignment (o=raster position; default mode is BL): +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o | o | o | | o | | | | | | | | | | | | +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ C CL CR B BL BR T TL TR */ #define GL2PS_TEXT_C 1 #define GL2PS_TEXT_CL 2 #define GL2PS_TEXT_CR 3 #define GL2PS_TEXT_B 4 #define GL2PS_TEXT_BL 5 #define GL2PS_TEXT_BR 6 #define GL2PS_TEXT_T 7 #define GL2PS_TEXT_TL 8 #define GL2PS_TEXT_TR 9 typedef GLfloat GL2PSrgba[4]; #if defined(__cplusplus) extern "C" { #endif GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename); GL2PSDLL_API GLint gl2psEndPage(void); GL2PSDLL_API GLint gl2psSetOptions(GLint options); GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]); GL2PSDLL_API GLint gl2psEndViewport(void); GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize); GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle); GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, GLenum format, GLenum type, const void *pixels); GL2PSDLL_API GLint gl2psEnable(GLint mode); GL2PSDLL_API GLint gl2psDisable(GLint mode); GL2PSDLL_API GLint gl2psPointSize(GLfloat value); GL2PSDLL_API GLint gl2psLineWidth(GLfloat value); GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor); /* undocumented */ GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height, const GLfloat position[3], const unsigned char *imagemap); GL2PSDLL_API const char *gl2psGetFileExtension(GLint format); GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format); #if defined(__cplusplus) } #endif #endif /* __GL2PS_H__ */ xmakemol-5.16/elements0000644000175000017500000002074510664011044011746 00000000000000! Copyright (C) 1998, 1999, 2001, 2002, 2005 Matthew P. Hodges ! This file is part of XMakemol. ! ! XMakemol is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! XMakemol is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with XMakemol; see the file COPYING. If not, write to the Free ! Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA ! ! Z Symbol Mass Colour Cov rad VdW rad 0 DU 0.000 White 0.500 0.000 1 H 1.008 White 0.320 1.000 2 HE 4.003 Pink 0.310 1.400 3 LI 6.941 Firebrick 1.630 0.000 4 BE 9.012 Black 0.900 0.000 5 B 10.811 Green 0.820 0.000 6 C 12.011 SlateGrey 0.770 1.700 7 N 14.007 Blue2 0.750 1.500 8 O 15.999 Red 0.730 1.400 9 F 18.998 Goldenrod 0.720 1.400 10 NE 20.180 Black 0.710 1.500 11 NA 22.990 Blue 1.540 0.000 12 MG 24.305 Black 1.360 0.000 13 AL 26.982 Forestgreen 1.180 0.000 14 SI 28.085 Goldenrod 1.110 0.000 15 P 30.974 Orange 1.060 0.000 16 S 32.066 Yellow 1.020 1.800 17 CL 35.453 Green 0.990 1.800 18 AR 39.948 DarkBlue 0.980 1.800 19 K 39.098 DeepPink 2.030 0.000 20 CA 40.078 Gray 1.740 0.000 21 SC 44.956 Gray 1.440 0.000 22 TI 47.880 Gray 1.320 0.000 23 V 50.941 Gray 1.220 0.000 24 CR 51.996 Gray 1.180 0.000 25 MN 54.938 Gray 1.170 0.000 26 FE 55.847 Orange 1.170 0.000 27 CO 58.933 Brown 1.160 0.000 28 NI 58.693 Brown 1.150 0.000 29 CU 63.546 Brown 1.170 0.000 30 ZN 65.390 Brown 1.250 0.000 31 GA 69.723 Brown 1.260 0.000 32 GE 72.610 rosybrown3 1.220 0.000 33 AS 74.922 CadetBlue 1.200 0.000 34 SE 78.960 Brown 1.160 2.000 35 BR 79.904 Brown 1.140 2.000 36 KR 83.800 Gray 1.120 0.000 37 RB 85.468 Green4 2.160 0.000 38 SR 87.620 Purple 1.910 2.200 39 Y 88.906 Brown 1.620 0.000 40 ZR 91.224 Goldenrod 1.450 0.000 41 NB 92.906 White 1.340 0.000 42 MO 95.940 White 1.300 0.000 43 TC 97.907 White 1.270 0.000 44 RU 101.070 White 1.250 0.000 45 RH 102.906 White 1.250 0.000 46 PD 106.420 White 1.280 0.000 47 AG 107.870 Gray 1.340 0.000 48 CD 112.411 Green4 1.480 0.000 49 IN 114.818 White 1.440 0.000 50 SN 118.710 White 1.410 0.000 51 SB 121.760 White 1.400 0.000 52 TE 127.600 White 1.360 0.000 53 I 129.905 Purple 1.330 2.200 54 XE 131.290 White 1.310 0.000 55 CS 132.905 Brown 2.350 0.000 56 BA 137.327 White 1.980 0.000 57 LA 138.905 White 1.690 0.000 58 CE 140.115 White 1.650 0.000 59 PR 140.908 White 1.650 0.000 60 ND 144.240 White 1.840 0.000 61 PM 144.913 White 1.630 0.000 62 SM 150.360 White 1.620 0.000 63 EU 151.965 White 1.850 0.000 64 GD 157.250 White 1.610 0.000 65 TB 158.925 White 1.590 0.000 66 DY 162.500 White 1.590 0.000 67 HO 164.930 White 1.580 0.000 68 ER 167.260 White 1.570 0.000 69 TM 168.934 White 1.560 0.000 70 YB 173.040 White 2.000 0.000 71 LU 174.967 White 1.560 0.000 72 HF 178.490 White 1.440 0.000 73 TA 180.948 White 1.340 0.000 74 W 183.840 White 1.300 0.000 75 RE 186.207 White 1.280 0.000 76 OS 190.230 White 1.260 0.000 77 IR 192.220 White 1.270 0.000 78 PT 195.080 White 1.300 0.000 79 AU 196.967 Goldenrod 1.340 0.000 80 HG 200.590 White 1.490 0.000 81 TL 204.383 White 1.480 0.000 82 PB 207.200 White 1.470 0.000 83 BI 208.980 White 1.460 0.000 84 PO 208.982 White 1.460 0.000 85 AT 209.987 White 2.000 0.000 86 RN 222.018 White 2.000 0.000 87 FR 223.020 White 2.000 0.000 88 RA 226.025 White 2.000 0.000 89 AC 227.028 White 2.000 0.000 90 TH 232.038 White 1.650 0.000 91 PA 231.036 White 2.000 0.000 92 U 238.029 White 1.420 0.000 93 NP 237.048 White 2.000 0.000 94 PU 244.064 White 2.000 0.000 95 AM 243.061 White 2.000 0.000 96 CM 247.070 White 2.000 0.000 97 BK 247.070 White 2.000 0.000 98 CF 251.080 White 2.000 0.000 99 ES 252.083 White 2.000 0.000 100 FM 257.095 White 2.000 0.000 101 MD 258.100 White 2.000 0.000 102 NO 259.101 White 2.000 0.000 103 LR 262.110 White 2.000 0.000 104 RF 261 White 2.000 0.000 105 DB 262 White 2.000 0.000 106 SG 266 White 2.000 0.000 107 BH 264 White 2.000 0.000 108 HS 269 White 2.000 0.000 109 MT 268 White 2.000 0.000 xmakemol-5.16/PROBLEMS0000644000175000017500000000162010216306120011337 00000000000000-*- outline -*- * XMakemol Problems This file contains descriptions and solutions to known problems. ** Parsing XYZ files If XMakemol has problems parsing XYZ files, then it may be because of the setting of the LANG environment variable. Assuming you are using a bash-like shell, try launching the program with: $ LANG=en_GB xmakemol ** Saving XPM files With OpenGL rendering you might get unexpected results, like seeing cutouts in your XPM image where any windows overlapped the main drawing area. A workaround for this problem, if you are using XFree86, is to enable a backing store in your /etc/X11/XF86Config-4: Section "Device" [...] Option "BackingStore" EndSection If this is successful, then in your /var/log/XFree86.0.log file you should see lines like: (**) TRIDENT(0): Option "BackingStore" (**) TRIDENT(0): Backing store enabled xmakemol-5.16/Makefile.orig0000644000175000017500000001114110664010504012574 00000000000000# -*- makefile -*- # Copyright (C) 1998, 1999, 2000, 2001, 2005 Matthew P. Hodges # This file is part of XMakemol. # XMakemol is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # XMakemol is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with XMakemol; see the file COPYING. If not, write to the Free # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA # Configure # Point of installation # PREFIX = /usr/local PROG = xmakemol VERSION = $(shell cat VERSION) HDRS = bbox.h bonds.h config.h defs.h draw.h globals.h gl_funcs.h \ vectors.h view.h xm_logo.h OBJS = animate.o basename.o bbox.o canvas.o control.o draw.o edit.o \ file.o frames.o gl_funcs.o help.o menus.o region.o rotate.o sort.o \ store.o track.o translate.o utils.o view.o vectors.o xmakemol.o SRCS = ${OBJS:.o=.c} TAR = $(SRCS) $(HDRS) Makefile.orig ChangeLog elements COPYING README \ INSTALL AUTHORS VERSION PROBLEMS XMakemol.ad xmake_anim.pl xmakemol.1 # Specify the version VERS = -DVERSION=\"${VERSION}\" # Configure # Specify where the elements file lives. If an individual user wants # to use a private elements file, they can set the environment # variable XM_ELEMENTS. ELEM_FILE=/etc/xmakemol/elements ELEM = -DELEMENTS=\"${ELEM_FILE}\" # Configure # If libXpm is available uncomment the following lines # XPM_DEFS = -DXPM # XPM_LIBS = -lXpm # Configure # If OpenGl is available uncomment the following lines - NB this is # only partially implemented, so use at your own risk # GL_DEFS = -DGL # GL_LIBS = -lGL -lGLU -lGLw # Configure # If CrystalEyes stereoscopic shutter glasses are available and XMakemol # is being compiled on an SGI, uncomment the following lines. Currently # the stereo mode used is STEREO_TOP, so make sure the XMakemol window is # positioned in the upper half of your screen before switching to SGI stereo # mode. # (This mode requires that GL_DEFS and GL_LIBS above are also uncommented) # CE_DEFS = -DSGI_STEREO # CE_LIBS = -lXext # Configure # Choose compiler options. SGI, DEC and SUN have some useful flags set # and certain libraries which are required. Uncomment the desired region. # Compilation with gcc is recommended. # SGI setup # # CC = cc # COMP = -n32 -mips4 # OPT = -Ofast=ip22_5k # LIBS = -lm -lgen -lXm -lXt -lX11 # DEC setup # # CC = cc # COMP = # OPT = -O4 # LIBS = -lm -lXm -lXt -lX11 # SUN setup # # CC = cc # COMP = -D_XOPEN_SOURCE -xdepend -xchip=ultra -xarch=v8plus -xsafe=mem # OPT = -fast -xO5 # LIBDIRS = -L/usr/openwin/lib -L/usr/dt/lib -L/opt/local/lib -R/usr/openwin/lib:/usr/dt/lib:/opt/local/lib # LIBS = -lm -lgen -lposix4 -lXm -lXt -lX11 # Linux setup # # CC = gcc # COMP = -I/usr/X11R6/include -O3 -Wall # LIBDIRS = -L/usr/X11R6/lib # LIBS = -lm -lXm -lXt -lX11 -lXext -ldl -lpthread DEBUG = -g # No changes below here should be needed CFLAGS = ${DEBUG} ${OPT} ${COMP} ${XPM_DEFS} ${GL_DEFS} ${CE_DEFS} LDFLAGS = ${DEBUG} all: $(PROG) $(PROG): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) ${LIBDIRS} ${XPM_LIBS} ${GL_LIBS} $(LIBS) ${CE_LIBS} clean: rm -f $(PROG) $(OBJS) core tar: tar zvcf xmakemol-${VERSION}.tar.gz $(TAR) install: install -D xmakemol $(DESTDIR)$(PREFIX)/X11R6/bin/xmakemol install -D elements $(DESTDIR)/etc/xmakemol/elements install -D xmakemol.1 $(DESTDIR)$(PREFIX)/X11R6/man/man1/xmakemol.1x install -D XMakemol.ad $(DESTDIR)/etc/X11/app-defaults/XMakemol animate.o: defs.h globals.h bbox.o: bbox.h defs.h gl_funcs.h globals.h view.h canvas.o: bonds.h defs.h draw.h gl_funcs.h globals.h view.h xm_logo.h control.o: defs.h globals.h draw.o: bonds.h defs.h draw.h globals.h vectors.h view.h edit.o: defs.h draw.h globals.h vectors.h view.h file.o: file.c bonds.h defs.h draw.h gl_funcs.h globals.h view.h ${CC} ${CFLAGS} ${ELEM} -c $< frames.o: config.h draw.h globals.h gl_funcs.o: bonds.h defs.h draw.h globals.h view.h gl_funcs.h help.o: help.c globals.h ${CC} ${CFLAGS} ${VERS} -c $< menus.o: globals.h view.h region.o: globals.h rotate.o: draw.h globals.h sort.o: globals.h store.o: globals.h track.o: defs.h globals.h translate.o: globals.h utils.o: config.h defs.h globals.h vectors.o: defs.h globals.h vectors.h view.h view.o: globals.h view.h xmakemol.o: xmakemol.c defs.h globals.h view.h gl_funcs.h ${CC} ${CFLAGS} ${ELEM} ${VERS} -c $< xmakemol-5.16/ToDo.txt0000644000175000017500000000027407751226122011620 00000000000000List of things to do (in no particular order): o Bounding box improvements (specify vertices or angles/lengths); also write EPS bounding box code. o Add more GL features (e.g., axes). xmakemol-5.16/xmake_anim.pl0000755000175000017500000000743610664010665012672 00000000000000#! /usr/bin/perl -w # Copyright (C) 1999, 2000, 2002, 2003, 2005 Matthew P. Hodges # This file is part of XMakemol. # XMakemol is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # XMakemol is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with XMakemol; see the file COPYING. If not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # Script to make an animated gif from a series of .xpm files produced # by XMakemol. Uses the `convert' and `gifsicle' programs. # $rcs = ' $Id: xmake_anim.pl,v 1.23 2007/08/25 11:25:41 MPHodges Exp $ ' ; use Getopt::Std; # Configure: specify where the binaries are $convert = "/usr/bin/convert"; if (! -e $convert) { die ("Cannot find convert program (part of ImageMagick). Please install it.\n"); } $gifsicle = "/usr/bin/gifsicle"; if (! -e $gifsicle) { print ("Cannot find gifsicle program, install it for better performance.\n"); $gifsicle = "0"; } # Set the default options $opt_c = 0; # Clean up *.gif *.xpm files $opt_d = 0; # The delay in 1/100th seconds if ($gifsicle) { $opt_l = "forever"; # The number of loops } else { $opt_l = 0; } getopts ("cd:l:o:"); $0 =~ s/.*\///; # Basename if ($#ARGV != 0) { print ("Usage: $0 [options] prefix\n"); print (" -c (clean up files)\n"); print (" -d (in 1/100th seconds)\n"); print (" -l (0 for infinite)\n"); print (" -o \n"); die (); } $root = $ARGV[0]; # Protect against some regexp constructs $root =~ s/\./\\./g; $root =~ s/\+/\\+/g; if (defined ($opt_o)) { $output = $opt_o; } else { $output = $root . ".gif"; } opendir (DIR, "."); @xpm_files = sort by_frame_number (grep (/$root\.[0-9]+\.xpm$/, readdir (DIR))); if ($#xpm_files == -1) { die ("No files matching $root*.xpm\n"); } # Convert each xpm file into a gif file if ($gifsicle) { print ("Converting files from xpm to gif "); foreach $xpm_file (@xpm_files) { $gif_file = $xpm_file; $gif_file =~ s/xpm$/gif/; # Don't run if $gif_file exists and is newer than $xpm_file if ((-e $gif_file) && ((-M $gif_file) < (-M $xpm_file))) { print ("$gif_file newer than $xpm_file -- skipping\n"); } else { print ("\n $xpm_file -> $gif_file\n"); `$convert $xpm_file $gif_file`; } push (@gif_files, $gif_file); } # Run gifsicle $command = "$gifsicle --delay $opt_d --loopcount=$opt_l @gif_files > $output"; print ("\nRunning gifsicle --- $command\n\n"); `$command`; } else { # Use convert, if gifsicle is not available $command = "$convert -delay $opt_d -loop $opt_l @xpm_files $output"; print ("\nRunning convert --- $command\n\n"); `$command`; } print ("\n$output written\n"); # Clean up files if ($opt_c) { print ("\nCleaning up *.xpm and *.gif files\n"); if (defined (@gif_files)) { unlink (@gif_files); } unlink (@xpm_files); } sub by_frame_number { $frame1 = $a; $frame2 = $b; # Remove all but the number frame the file name $frame1 =~ s/.*\.(\d+)\.xpm$/$1/; $frame2 =~ s/.*\.(\d+)\.xpm$/$1/; $frame1 <=> $frame2; } xmakemol-5.16/xmakemol.10000644000175000017500000000217110213030715012073 00000000000000.TH "xmakemol" "1" "May 2004" "XMakemol" "" .SH NAME XMakemol \- A program for visualizing atomic and molecular systems. .SH SYNOPSIS .B xmakemol .RI [ options ] .SH DESCRIPTION .PP XMakemol is a program for viewing and manipulating atomic and molecular systems. .br XMakemol is a mouse\-based application and many features can be accessed by clicking or dragging the mouse on the main window. Additional popup dialogs offer a number of additional features. .SH OPTIONS .B .IP \-a Switch off atoms. .B .IP \-b Switch off bonds. .B .IP \-h Switch on hydrogen bonds. .B .IP \-c Set the canvas colour. .B .IP \-e Set the bounding box colour. .B .IP \-f Read file on startup (use '\-f \-' for STDIN). .B .IP \-G Switch off GL rendering. .B .IP \-u Print usage information. .B .IP \-v Print version information. .SH FILES .LP \fI/usr/share/xmakemol/elements\fP List of element properties. .SH ENVIRONMENT VARIABLES .LP .TP \fBXM_ELEMENTS\fP Specifies an alternative location for the elements file. .SH EXAMPLES .LP To run this program the standard way type: .LP xmakemol \-f .SH AUTHOR Matthew P. Hodges xmakemol-5.16/xmake_anim.pl.10000644000175000017500000000203507641065635013024 00000000000000.\"Created with GNOME Manpages Editor Wizard .\"http://gmanedit.sourceforge.net .\"Sergio Rua .\" .TH "xmake_anim.pl" "1" "May 2002" "XMakemol" "" .SH NAME xmake_anim.pl \- A script to make GIF animations from XMakemol output. .SH SYNOPSIS .B xmake_anim.pl .RI [ options ] prefix .br .SH DESCRIPTION .PP xmake_anim.pl is used to make a GIF animation from a series of XPM files produced by XMakemol. The XPM files should have the common prefix \fBprefix\fP. .SH OPTIONS .B .IP -c This option leads to the temporary (single image) GIF files being cleaned up after the animation has been created from them. .B .IP -d This option allows the delay (in 1/100th seconds) between animated frames to be set. By default, there is no delay. .B .IP -l This option can be used to set the number of times the animation loops for. By default, the animation loops indefinitely. .B .IP -o This option can be used to set the name of the file that the animation is saved to. .SH SEE ALSO xmakemol(1) .SH AUTHOR Matthew P. Hodges xmakemol-5.16/xmakemol.html0000644000175000017500000006365010665572535012736 00000000000000 XMakemol Documentation

XMakemol Documentation

Matthew P. Hodges

Version: 5.16

Overview

XMakemol is an application for the visualization and manipulation of atomic, molecular, and other chemical systems. It is written in ANSI C and uses the Xlib library for rendering and also the Xt and LessTif toolkits for the user interface. XMakemol is only distributed under the GNU GENERAL PUBLIC LICENSE (Version 2, June 1991) which means that it is free in the sense that you have the freedom to obtain and modify the source and to redistribute it. A copy of the license should have been included in the distribution. You can download view it at http://www.gnu.org/copyleft/gpl.html.

XMakemol is principally a mouse-based application with menus and pop up dialog boxes with buttons, scrollbars etc. In addition, some dialogs have text fields which require information to be inputed from the keyboard. The main window of the application is split into menus at the top, the canvas in the middle and an area at the bottom in which messages appear.

The manual will cover invocation then all the menu entries then some miscellaneous features, mainly dealing with the methods of interacting with the system on the canvas.

Invocation

Various options are available from the command line. These are as follows:

 Usage: xmakemol [options]
        -a          Switch off atoms
        -b          Switch off bonds
        -h          Switch on hydrogen bonds
        -c <colour> Set the canvas colour
        -e <colour> Set the bounding box colour
        -f <file>   Read file on startup (use '-f -' for STDIN)
        -G          Switch off GL rendering [If OpenGL support is compiled in]
        -u          Print usage information
        -v          Print version information

The -a, -b and -h options toggle the default behaviour and as such might be useful. The -c and -e options allow the user to control the background and bounding box colours in case the defaults are not liked (these may be named colours, e.g., "cadet blue", or hex triplets, e.g., "#5F9EA0"). The -f option allows a file to be specified to be read in on starting the program. The -u options echos the above text to standard output and the -v option prints the version and Copyright information. The -G option switches off rendering using OpenGL primitives, and is only available if support for OpenGL has been compiled in. As for any X application, other options can be specified, for example, -geometry.

Menus

File

The menu entries under File deal with the reading and writing of files and quitting the application.

Open

Choose a file to be read by XMakemol. The file must be in XYZ syntax an example of which follows:

 4
   1 Energy = -594.0315361957    
 Ar      0.86540     -0.41643      2.29667
 Ar     -1.78146     -2.11666      0.23641
 Ar      1.11998     -0.42506     -1.45518
 Ar     -1.52687      1.63520      0.24505
 4
   2 Energy = -594.0315361957    
 Ar      0.86540     -0.41643      2.29667
 Ar     -1.78146     -2.11666      0.23641
 Ar      1.11998     -0.42506     -1.45518
 Ar     -1.52687      1.63520      0.24505

The file is set into “frames” of which there are two in the above example. The structure of each frame is as follows. The first line contains the number of atoms in the frame (M) and the second line contains a comment, which may be empty. The next M lines contain the type of atom followed by the three Cartesian coordinates; the length unit assumed is Angstrom. Note that details of each type of atom are held in the elements file (see below) which contains atomic masses radii and specified colours.

In addition to the basic syntax, it is possible to declare vectors (default maximum of three per atom):

 3
 Water (axes on oxygen displayed using vectors)
 O    0.0  0.0  0.00 atom_vector 1 0 0 atom_vector 0 1 0 atom_vector 0 0 1
 H    0.77 0.0 -0.59
 H   -0.77 0.0 -0.59

and ellipses:

 3
 All ellipses should look the same
 O    -4.0 0.0 0.0 ellipse 1.0 2.0 2.0  0.0 90.0  0.0
 O     0.0 0.0 0.0 ellipse 2.0 1.0 2.0  0.0 90.0 90.0
 O     4.0 0.0 0.0 ellipse 2.0 2.0 1.0  0.0  0.0  0.0

where the ellipse keyword must be followed by three numbers describing the x, y and z axis dimensions and three Euler angles (alpha, beta and gamma). The convention used for the Euler angles is: rotation of gamma about Z; rotation of beta about Y; rotation of alpha about Z, where X, Y and Z are global axes.

Revert

Revert to the saved version of the current file.

Save

Choose a file to save coordinate data to. The following options are available:

  • XYZ (all): the atom types and Cartesian coordinates for all (visible) atoms in all frames.
  • XYZ (frame): the atom types and Cartesian coordinates for all (visible) atoms in the current frame.
  • XYZ + connectivities (frame): the information for the current frame, plus for each atom a list of the other atoms which it is bonded to.
  • Auxiliary info: currently this saves information about the perspective set for each frame.

Merge

Merge the current Cartesian coordinates with those in another file. The following options are available:

  • Use first frame: merge the first frame in the selected file with each of those in the current file.
  • Use all frames: merge the the first frame in the selected file with the first in the current file, the second with the second, and so on.

Export

Choose a file to export data to. The following options are available for the non-OpenGL rendering:

  • Fig (b/w): FIG format rendering of the canvas (black and white).
  • Fig (colour): FIG format rendering of the canvas (colour).
  • EPS (b/w): encapsulated PostScript rendering of the canvas (black and white).
  • EPS (colour): encapsulated PostScript rendering of the canvas (colour).

The following options are available for the OpenGL rendering:

  • GL2PS (EPS): encapsulated PostScript rendering of the canvas (uses the GL2PS library).
  • GL2PS (PDF): PDF format rendering of the canvas (uses the GL2PS library).
  • GL2PS (SVG): SVG format rendering of the canvas (uses the GL2PS library).

The following option is available for either type of rendering:

  • XPM: XPM format rendering of the canvas (only available if XPM support has been compiled in).

Print

Convenient dialog to enable printing of PostScript rendering of the canvas (black and white, or colour).

Quit

Quit the application; no offers will be made to save any data under any circumstances.

Control

The menu entries under Control provide a number of pop up dialogs for controlling various aspects of frames.

Frames

The frames dialog controls the animation of multiple-frame files. At the top, the frame number and corresponding comments are displayed. If the comment is empty, this is also indicated.

Next, there are a number of buttons which do the following:

  • Start: start the animation (which loops infinitely). While the animation is playing only a limited amount of functionality remains. The Stop button can of course be pressed and mouse actions on the canvas are mostly supported.
  • Stop: stop the animation.
  • Next: move to the next frame.
  • Previous; move to the previous frame.
  • Rewind; move to the first frame.
  • Bounce; animate the frames but when the last frame is reached, animate them in reverse order until the first frame is reached and so on.
  • Make anim (XPM only): save an XPM file for each frame, with a comment root.

The speed of the animation can be controlled with the scale bar marked with “Select speed”.

If the “Centre each frame” button is activated, then when ever the frame is changed, the centre of mass is moved to the origin. This can be useful if an animation involved large displacements of the centre of mass resulting in the atoms leaving the field of view.

Finally, a frame can be selected by number in the “Select frame” text field.

Animate

The animate dialog allows a frame to be rotated by a specified angle by a specified number of times about a specified axis. The animation is started with the “Start” button and can be stopped with the “Stop” button. An indication of the progress of the animation is given in the message area. Such animations can be saved by clicking on the “Save” button followed by selecting a filename; the default type is XYZ, which saves the coordinates for each frame of the animation. With XPM support, an option to save each frame to an XPM file exists.

Measure

The Measure dialog shows the distances and angles between selected atoms. Atoms are selected and deselected using [mouse-3] and a selected atom is indicated on the canvas by being stippled. Up to four atoms can be pushed on to and popped off the stack. The selections can be cleared using the “Unselect all atoms” button. Each selected atom is labelled A-D and these labels also appear on the canvas. The atom number is also displayed in the dialog.

Perspective

The perspective dialog contains two scale bars: the “Alter scale” simply controls the size at which atoms, bonds and so on are drawn and the “Choose depth” scale allows the depth of field to be varied. If the “Toggle depth” button is not activated, then there is no variation in the atom size with depth. The settings can be chosen to “Act on all frames” or to “Act on current frame”.

Edit

The menu entries under Edit provide a number of pop up dialogs which can alter both the properties of atoms and bonds.

Visible

From this dialog, the visibility of each atom can be toggled, i.e., you can directly control whether or not an atom is displayed on the canvas. Individual atoms can be selected using Shift + [Mouse-3] and all invisible atoms can (temporarily) be shown with Shift + [Mouse-1]. In addition the visibility of groups of atoms can be toggled with buttons labelled for example “Toggle H atoms”, “Invert selection” and “Reselect all”. Each of these can work for:

  • all atoms on the canvas.
  • all atoms inside a rectangular region.
  • all atoms outside a rectangular region.

(Note that rectangular regions can be drawn with Control + [Mouse-1].)

If all frames contain the same number of atoms, then the “Propagate visibilities to all frames” allows changes to apply to all frames.

Positions

Scale bars and text widgets are available to translate the selected atoms in the X, Y and Z directions, and to rotate the selected atoms about the X, Y and Z axes. As for the selection of the visible atoms, each can be toggled with Control + [Mouse-3] when the Edit->Positions dialog is open. Groups of atoms can be selected in the same way as outlined above. When an atom is not selected it is drawn with a cross-hair (not OpenGL rendering) and its position cannot be changed.

Scale coordinates

This dialog allows the atom (and vector) coordinates to be scaled by a constant factor. Internally, the program uses Angstrom for the unit of length, and a pre-defined Bohr to Angstrom factor is available, allowing convenient conversion for input files that have the coordinates in Bohr. An Angstrom to Bohr factor is available for the reverse transformation.

Atom and bond sizes

In this dialog, the size of the atoms and bonds as displayed on the canvas can be varied. There are scale bars for the atomic radius, the bond width and the hydrogen bond width. Note that the sizes of the atoms as displayed on the canvas also depend on the covalent or van der Waals radii as set in the external elements file (see below) which is read when the first file is opened.

Bond factors

These two scale bars allow some control over which atoms are considered to be bonded or H-bonded. The algorithm which determines this information from the Cartesian coordinates uses the sum of the covalent radii of pairs of atoms. Increasing the default values will lead to more bonds and decreasing the default value will lead to fewer bonds. If a system is split into molecules (see the molecule keyword below), separate factors for intermolecular and intramolecular bonds can be specified.

Vector display

The vector rendering works better with OpenGL rendering, and this is recommended at present. Some customization of how the vectors look is possible.

Bounding Box

With this dialog, the way that the bounding box is determined can be chosen. If you choose “automatically”, XMakemol draws a cuboid which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes. If “from file” is chosen, the minimum and maximum coordinates of the bounding box are read from the input file. The input fields allow you to adjust the size of the automatic bounding box.

The visibility of the bounding box can be toggled via the “Bounding Box” item in the View menu.

This dialog is only available if a file is loaded.

Element properties

This dialog allows the convenient editing of the default element properties (colour, covalent/van der Waals radii). These can be saved, in which case the changes will be used for future XMakemol sessions.

GL rendering

If OpenGL support has been compiled in, then this dialog will be present. Firstly, it allows the switching of rendering between the X and OpenGL primitives. Secondly, it allows the customization of some of the OpenGL rendering.

The customizations which can currently be made are:

  • Switch between “No Stereo”, “Stereo Pair” and “Red/Blue stereo” viewing: the first option renders a single image; the second option renders a stereo pair of images for eyes-crossed viewing; the last option requires glasses with red and blue lenses. It is possible to alter the separation of the two images.
  • Lighting can be switched on and off, and a spotlight effect can be added, the diffuseness of which can be customized.
  • Molecules can be rendered in the normal “Ball and Stick” mode or as “Tubes”. In the latter case, bonded atoms are displayed such that they appear to cap the bond to which they are attached.
  • The number of planes used to represent atom and bond surfaces can be altered.
  • Options to alter the perspective of the rendered scene (field of view, and position of eye).

Track

The Track menu controls the behaviour of the mouse on the canvas and also allows some general transformations to be made to the atomic coordinates. The current mouse bindings can be found in the Help menu.

Rotate about local COM

If this is selected, the mouse on the canvas will control rotations of the atoms about the local centre of mass i.e. that defined by the selected atoms.

Rotate about origin

If this is selected, the mouse on the canvas will control rotations of the atoms about the global origin.

Centre

This moves the centre of mass of the system to the origin.

Original orientation

Restore the original orientation (i.e., realign axes).

Original position

Restore the original position of the atoms (i.e., remove any displacements made to the centre of mass).

Reflect x coordinates

Reflects the atomic coordinates about the yz plane.

Reflect y coordinates

Reflects the atomic coordinates about the xz plane.

Reflect z coordinates

Reflects the atomic coordinates about the xy plane.

Invert through centre

Invert all coordinates through the origin.

View

The View menu controls what is displayed on the canvas.

Atoms

Toggle whether or not atoms are displayed.

Bonds

Toggle whether or not bonds are displayed. Bonds can be formed between any two types of atom.

H-bonds

Toggle whether or not hydrogen bonds are displayed. Hydrogen bonds can be formed between any hydrogen and any non-hydrogen atoms.

Vectors

Toggle whether or not vectors are displayed.

Atom numbers

Toggle whether of not the atom numbers are displayed for each atom. These correspond to the order in which the atoms were read in.

Atom symbols

Toggle whether or not the atomic symbols are displayed for each atom.

Axes

Toggle whether or not a set of axes (x,y,z) are displayed on the canvas. These correspond to a local axis set which before any rotations is parallel to the global axes (X,Y,Z). (not OpenGL rendering)

Bounding box

If enabled, a cuboid is drawn which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes.

Outline

If enabled, this reduces the amount of drawing done on the canvas while the system is being rotated or translated. This can be useful for large systems for which the normal interactive response is slow.

Help

About

Displays the version and Copyright information.

Documentation

Gives a pointer to the online documentation.

Mouse

This dialog gives a list of actions which the mouse has on the canvas.

Bugs

Details how to report bugs.

Miscellaneous

The elements file

The elements file is an external file, the location of which must be specified in the Makefile before building. The head of the elements file (past the copyright information) looks like this:

 ! Z     Symbol       Mass        Colour          Cov rad         VdW rad
   1     H            1.008       White           0.300           1.000
   2     HE           4.003       Pink            0.310           1.400

The first entry is the atomic number. The second entry is a label corresponding to what should be written in an input file (note that comparison is not case sensitive). The third entry is the atomic mass. The fourth entry is the colour which is used to paint the atom (and bonds) on the canvas. The final two entries are covalent and van der Waals radii; if there is no van der Waals radius for a given atom a value of zero should be used.

The xmake_anim.pl script

This script which is distributed with the source can be used to merge a group of XPM files produced for an animation into a single file:

Usage: xmake_anim.pl [options] prefix
       -c                (clean up files)
       -d <delay>        (in 1/100th seconds)
       -l <no_loops>     (0 for infinite)
       -o <output>

Other input file options

Examples of the XYZ syntax have been given above. The atom_vector and ellipse keywords have also been described. Several other keywords are available for use in input files:

  • atom_rgb: give RGB values for the atom colour, overriding the default.
  • atom_color: give colour name for the atom, overriding the default.

Periodic systems

There is limited support for dealing with periodic systems. This example shows how to use the available features:

2

Na 0.0 0.0 0.0 crystal_origin   0.0 0.0 0.0 crystal_images 5 5 5
Cl 2.5 2.5 2.5 crystal_vector 1 5.0 0.0 0.0 crystal_vector 2 0.0 5.0 0.0 crystal_vector 3 0.0 0.0 5.0

Here, a two atom unit cell is defined, and a 5x5x5 slab is defined to be rendered by the crystal_images keyword. Three vectors are defined by the crystal_vector keyword, and these define the cell vectors. If the origin of the crystal isn't at the origin itself, an offset can be specified with the crystal_origin keyword.

Customized rendering modes

It is possible to render different groups of atoms with different rendering modes when OpenGL rendering is in use with lighting switched on. The syntax is:

63
Water molecule inside Buckminster Fullerene
C  1.22650000   0.00000000   3.31450000  render_tube
C  0.37900000   1.16640000   3.31450000

[...]

C  2.33370000  -2.58660000  -0.59480000
O  0.00000000   0.00000000   0.00000000  render_ball_and_stick
H  0.76923955   0.00000000  -0.59357141
H -0.76923955   0.00000000  -0.59357141

where the first 60 atoms will be rendered as “Tubes”, and the final three as “Balls and Sticks”. Note, that if this type of input is used, then the specifications override the normal “Tubes” or “Ball and Stick” choice that can be made, and these buttons (described above) will have no effect.

Customized bounding box

You can specify a custom bounding box, which can be shown instead of the automatically-determined one. This is done using the bbox_xyz keyword. It takes the minimum and maximum coordinates of the bounding box as parameters, in the following order: xmin, xmax, ymin, ymax, zmin, zmax. For example,

3
Custom bounding box around water molecule
O  0.00000000   0.00000000   0.00000000
H  0.76923955   0.00000000  -0.59357141  bbox_xyz -1.0 1.0 -0.5 0.5 -1.0 0.5
H -0.76923955   0.00000000  -0.59357141

draws a box around a water molecule. As you can see, bbox_xyz does not have to be associated with the first atom. If this keyword is given in the input file, the bounding box will automatically be made visible after the file is loaded. Via the “Bounding Box” item in the “Edit” menu you can select which bounding box is shown and also modify the size of the automatically-determined one. If you give the bounding box data in the first frame, it will be reused in all frames, unless other data is specified. This feature is, for example, useful if you want to visualize results of computer simulations of bulk systems, with the bounding box representing your simulation box.

Specifying molecules

The molecule keyword can be used on an input line to signify the start of a new molecule (this is implied for the first one). At present, the only feature that exploits this is the choice of separate values for intermolecular and intramolecular bond and H-bond factors.


WelcomePage

xmakemol-5.16/xmakemol.txt0000644000175000017500000005134510665573431012603 00000000000000XMakemol Documentation Matthew P. Hodges Version: 5.16 Overview XMakemol is an application for the visualization and manipulation of atomic, molecular, and other chemical systems. It is written in ANSI C and uses the Xlib library for rendering and also the Xt and LessTif toolkits for the user interface. XMakemol is only distributed under the GNU GENERAL PUBLIC LICENSE (Version 2, June 1991) which means that it is free in the sense that you have the freedom to obtain and modify the source and to redistribute it. A copy of the license should have been included in the distribution. You can download view it at http://www.gnu.org/copyleft/gpl.html. XMakemol is principally a mouse-based application with menus and pop up dialog boxes with buttons, scrollbars etc. In addition, some dialogs have text fields which require information to be inputed from the keyboard. The main window of the application is split into menus at the top, the canvas in the middle and an area at the bottom in which messages appear. The manual will cover invocation then all the menu entries then some miscellaneous features, mainly dealing with the methods of interacting with the system on the canvas. Invocation Various options are available from the command line. These are as follows: Usage: xmakemol [options] -a Switch off atoms -b Switch off bonds -h Switch on hydrogen bonds -c Set the canvas colour -e Set the bounding box colour -f Read file on startup (use '-f -' for STDIN) -G Switch off GL rendering [If OpenGL support is compiled in] -u Print usage information -v Print version information The -a, -b and -h options toggle the default behaviour and as such might be useful. The -c and -e options allow the user to control the background and bounding box colours in case the defaults are not liked (these may be named colours, e.g., "cadet blue", or hex triplets, e.g., "#5F9EA0"). The -f option allows a file to be specified to be read in on starting the program. The -u options echos the above text to standard output and the -v option prints the version and Copyright information. The -G option switches off rendering using OpenGL primitives, and is only available if support for OpenGL has been compiled in. As for any X application, other options can be specified, for example, -geometry. Menus File The menu entries under File deal with the reading and writing of files and quitting the application. Open Choose a file to be read by XMakemol. The file must be in XYZ syntax an example of which follows: 4 1 Energy = -594.0315361957 Ar 0.86540 -0.41643 2.29667 Ar -1.78146 -2.11666 0.23641 Ar 1.11998 -0.42506 -1.45518 Ar -1.52687 1.63520 0.24505 4 2 Energy = -594.0315361957 Ar 0.86540 -0.41643 2.29667 Ar -1.78146 -2.11666 0.23641 Ar 1.11998 -0.42506 -1.45518 Ar -1.52687 1.63520 0.24505 The file is set into "frames" of which there are two in the above example. The structure of each frame is as follows. The first line contains the number of atoms in the frame (M) and the second line contains a comment, which may be empty. The next M lines contain the type of atom followed by the three Cartesian coordinates; the length unit assumed is Angstrom. Note that details of each type of atom are held in the elements file (see below) which contains atomic masses radii and specified colours. In addition to the basic syntax, it is possible to declare vectors (default maximum of three per atom): 3 Water (axes on oxygen displayed using vectors) O 0.0 0.0 0.00 atom_vector 1 0 0 atom_vector 0 1 0 atom_vector 0 0 1 H 0.77 0.0 -0.59 H -0.77 0.0 -0.59 and ellipses: 3 All ellipses should look the same O -4.0 0.0 0.0 ellipse 1.0 2.0 2.0 0.0 90.0 0.0 O 0.0 0.0 0.0 ellipse 2.0 1.0 2.0 0.0 90.0 90.0 O 4.0 0.0 0.0 ellipse 2.0 2.0 1.0 0.0 0.0 0.0 where the ellipse keyword must be followed by three numbers describing the x, y and z axis dimensions and three Euler angles (alpha, beta and gamma). The convention used for the Euler angles is: rotation of gamma about Z; rotation of beta about Y; rotation of alpha about Z, where X, Y and Z are global axes. Revert Revert to the saved version of the current file. Save Choose a file to save coordinate data to. The following options are available: * XYZ (all): the atom types and Cartesian coordinates for all (visible) atoms in all frames. * XYZ (frame): the atom types and Cartesian coordinates for all (visible) atoms in the current frame. * XYZ + connectivities (frame): the information for the current frame, plus for each atom a list of the other atoms which it is bonded to. * Auxiliary info: currently this saves information about the perspective set for each frame. Merge Merge the current Cartesian coordinates with those in another file. The following options are available: * Use first frame: merge the first frame in the selected file with each of those in the current file. * Use all frames: merge the the first frame in the selected file with the first in the current file, the second with the second, and so on. Export Choose a file to export data to. The following options are available for the non-OpenGL rendering: * Fig (b/w): FIG format rendering of the canvas (black and white). * Fig (colour): FIG format rendering of the canvas (colour). * EPS (b/w): encapsulated PostScript rendering of the canvas (black and white). * EPS (colour): encapsulated PostScript rendering of the canvas (colour). The following options are available for the OpenGL rendering: * GL2PS (EPS): encapsulated PostScript rendering of the canvas (uses the GL2PS library). * GL2PS (PDF): PDF format rendering of the canvas (uses the GL2PS library). * GL2PS (SVG): SVG format rendering of the canvas (uses the GL2PS library). The following option is available for either type of rendering: * XPM: XPM format rendering of the canvas (only available if XPM support has been compiled in). Print Convenient dialog to enable printing of PostScript rendering of the canvas (black and white, or colour). Quit Quit the application; no offers will be made to save any data under any circumstances. Control The menu entries under Control provide a number of pop up dialogs for controlling various aspects of frames. Frames The frames dialog controls the animation of multiple-frame files. At the top, the frame number and corresponding comments are displayed. If the comment is empty, this is also indicated. Next, there are a number of buttons which do the following: * Start: start the animation (which loops infinitely). While the animation is playing only a limited amount of functionality remains. The Stop button can of course be pressed and mouse actions on the canvas are mostly supported. * Stop: stop the animation. * Next: move to the next frame. * Previous; move to the previous frame. * Rewind; move to the first frame. * Bounce; animate the frames but when the last frame is reached, animate them in reverse order until the first frame is reached and so on. * Make anim (XPM only): save an XPM file for each frame, with a comment root. The speed of the animation can be controlled with the scale bar marked with "Select speed". If the "Centre each frame" button is activated, then when ever the frame is changed, the centre of mass is moved to the origin. This can be useful if an animation involved large displacements of the centre of mass resulting in the atoms leaving the field of view. Finally, a frame can be selected by number in the "Select frame" text field. Animate The animate dialog allows a frame to be rotated by a specified angle by a specified number of times about a specified axis. The animation is started with the "Start" button and can be stopped with the "Stop" button. An indication of the progress of the animation is given in the message area. Such animations can be saved by clicking on the "Save" button followed by selecting a filename; the default type is XYZ, which saves the coordinates for each frame of the animation. With XPM support, an option to save each frame to an XPM file exists. Measure The Measure dialog shows the distances and angles between selected atoms. Atoms are selected and deselected using [mouse-3] and a selected atom is indicated on the canvas by being stippled. Up to four atoms can be pushed on to and popped off the stack. The selections can be cleared using the "Unselect all atoms" button. Each selected atom is labelled A-D and these labels also appear on the canvas. The atom number is also displayed in the dialog. Perspective The perspective dialog contains two scale bars: the "Alter scale" simply controls the size at which atoms, bonds and so on are drawn and the "Choose depth" scale allows the depth of field to be varied. If the "Toggle depth" button is not activated, then there is no variation in the atom size with depth. The settings can be chosen to "Act on all frames" or to "Act on current frame". Edit The menu entries under Edit provide a number of pop up dialogs which can alter both the properties of atoms and bonds. Visible From this dialog, the visibility of each atom can be toggled, i.e., you can directly control whether or not an atom is displayed on the canvas. Individual atoms can be selected using Shift + [Mouse-3] and all invisible atoms can (temporarily) be shown with Shift + [Mouse-1]. In addition the visibility of groups of atoms can be toggled with buttons labelled for example "Toggle H atoms", "Invert selection" and "Reselect all". Each of these can work for: * all atoms on the canvas. * all atoms inside a rectangular region. * all atoms outside a rectangular region. (Note that rectangular regions can be drawn with Control + [Mouse-1].) If all frames contain the same number of atoms, then the "Propagate visibilities to all frames" allows changes to apply to all frames. Positions Scale bars and text widgets are available to translate the selected atoms in the X, Y and Z directions, and to rotate the selected atoms about the X, Y and Z axes. As for the selection of the visible atoms, each can be toggled with Control + [Mouse-3] when the Edit->Positions dialog is open. Groups of atoms can be selected in the same way as outlined above. When an atom is not selected it is drawn with a cross-hair (not OpenGL rendering) and its position cannot be changed. Scale coordinates This dialog allows the atom (and vector) coordinates to be scaled by a constant factor. Internally, the program uses Angstrom for the unit of length, and a pre-defined Bohr to Angstrom factor is available, allowing convenient conversion for input files that have the coordinates in Bohr. An Angstrom to Bohr factor is available for the reverse transformation. Atom and bond sizes In this dialog, the size of the atoms and bonds as displayed on the canvas can be varied. There are scale bars for the atomic radius, the bond width and the hydrogen bond width. Note that the sizes of the atoms as displayed on the canvas also depend on the covalent or van der Waals radii as set in the external elements file (see below) which is read when the first file is opened. Bond factors These two scale bars allow some control over which atoms are considered to be bonded or H-bonded. The algorithm which determines this information from the Cartesian coordinates uses the sum of the covalent radii of pairs of atoms. Increasing the default values will lead to more bonds and decreasing the default value will lead to fewer bonds. If a system is split into molecules (see the molecule keyword below), separate factors for intermolecular and intramolecular bonds can be specified. Vector display The vector rendering works better with OpenGL rendering, and this is recommended at present. Some customization of how the vectors look is possible. Bounding Box With this dialog, the way that the bounding box is determined can be chosen. If you choose "automatically", XMakemol draws a cuboid which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes. If "from file" is chosen, the minimum and maximum coordinates of the bounding box are read from the input file. The input fields allow you to adjust the size of the automatic bounding box. The visibility of the bounding box can be toggled via the "Bounding Box" item in the View menu. This dialog is only available if a file is loaded. Element properties This dialog allows the convenient editing of the default element properties (colour, covalent/van der Waals radii). These can be saved, in which case the changes will be used for future XMakemol sessions. GL rendering If OpenGL support has been compiled in, then this dialog will be present. Firstly, it allows the switching of rendering between the X and OpenGL primitives. Secondly, it allows the customization of some of the OpenGL rendering. The customizations which can currently be made are: * Switch between "No Stereo", "Stereo Pair" and "Red/Blue stereo" viewing: the first option renders a single image; the second option renders a stereo pair of images for eyes-crossed viewing; the last option requires glasses with red and blue lenses. It is possible to alter the separation of the two images. * Lighting can be switched on and off, and a spotlight effect can be added, the diffuseness of which can be customized. * Molecules can be rendered in the normal "Ball and Stick" mode or as "Tubes". In the latter case, bonded atoms are displayed such that they appear to cap the bond to which they are attached. * The number of planes used to represent atom and bond surfaces can be altered. * Options to alter the perspective of the rendered scene (field of view, and position of eye). Track The Track menu controls the behaviour of the mouse on the canvas and also allows some general transformations to be made to the atomic coordinates. The current mouse bindings can be found in the Help menu. Rotate about local COM If this is selected, the mouse on the canvas will control rotations of the atoms about the local centre of mass i.e. that defined by the selected atoms. Rotate about origin If this is selected, the mouse on the canvas will control rotations of the atoms about the global origin. Centre This moves the centre of mass of the system to the origin. Original orientation Restore the original orientation (i.e., realign axes). Original position Restore the original position of the atoms (i.e., remove any displacements made to the centre of mass). Reflect x coordinates Reflects the atomic coordinates about the yz plane. Reflect y coordinates Reflects the atomic coordinates about the xz plane. Reflect z coordinates Reflects the atomic coordinates about the xy plane. Invert through centre Invert all coordinates through the origin. View The View menu controls what is displayed on the canvas. Atoms Toggle whether or not atoms are displayed. Bonds Toggle whether or not bonds are displayed. Bonds can be formed between any two types of atom. H-bonds Toggle whether or not hydrogen bonds are displayed. Hydrogen bonds can be formed between any hydrogen and any non-hydrogen atoms. Vectors Toggle whether or not vectors are displayed. Atom numbers Toggle whether of not the atom numbers are displayed for each atom. These correspond to the order in which the atoms were read in. Atom symbols Toggle whether or not the atomic symbols are displayed for each atom. Axes Toggle whether or not a set of axes (x,y,z) are displayed on the canvas. These correspond to a local axis set which before any rotations is parallel to the global axes (X,Y,Z). (not OpenGL rendering) Bounding box If enabled, a cuboid is drawn which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes. Outline If enabled, this reduces the amount of drawing done on the canvas while the system is being rotated or translated. This can be useful for large systems for which the normal interactive response is slow. Help About Displays the version and Copyright information. Documentation Gives a pointer to the online documentation. Mouse This dialog gives a list of actions which the mouse has on the canvas. Bugs Details how to report bugs. Miscellaneous The elements file The elements file is an external file, the location of which must be specified in the Makefile before building. The head of the elements file (past the copyright information) looks like this: ! Z Symbol Mass Colour Cov rad VdW rad 1 H 1.008 White 0.300 1.000 2 HE 4.003 Pink 0.310 1.400 The first entry is the atomic number. The second entry is a label corresponding to what should be written in an input file (note that comparison is not case sensitive). The third entry is the atomic mass. The fourth entry is the colour which is used to paint the atom (and bonds) on the canvas. The final two entries are covalent and van der Waals radii; if there is no van der Waals radius for a given atom a value of zero should be used. The xmake_anim.pl script This script which is distributed with the source can be used to merge a group of XPM files produced for an animation into a single file: Usage: xmake_anim.pl [options] prefix -c (clean up files) -d (in 1/100th seconds) -l (0 for infinite) -o Other input file options Examples of the XYZ syntax have been given above. The atom_vector and ellipse keywords have also been described. Several other keywords are available for use in input files: * atom_rgb: give RGB values for the atom colour, overriding the default. * atom_color: give colour name for the atom, overriding the default. Periodic systems There is limited support for dealing with periodic systems. This example shows how to use the available features: 2 Na 0.0 0.0 0.0 crystal_origin 0.0 0.0 0.0 crystal_images 5 5 5 Cl 2.5 2.5 2.5 crystal_vector 1 5.0 0.0 0.0 crystal_vector 2 0.0 5.0 0.0 crystal_vector 3 0.0 0.0 5.0 Here, a two atom unit cell is defined, and a 5x5x5 slab is defined to be rendered by the crystal_images keyword. Three vectors are defined by the crystal_vector keyword, and these define the cell vectors. If the origin of the crystal isn't at the origin itself, an offset can be specified with the crystal_origin keyword. Customized rendering modes It is possible to render different groups of atoms with different rendering modes when OpenGL rendering is in use with lighting switched on. The syntax is: 63 Water molecule inside Buckminster Fullerene C 1.22650000 0.00000000 3.31450000 render_tube C 0.37900000 1.16640000 3.31450000 [...] C 2.33370000 -2.58660000 -0.59480000 O 0.00000000 0.00000000 0.00000000 render_ball_and_stick H 0.76923955 0.00000000 -0.59357141 H -0.76923955 0.00000000 -0.59357141 where the first 60 atoms will be rendered as "Tubes", and the final three as "Balls and Sticks". Note, that if this type of input is used, then the specifications override the normal "Tubes" or "Ball and Stick" choice that can be made, and these buttons (described above) will have no effect. Customized bounding box You can specify a custom bounding box, which can be shown instead of the automatically-determined one. This is done using the bbox_xyz keyword. It takes the minimum and maximum coordinates of the bounding box as parameters, in the following order: xmin, xmax, ymin, ymax, zmin, zmax. For example, 3 Custom bounding box around water molecule O 0.00000000 0.00000000 0.00000000 H 0.76923955 0.00000000 -0.59357141 bbox_xyz -1.0 1.0 -0.5 0.5 -1.0 0.5 H -0.76923955 0.00000000 -0.59357141 draws a box around a water molecule. As you can see, bbox_xyz does not have to be associated with the first atom. If this keyword is given in the input file, the bounding box will automatically be made visible after the file is loaded. Via the "Bounding Box" item in the "Edit" menu you can select which bounding box is shown and also modify the size of the automatically-determined one. If you give the bounding box data in the first frame, it will be reused in all frames, unless other data is specified. This feature is, for example, useful if you want to visualize results of computer simulations of bulk systems, with the bounding box representing your simulation box. Specifying molecules The molecule keyword can be used on an input line to signify the start of a new molecule (this is implied for the first one). At present, the only feature that exploits this is the choice of separate values for intermolecular and intramolecular bond and H-bond factors. ------------------------------------------------------------------------------- Updated: 2007-08-30