libgdiplus-4.2/0000775000175000017500000000000012635563145010532 500000000000000libgdiplus-4.2/ChangeLog0000664000175000017500000002233112377405421012220 000000000000002009-01-02 Sebastien Pouliot * autogen.sh: Rename --with-cairo=system to --skip-cairo. This option allows you to skip the autogen part of cairo and pixman if you're building libgdiplus with a more recent (than 1.6.4) version of cairo. * configure.in: Automatically use the system cairo if it's more recent than the one we have bundled in libgdiplus. * README: Update with changes 2008-08-12 Raja R Harinath * configure.in (FONTCONFIG_CONFIG): Rename from FONTCONFIG-CONFIG. (FREETYPE_CONFIG): Likewise. 2008-05-22 Wade Berrier * configure.in: version bump -> 1.9.1 2008-04-16 Sebastien Pouliot * cairo/configure.in: Fix (at least try to) the Solaris build. 2008-04-16 Geoff Norton * configure.in: Ensure we never build the cairo-font support in our embedded cairo, it breaks gdi+ everywhere on Mac. 2008-04-16 Sebastien Pouliot * cairo/*: Update to Cairo 1.6.4 * pixman/*: New (it's out of Cairo now). Version 0.10 * src/cairo-embed.h: Moved into cairo tree (pixman has it's own too) 2008-01-28 Wade Berrier * configure.in: version bump -> 1.9 2007-12-03 Sebastien Pouliot * configure.in: Disable cairo PNG support since libgdiplus provides it's own (save about 26kb of code size). 2007-11-08 Wade Berrier * configure.in: version bump -> 1.2.6 2007-10-26 Sebastien Pouliot * configure.in: Make sure --without-libgif works (as we also check for libungif) 2007-08-09 Sebastien Pouliot * autogen.sh: Skip running cairo/autogen.sh if we're not using our internal copy of Cairo. * configure.in: Add --with-cairo=internal,system and --with-pango (unsupported) options. * libgdiplus.pc.in: Add additional requirements if the system's Cairo and/or Pango are being used. * Makefile.am: Don't include cairo in SUBDIRS if we're not using our internal copy of Cairo. * NEWS: Link to mono-project.com * README: Added new build options * TODO: refreshed 2007-07-24 Wade Berrier * configure.in: version bump -> 1.2.5 2007-04-24 Sebastien Pouliot * configure.in: Add check for FcFini 2007-04-19 Wade Berrier * configure.in: version bump -> 1.2.4 2007-04-03 Sebastien Pouliot * configure.in: Add check for visibility ("hidden") attribute (based on mono's configure.in) to enable hiding libgdiplus internals. 2007-02-21 Sebastien Pouliot * configure.in: Disable the "newer" PDF and SVG surface backends as they aren't required by GDI+ (saves about 130kb in the .so). 2007-03-16 Wade Berrier * configure.in: version bump -> 1.2.3.50 (RaceToLinux) 2007-02-01 Sebastien Pouliot * TODO: Updated to include bug reports closed because of some Cairo limitations. 2007-01-12 Sebastien Pouliot * TODO: Updated to remove missing ICON decoder and functions GdipCreateBitmapFromHICON and GdipCreateHICONFromBitmap. Also removed comments about DEBUG_MEMLEAKS as it's better to use valgrind. 2007-01-04 Wade Berrier * configure.in: * libgdiplus.pc.in: Remove CAIRO_CFLAGS and CAIRO_LIBS from libgdiplus.pc. Fixes: bxc: #79889 2006-11-17 Wade Berrier * configure.in: version bump -> 1.2.1 2006-11-02 Wade Berrier * configure.in: version bump -> 1.2 2006-08-23 Wade Berrier * cairo/configure.in: Use a backward compatible method of finding pkg-config instead of the >= 0.16 macro. 2006-08-15 Gonzalo Paniagua Javier * configure.in: properly disable exif support when asked to do so. 2006-08-13 Gonzalo Paniagua Javier * configure.in: if libexif is available use it. 2006-07-21 Alexander Olk * cairo/src/cairo-xlib-surface.c: Backported a patch from cairo head that removes XSync implementation of surface_flush. (git commit b7191885c88068dad57d68ced69a752d1162b12c) 2006-07-13 Wade Berrier * configure.in: separate xrender pkg-config statement from the glib statement. If xrender.pc isn't found, the glib settings are not gathered. 2006-07-12 Chris Toshok * configure.in: add --with-pics=yes for subdir configure args. 2006-07-11 Peter Dennis Bartok * Updated to cairo 1.2 2006-06-08 Sebastien Pouliot * TODO: Updated status for GdipIsVisiblePathPoint[I] functions. 2006-06-07 Sebastien Pouliot * TODO: Updated to add status for GdipIsOutlineVisiblePathPoint[I] and GdipIsVisiblePathPoint[I] functions. 2006-05-25 Sebastien Pouliot * TODO: Updated to remove GdipSetClipHrgn and to add a few more details. 2006-05-25 Gonzalo Paniagua Javier * configure.in: made libpng12 mandatory. The resources used in SWF are png files. 2006-05-05 Sebastien Pouliot * TODO: Added a few details about some not-quite-supported API. 2006-05-02 Sebastien Pouliot * TODO: Removed GdipBeginContainer and GdipEndContainer from the list of unimplemented functions. Added note for GdipAddString[I] about the partial support for both functions. 2006-04-28 Wade Berrier * configure.in: Fallback to -config if .pc files are not found for freetype and fontconfig 2006-04-21 Peter Dennis Bartok * TODO: Removed newly implemented items from the list 2006-03-29 Gonzalo Paniagua Javier * src/image.c: avoid double-freeing Scan0 twice. Fixes bug #77910. 2006-01-31 Sebastien Pouliot * TODO: Remove GdipCreateRegionPath. GdipFlattenPath and GdipSetClipPath from the list if unimplemented functions. 2006-01-13 Peter Dennis Bartok * libgdiplus.pc.in: Removed cairo as a dependency. Fixes #77173 2006-01-09 Everaldo Canuto * Fix cairo compilation problems when used gcc 4.0.2. 2006-01-04 Peter Dennis Bartok * configure.in: - ungif check was using cached gif check result. Fixed by changing name of ungif check to be different from gif check. - Removed unused cairo check 2005-09-19 Jordi Mas * configure.in: Keep also libungif support on top of libgif 2005-10-17 Ruediger Oertel * configure.in: Switching from libungif to libgif 2005-09-19 Jordi Mas * Added TODO file 2005-09-13 Jordi Mas * configure.in: 1.1.9 (It was only changed in the mono-1-1-9 tag) 2005-09-12 Jordi Mas * configure.in: comment out linking with installed Cairo options until we supported again 2005-08-25 Hisham Mardam Bey * Upgrade Cairo to 1.0 release * Added INSTALL file 2005-06-10 Ben Maurer * configure.in: 1.1.8 2005-06-02 Peter Bartok * configure.in: Added URLs to help people find the image libraries (suggested by Gonzalo) 2005-05-03 Ben Maurer * configure.in: 1.1.7 2005-03-22 Raja R Harinath * configure.in (CAIRO_CFLAGS): Work with builddir != srcdir. 2005-01-26 Geoff Norton * configure.in: Add AC_C_BIGENDIAN check to define WORDS_BIGENDIAN where needed Tue Jan 25 11:34:41 CET 2005 Paolo Molaro * configure.in, Makefile.am, cairo, libpixman: imported the cairo sources so it's easier to track the right version. 2005-01-23 Peter Bartok * configure.in: - Bumped required cairo version to *exactly* 0.3.0. After that version, there are major changes that we don't track yet. - Added detection define for post 0.3.0 suppor 2005-01-18 Geoff Norton * configure.in: Bump required cairo version to 0.2.0. We dont support 0.1.x anymore 2004-07-04 Peter Bartok * configure.in: Added fix for bug #60787, added dependency definitons for pthreads (Mark Recht [recht at netbsd.org] verified the fix) 2004-05-27 Jordi Mas * configure.in. make libpng optional depending on the user's system 2004-05-20 Gonzalo Paniagua Javier * libgdiplus.pc.in: cairo package name is not cairo-0.1.17. 2004-05-14 Gonzalo Paniagua Javier * configure.in: added configuration summary. 2004-05-05 Ravindra * configure.in: We need cairo 0.1.22 version. 2004-04-17 Vladimir Vukicevic * configure.in: fixed gdip_ok -> $gdip_ok in sigsetjmp check 2004-04-04 Vladimir Vukicevic * configure.in: "libpng", not "libgpng" * configure.in: Add checks for libungif and libpng. Added sigsetjmp check. * configure.in: Added checks for libtiff and libjpeg. Cribbed from gtk. Also added in test/Makefile target. 2004-01-31 Miguel de Icaza * Initial release, split from the Mono's MCS package. libgdiplus-4.2/INSTALL0000664000175000017500000002243212377405421011501 00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. 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, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) 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 you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' 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. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. 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 support 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' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' 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' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS 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 machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. 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. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--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. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. libgdiplus-4.2/src/0000775000175000017500000000000012635563145011321 500000000000000libgdiplus-4.2/src/adjustablearrowcap.c0000664000175000017500000001440112377405421015255 00000000000000/* * adjustablearrowcap.c * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: * Ravindra (rkumar@novell.com) * * Copyright (C) 2003-2007 Novell, Inc. http://www.novell.com */ #include "adjustablearrowcap-private.h" #include "graphics-private.h" static GpStatus gdip_adjust_arrowcap_setup (GpGraphics *graphics, GpCustomLineCap *cap); static GpStatus gdip_adjust_arrowcap_clone_cap (GpCustomLineCap *cap, GpCustomLineCap **clonedCap); static GpStatus gdip_adjust_arrowcap_destroy (GpCustomLineCap *cap); static GpStatus gdip_adjust_arrowcap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *Cap, float x, float y, float otherend_x, float otherend_y); /* * we have a single copy of vtable for * all instances of adjustable arrowcap. */ static CapClass vtable = { CustomLineCapTypeAdjustableArrow, gdip_adjust_arrowcap_setup, gdip_adjust_arrowcap_clone_cap, gdip_adjust_arrowcap_destroy, gdip_adjust_arrowcap_draw }; static void gdip_adjust_arrowcap_init (GpAdjustableArrowCap *arrow) { gdip_custom_linecap_init (&arrow->base, &vtable); arrow->fill_state = TRUE; arrow->middle_inset = 0.0; arrow->width = 0.0; arrow->height = 0.0; } static GpAdjustableArrowCap* gdip_adjust_arrowcap_new (void) { GpAdjustableArrowCap *result = (GpAdjustableArrowCap *) GdipAlloc (sizeof (GpAdjustableArrowCap)); if (result) gdip_adjust_arrowcap_init (result); return result; } GpStatus gdip_adjust_arrowcap_clone_cap (GpCustomLineCap *cap, GpCustomLineCap **clonedCap) { GpAdjustableArrowCap *newcap; if (!cap || !clonedCap) return InvalidParameter; newcap = (GpAdjustableArrowCap *) GdipAlloc (sizeof (GpAdjustableArrowCap)); if (!newcap) return OutOfMemory; memcpy (newcap, cap, sizeof (GpAdjustableArrowCap)); *clonedCap = (GpCustomLineCap *) newcap; return Ok; } GpStatus gdip_adjust_arrowcap_destroy (GpCustomLineCap *cap) { if (!cap) return InvalidParameter; GdipFree (cap); return Ok; } /* MonoTODO: Implement this when cairo supports cairo_stroke_path API */ GpStatus gdip_adjust_arrowcap_setup (GpGraphics *graphics, GpCustomLineCap *customCap) { if (!graphics || !customCap) return InvalidParameter; return NotImplemented; } GpStatus gdip_adjust_arrowcap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *customCap, float x, float y, float otherend_x, float otherend_y) { double angle; GpAdjustableArrowCap *arrowcap; float w; float h; float penwidth; if (!graphics || !customCap) return InvalidParameter; penwidth = pen->width; if (penwidth < 2.0) { /* Seems to be a minimum */ penwidth = 2.0; } arrowcap = (GpAdjustableArrowCap *)customCap; w = arrowcap->width / 2; h = arrowcap->height; angle = gdip_custom_linecap_angle (x, y, otherend_x, otherend_y); cairo_save (graphics->ct); /* FIXME: handle base_inset (including set/get!) */ cairo_translate (graphics->ct, x, y); cairo_rotate (graphics->ct, angle); gdip_cairo_move_to (graphics, 0, 0, TRUE, TRUE); gdip_cairo_line_to (graphics, -w * penwidth, -h * penwidth, TRUE, TRUE); gdip_cairo_line_to (graphics, w * penwidth, -h * penwidth, TRUE, TRUE); gdip_cairo_line_to (graphics, 0, 0, TRUE, TRUE); if (arrowcap->fill_state) { /* FIXME: handle middle_inset */ cairo_fill_preserve (graphics->ct); } cairo_stroke (graphics->ct); cairo_restore (graphics->ct); return Ok; } /* AdjustableArrowCap functions */ // coverity[+alloc : arg-*3] GpStatus GdipCreateAdjustableArrowCap (float height, float width, BOOL isFilled, GpAdjustableArrowCap **arrowCap) { GpAdjustableArrowCap *cap; if (!arrowCap) return InvalidParameter; cap = gdip_adjust_arrowcap_new (); if (!cap) { *arrowCap = NULL; return OutOfMemory; } cap->fill_state = isFilled; cap->width = width; cap->height = height; *arrowCap = cap; return Ok; } GpStatus GdipSetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, float height) { if (!arrowCap) return InvalidParameter; arrowCap->height = height; return Ok; } GpStatus GdipGetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, float *height) { if (!arrowCap || !height) return InvalidParameter; *(height) = arrowCap->height; return Ok; } GpStatus GdipSetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, float width) { if (!arrowCap) return InvalidParameter; arrowCap->width = width; return Ok; } GpStatus GdipGetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, float *width) { if (!arrowCap || !width) return InvalidParameter; *(width) = arrowCap->width; return Ok; } GpStatus GdipSetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, float middleInset) { if (!arrowCap) return InvalidParameter; arrowCap->middle_inset = middleInset; return Ok; } GpStatus GdipGetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, float *middleInset) { if (!arrowCap || !middleInset) return InvalidParameter; *(middleInset) = arrowCap->middle_inset; return Ok; } GpStatus GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL isFilled) { if (!arrowCap) return InvalidParameter; arrowCap->fill_state = isFilled; return Ok; } GpStatus GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL *isFilled) { if (!arrowCap || !isFilled) return InvalidParameter; *(isFilled) = arrowCap->fill_state; return Ok; } libgdiplus-4.2/src/bmpcodec.c0000664000175000017500000011724012377405421013161 00000000000000/* * Copyright (c) 2004 Ximian * Copyright (C) 2003-2004,2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * bmpcodec.c : Contains function definitions for encoding decoding bmp images * * Authors: * Jordi Mas i Hernandez (jordi@ximian.com) * Sanjay Gupta (gsanjay@novell.com) * Mark Steele (ms@rapidsys.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Useful documentation about bitmaps * * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_4v1h.asp * http://www.csdn.net/Dev/Format/windows/Bmp.html * http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html * * Header structure * BITMAPFILEHEADER * BITMAPINFOHEADER or BITMAPV4HEADER or BITMAPV5HEADER or BITMAPCOREHEADER * RGBQUADS or RGBTRIPLE (optional) * Bitmap data */ #include "gdiplus-private.h" #include "bmpcodec.h" GUID gdip_bmp_image_format_guid = {0xb96b3cabU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; /* Codecinfo related data*/ static ImageCodecInfo bmp_codec; static const WCHAR bmp_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'B', 'M', 'P', 0}; /* Built-in BMP */ static const WCHAR bmp_extension[] = {'*','.','B', 'M', 'P',';', '*','.', 'D','I', 'B',';', '*','.', 'R', 'L', 'E',0}; /* *.BMP;*.DIB;*.RLE */ static const WCHAR bmp_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'b', 'm', 'p', 0}; /* image/bmp */ static const WCHAR bmp_format[] = {'B', 'M', 'P', 0}; /* BMP */ static const BYTE bmp_sig_pattern[] = { 0x42, 0x4D }; static const BYTE bmp_sig_mask[] = { 0xFF, 0xFF }; ImageCodecInfo * gdip_getcodecinfo_bmp () { bmp_codec.Clsid = (CLSID) { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; bmp_codec.FormatID = gdip_bmp_image_format_guid; bmp_codec.CodecName = (const WCHAR*) bmp_codecname; bmp_codec.DllName = NULL; bmp_codec.FormatDescription = (const WCHAR*) bmp_format; bmp_codec.FilenameExtension = (const WCHAR*) bmp_extension; bmp_codec.MimeType = (const WCHAR*) bmp_mimetype; bmp_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; bmp_codec.Version = 1; bmp_codec.SigCount = 1; bmp_codec.SigSize = 2; bmp_codec.SigPattern = bmp_sig_pattern; bmp_codec.SigMask = bmp_sig_mask; return &bmp_codec; } static GpStatus gdip_get_bmp_pixelformat (BITMAPINFOHEADER *bih, PixelFormat *dest) { int bitCount = bih->biBitCount; int compression = bih->biCompression; switch (compression) { case BI_RLE4: if (bitCount != 4) return InvalidParameter; *dest = PixelFormat4bppIndexed; break; case BI_RLE8: if (bitCount != 8) return InvalidParameter; *dest = PixelFormat8bppIndexed; break; case BI_BITFIELDS: if (bitCount != 16) return InvalidParameter; /* note: incomplete at this stage */ *dest = PixelFormat16bppRGB565; break; default: switch (bitCount) { case 32: *dest = PixelFormat32bppRGB; break; case 24: *dest = PixelFormat24bppRGB; break; case 16: /* MS produce such files (i.e. bad header) for storing ImageList bitmaps, see bug #80797 */ *dest = PixelFormat16bppRGB565; break; case 8: *dest = PixelFormat8bppIndexed; break; case 4: *dest = PixelFormat4bppIndexed; break; case 1: *dest = PixelFormat1bppIndexed; break; default: g_warning ("Unsupported bitcount (%d) and/or compression (%d).", bitCount, compression); return InvalidParameter; } } return Ok; } static void gdip_bitmap_fill_info_header (GpBitmap *bitmap, PBITMAPINFOHEADER bmi) { PixelFormat format = bitmap->active_bitmap->pixel_format; memset (bmi, 0, sizeof (BITMAPINFOHEADER)); #ifdef WORDS_BIGENDIAN bmi->biSize = GUINT32_FROM_LE (sizeof (BITMAPINFOHEADER)); bmi->biWidth = GULONG_FROM_LE (bitmap->active_bitmap->width); bmi->biHeight = GULONG_FROM_LE (bitmap->active_bitmap->height); bmi->biPlanes = GUINT16_FROM_LE (1); if (format != PixelFormat24bppRGB) bmi->biBitCount = GUINT16_FROM_LE (gdip_get_pixel_format_bpp (bitmap->active_bitmap->pixel_format)); else bmi->biBitCount = GUINT16_FROM_LE (24); bmi->biCompression = GUINT32_FROM_LE (BI_RGB); bmi->biSizeImage = GUINT32_FROM_LE (0); /* Many tools expect this may be set to zero for BI_RGB bitmaps */ bmi->biXPelsPerMeter = GULONG_FROM_LE ((int) (0.5f + ((gdip_get_display_dpi() * 3937) / 100))); bmi->biYPelsPerMeter = GULONG_FROM_LE ((int) (0.5f + ((gdip_get_display_dpi() * 3937) / 100))); /* 1 meter is = 39.37 */ #else bmi->biSize = sizeof (BITMAPINFOHEADER); bmi->biWidth = bitmap->active_bitmap->width; bmi->biHeight = bitmap->active_bitmap->height; bmi->biPlanes = 1; if (format != PixelFormat24bppRGB) bmi->biBitCount = gdip_get_pixel_format_bpp (bitmap->active_bitmap->pixel_format); else bmi->biBitCount = 24; bmi->biCompression = BI_RGB; bmi->biSizeImage = 0; /* Many tools expect this may be set to zero for BI_RGB bitmaps */ bmi->biXPelsPerMeter = (int) (0.5f + ((gdip_get_display_dpi() * 3937) / 100)); bmi->biYPelsPerMeter = (int) (0.5f + ((gdip_get_display_dpi() * 3937) / 100)); /* 1 meter is = 39.37 */ #endif } static GpStatus gdip_read_bmp_rle_8bit (void *pointer, BYTE *scan0, BOOL upsidedown, int stride, int scanWidth, int scanCount, ImageSource source) { BYTE code; int bytes_read; int col_offset = 0; int row_offset = (upsidedown ? (scanCount - 1) * stride : 0); int row_delta = (upsidedown ? -stride : +stride); int rows_remaining = scanCount; BOOL new_row = FALSE; if (scanWidth > stride) return InvalidParameter; while ((rows_remaining > 0) || ((row_offset == 0) && (col_offset < scanWidth))) { bytes_read = gdip_read_bmp_data (pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ if (code == 0) { /* RLE escape code */ bytes_read = gdip_read_bmp_data (pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ switch (code) { case 0: /* skip remainder of scan */ { if (new_row) new_row = FALSE; else { row_offset += row_delta; rows_remaining--; col_offset = 0; } break; } case 1: /* skip remainder of image -- in other words, we're finished :-) */ { return Ok; } case 2: /* jump forward (dx, dy) coordinates */ { BYTE dx, dy; bytes_read = gdip_read_bmp_data (pointer, &dx, 1, source); bytes_read += gdip_read_bmp_data (pointer, &dy, 1, source); if (bytes_read < 2) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ /* not really sure how to handle the case where the X delta goes * past the end of the scan. in the interest of not crashing, * let's wrap it back around. */ col_offset = (col_offset + dx) % scanWidth; row_offset -= dy * stride; /* BMPs go from bottom to top */ new_row = FALSE; break; } default: /* an uncompressed section, 'code' pixels wide */ { /* uncompressed sections must be an even number of bytes long, * even if they are an odd number of *pixels* long. */ BOOL pad_byte_present = ((code & 1) != 0); int bytes_to_read = code; /* wrap rows properly, even though they are inverted in memory */ while (bytes_to_read > 0) { int bytes_to_read_this_scan = scanWidth - col_offset; if (bytes_to_read_this_scan > bytes_to_read) bytes_to_read_this_scan = bytes_to_read; bytes_read = gdip_read_bmp_data ( pointer, &scan0[row_offset + col_offset], bytes_to_read_this_scan, source); if (bytes_read < bytes_to_read_this_scan) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ col_offset += bytes_read; bytes_to_read -= bytes_read; if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; } else new_row = FALSE; } if (pad_byte_present) { bytes_read = gdip_read_bmp_data(pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ } break; } } } else { /* we have a run of length 'code'. the colour of the run is the next byte in the file. */ int run_length = code; BYTE pixel_value; bytes_read = gdip_read_bmp_data(pointer, &pixel_value, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ while (run_length > 0) { int bytes_to_run_this_scan = scanWidth - col_offset; if (bytes_to_run_this_scan > run_length) bytes_to_run_this_scan = run_length; memset (scan0 + row_offset + col_offset, pixel_value, bytes_to_run_this_scan); col_offset += bytes_to_run_this_scan; run_length -= bytes_to_run_this_scan; if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; } else new_row = FALSE; } } } return Ok; } static GpStatus gdip_read_bmp_rle_4bit (void *pointer, BYTE *scan0, BOOL upsidedown, int stride, int scanWidth, int scanCount, ImageSource source) { BYTE code; int bytes_read; int col_offset = 0; int row_offset = (upsidedown ? (scanCount - 1) * stride : 0); int row_delta = (upsidedown ? -stride : +stride); int rows_remaining = scanCount; BOOL new_row = FALSE; if ((scanWidth & 1) != 0) scanWidth++; if (scanWidth > stride * 2) return InvalidParameter; while (rows_remaining > 0) { bytes_read = gdip_read_bmp_data (pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ if (code == 0) { /* RLE escape code */ bytes_read = gdip_read_bmp_data (pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ switch (code) { case 0: /* skip remainder of scan */ { if (new_row) new_row = FALSE; else { row_offset += row_delta; rows_remaining--; col_offset = 0; } break; } case 1: /* skip remainder of image -- in other words, we're finished :-) */ { return Ok; } case 2: /* jump forward (dx, dy) coordinates */ { BYTE dx, dy; bytes_read = gdip_read_bmp_data (pointer, &dx, 1, source); bytes_read += gdip_read_bmp_data (pointer, &dy, 1, source); if (bytes_read < 2) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ /* not really sure how to handle the case where the X delta goes * past the end of the scan. in the interest of not crashing, * let's wrap it back around. */ col_offset = (col_offset + dx) % scanWidth; row_offset -= dy * stride; /* BMPs go from bottom to top */ new_row = FALSE; break; } default: /* an uncompressed section, 'code' pixels wide */ { int pixels_to_read = code; int bytes_of_data = (pixels_to_read + 1) / 2; /* uncompressed sections must be an even number of bytes long, * even if they are an odd number of *pixels* long. */ BOOL pad_byte_present = ((bytes_of_data & 1) != 0); int bytes_to_read = pixels_to_read / 2; /* leave off the last pixel for now */ /* wrap rows properly, even though they are inverted in memory */ while (bytes_to_read > 0) { if ((scanWidth - col_offset) == 1) { /* special case: a pair of pixels is split across two rows. */ BYTE pixels, same_row_pixel, next_row_pixel; bytes_read = gdip_read_bmp_data (pointer, &pixels, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ same_row_pixel = (pixels >> 4) & 0x0F; next_row_pixel = pixels & 0x0F; if ((col_offset & 1) != 0) { BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2]; scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | same_row_pixel; } else scan0[row_offset + col_offset / 2] = same_row_pixel << 4; col_offset = 1; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; scan0[row_offset] = next_row_pixel << 4; new_row = FALSE; } else if ((col_offset & 1) == 0) { /* alignment is good; we can read pairs of pixels as bytes. * if there are an odd number of pixels in a scan, though, * then the last pixel will need to be special-cased. also, * if the scan width is odd, then a byte will be split * across a row ending. I don't know if this is in the spec, * but it is the most resistant to crashing. */ int bytes_to_read_this_scan = (scanWidth - col_offset) / 2; if (bytes_to_read_this_scan > bytes_to_read) bytes_to_read_this_scan = bytes_to_read; bytes_read = gdip_read_bmp_data ( pointer, &scan0[row_offset + col_offset / 2], bytes_to_read_this_scan, source); if (bytes_read < bytes_to_read_this_scan) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ col_offset += bytes_read * 2; bytes_to_read -= bytes_read; new_row = FALSE; } else { /* bad alignment; nybble-swapping will be required */ BYTE last_high_nybble = 0xF0 & scan0[row_offset + col_offset / 2]; int bytes_to_read_this_scan = (scanWidth - col_offset) / 2; if (bytes_to_read_this_scan > bytes_to_read) bytes_to_read_this_scan = bytes_to_read; while (bytes_to_read_this_scan >= 0) { BYTE pixels; bytes_read = gdip_read_bmp_data (pointer, &pixels, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ scan0[row_offset + col_offset / 2] = last_high_nybble | (pixels >> 4); last_high_nybble = (pixels << 4) & 0xF0; col_offset += 2; /* two pixels processed */ bytes_to_read_this_scan--; } new_row = FALSE; } if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; } } if ((pixels_to_read & 1) != 0) { /* half of a byte remains to be inserted into the correct nybble */ BYTE pixel; bytes_read = gdip_read_bmp_data (pointer, &pixel, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ pixel >>= 4; /* the last pixel is in the high nybble */ if ((col_offset & 1) != 0) { BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2]; scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | pixel; } else scan0[row_offset + col_offset / 2] = pixel << 4; col_offset++; if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; } else new_row = FALSE; } if (pad_byte_present) { bytes_read = gdip_read_bmp_data(pointer, &code, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ } break; } } } else { /* we have a run of length 'code'. the colour of the run is the next byte in the file. * something weird is happening here in 4-bit land, though; a byte stores two pixels. * what happens is rather odd: the run is actually of two alternating colours (which * may, of course, be the same, but are not required to be). we need to make sure that * the colours end up in the right nybbles of the output bytes. */ int run_pixels = code; int run_length = run_pixels / 2; BYTE pixel_values; BYTE inverted_pixel_values; bytes_read = gdip_read_bmp_data(pointer, &pixel_values, 1, source); if (bytes_read < 1) return GenericError; /* TODO?: Add an "unexpected end of file" error code */ inverted_pixel_values = ((pixel_values & 0x0F) << 4) | ((pixel_values & 0xF0) >> 4); if ((col_offset & 1) != 0) { BYTE temp = inverted_pixel_values; inverted_pixel_values = pixel_values; pixel_values = temp; } while (run_length > 0) { if ((scanWidth - col_offset) == 1) { /* special case: a pair of pixels is split across two rows. */ BYTE same_row_pixel = (pixel_values >> 4) & 0x0F; BYTE next_row_pixel = pixel_values & 0x0F; if ((col_offset & 1) != 0) { BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2]; scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | same_row_pixel; } else scan0[row_offset + col_offset / 2] = same_row_pixel << 4; col_offset = 1; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; scan0[row_offset] = next_row_pixel << 4; new_row = FALSE; if ((scanWidth & 1) != 0) { /* if the width of the scan is odd, then the nybbles swap * places each time they cross from one row to the next */ BYTE temp = inverted_pixel_values; inverted_pixel_values = pixel_values; pixel_values = temp; } } else { int bytes_to_run_this_scan; /* make sure we're byte-aligned; if we're not, we need to store a nybble first */ if ((col_offset & 1) != 0) { BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2]; scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | (pixel_values & 0x0F); col_offset++; } bytes_to_run_this_scan = (scanWidth - col_offset) / 2; if (bytes_to_run_this_scan > run_length) bytes_to_run_this_scan = run_length; memset (scan0 + row_offset + col_offset / 2, pixel_values, bytes_to_run_this_scan); col_offset += bytes_to_run_this_scan * 2; run_length -= bytes_to_run_this_scan; if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; if ((scanWidth & 1) != 0) { /* if the width of the scan is odd, then the nybbles swap * places each time they cross from one row to the next */ BYTE temp = inverted_pixel_values; inverted_pixel_values = pixel_values; pixel_values = temp; } } else new_row = FALSE; } } if ((run_pixels & 1) != 0) { /* half of a byte remains to be inserted into the correct nybble */ BYTE pixel = pixel_values >> 4; /* the last pixel is in the high nybble */ if ((col_offset & 1) != 0) { BYTE old_pixel = 0xF0 & scan0[row_offset + col_offset / 2]; scan0[row_offset + col_offset / 2] = (old_pixel & 0xF0) | pixel; } else scan0[row_offset + col_offset / 2] = pixel << 4; col_offset++; if (col_offset >= scanWidth) { col_offset = 0; row_offset += row_delta; rows_remaining--; if (rows_remaining <= 0) /* more data than expected -- let's not make this a fatal error */ return Ok; new_row = TRUE; } else new_row = FALSE; } } } return Ok; } GpStatus gdip_read_BITMAPINFOHEADER (void *pointer, BITMAPINFOHEADER *bmi, ImageSource source, BOOL *os2format, BOOL *upsidedown) { DWORD dw = 0; BYTE *data_read = (BYTE*)&dw; int size = sizeof (DWORD); int size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biSize = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); if (bmi->biSize > BITMAPCOREHEADER_SIZE){ /* New Windows headers can be bigger */ dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biWidth = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biHeight = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); } else if (bmi->biSize == BITMAPCOREHEADER_SIZE) { /* Old OS/2 format. Width and Height fields are WORDs instead of DWORDS */ dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biWidth = (data_read[1]<<8 | data_read[0]); bmi->biHeight = (data_read[3]<<8 | data_read[2]); *os2format = TRUE; } else { return UnknownImageFormat; } dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biPlanes = (data_read[1]<<8 | data_read[0]); bmi->biBitCount = (data_read[3]<<8 | data_read[2]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biCompression = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); if (bmi->biHeight < 0) { /* Negative height indicates that the bitmap is sideup*/ *upsidedown = FALSE; bmi->biHeight = -bmi->biHeight; } dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biSizeImage = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biXPelsPerMeter = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biYPelsPerMeter = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biClrUsed = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); dw = 0; size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) return InvalidParameter; bmi->biClrImportant = (data_read[3]<<24 | data_read[2]<<16 | data_read[1]<<8 | data_read[0]); return Ok; } /* For use with in-memory bitmaps, where the BITMAPFILEHEADER doesn't exists */ GpStatus gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source) { BITMAPINFOHEADER bmi; GpBitmap *result = NULL; BYTE *pixels = NULL; int i; PixelFormat format; int colours; BOOL os2format = FALSE; BOOL upsidedown = TRUE; int size_read; BYTE *data_read = NULL; int line; int loop; long index; GpStatus status; ARGB alpha_mask = 0; ARGB red_mask = 0; ARGB green_mask = 0; ARGB blue_mask = 0; int red_shift = 0; unsigned long long int size; status = gdip_read_BITMAPINFOHEADER (pointer, &bmi, source, &os2format, &upsidedown); if (status != Ok) goto error; colours = (bmi.biClrUsed == 0 && bmi.biBitCount <= 8) ? (1 << bmi.biBitCount) : bmi.biClrUsed; status = gdip_get_bmp_pixelformat (&bmi, &format); if (status != Ok) { /* bit count mismatch */ goto error; } /* for 16bbp images we need to be more precise */ if (format == PixelFormat16bppRGB565) { /* check if we're dealing with a BITMAPV4HEADER (or later) structure */ if (bmi.biSize >= sizeof (BITMAPV4HEADER)) { /* the new structure contains the ARGB masks */ void *p = &bmi; BITMAPV4HEADER *v4 = p; alpha_mask = v4->bV4AlphaMask; red_mask = v4->bV4RedMask; green_mask = v4->bV4GreenMask; blue_mask = v4->bV4BlueMask; } else if (bmi.biSize == sizeof (BITMAPINFOHEADER)) { // next three DWORD are the R,G,B masks, like bmiColors in BITMAPINFO int size = sizeof (RGBQUAD); size_read = gdip_read_bmp_data (pointer, (void*)&red_mask, size, source); if (size_read != size) goto error; size_read = gdip_read_bmp_data (pointer, (void*)&green_mask, size, source); if (size_read != size) goto error; size_read = gdip_read_bmp_data (pointer, (void*)&blue_mask, size, source); if (size_read != size) goto error; } if ((red_mask == 0x7C00) && (green_mask == 0x3E0) && (blue_mask == 0x1F)) { /* five red bits, five green bits and five blue bits (0x7FFF) */ red_shift = 10; } else if ((red_mask == 63488) && (green_mask == 2016) && (blue_mask == 31)) { /* five red bits, six green bits and five blue bits (0xFFFF) */ red_shift = 11; } else { /* MS produce such files (i.e. missing masks) for storing ImageList bitmaps, see bug #80797 */ red_mask = 0x7C00; green_mask = 0x3E0; blue_mask = 0x1F; red_shift = 10; } /* note: CAIRO_FORMAT_RGB16_565 is deprecated so we're promoting the bitmap to 32RGB */ /* why 32bpp when 24 would be enough ? because MS GDI+ loads them as such, but can't display them (empty) */ format = PixelFormat32bppRGB; /* 16bbp bitmap don't seems reversed like their height indicates */ upsidedown = FALSE; } result = gdip_bitmap_new_with_frame (NULL, TRUE); result->type = ImageTypeBitmap; result->image_format = BMP; result->active_bitmap->pixel_format = format; result->active_bitmap->width = bmi.biWidth; result->active_bitmap->height = bmi.biHeight; /* biWidth and biHeight are LONG (32 bits signed integer) */ size = bmi.biWidth; switch (result->active_bitmap->pixel_format) { case PixelFormat1bppIndexed: result->active_bitmap->stride = (size + 7) / 8; break; case PixelFormat4bppIndexed: result->active_bitmap->stride = (size + 1) / 2; break; case PixelFormat8bppIndexed: result->active_bitmap->stride = size; break; default: /* For other types, we assume 32 bit and translate into 32 bit from source format */ result->active_bitmap->pixel_format = PixelFormat32bppRGB; /* fall-thru */ case PixelFormat24bppRGB: /* stride is a (signed) _int_ and once multiplied by 4 it should hold a value that can be allocated by GdipAlloc * this effectively limits 'width' to 536870911 pixels */ size *= 4; if (size > G_MAXINT32) goto error; result->active_bitmap->stride = size; break; } /* Ensure 32bits alignment */ gdip_align_stride (result->active_bitmap->stride); if (colours) { int palette_entries = colours; if (result->active_bitmap->pixel_format == PixelFormat4bppIndexed) { palette_entries = 256; } result->active_bitmap->palette = GdipAlloc (sizeof(ColorPalette) + sizeof(ARGB) * palette_entries); if (result->active_bitmap->palette == NULL) { status = OutOfMemory; goto error; } result->active_bitmap->palette->Flags = 0; result->active_bitmap->palette->Count = palette_entries; /* Read optional colour table */ size = (os2format) ? 3 /* RGBTRIPLE */ : 4 /* RGBquads */; data_read = (BYTE*) GdipAlloc(size); if (data_read == NULL) { status = OutOfMemory; goto error; } for (i = 0; i < colours; i++) { size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) { status = InvalidParameter; goto error; } set_pixel_bgra (result->active_bitmap->palette->Entries, i * 4, (data_read[0] & 0xFF), /* B */ (data_read[1] & 0xFF), /* G */ (data_read[2] & 0xFF), /* R */ 0xFF); /* Alpha */ } GdipFree(data_read); data_read = NULL; } size = result->active_bitmap->stride; /* ensure total 'size' does not overflow an integer and fits inside our 2GB limit */ size *= result->active_bitmap->height; if (size > G_MAXINT32) { status = OutOfMemory; goto error; } pixels = GdipAlloc (size); if (pixels == NULL) { status = OutOfMemory; goto error; } if ((bmi.biCompression == BI_RLE4) || (bmi.biCompression == BI_RLE8)) { switch (bmi.biCompression) { case BI_RLE4: gdip_read_bmp_rle_4bit (pointer, pixels, upsidedown, result->active_bitmap->stride, result->active_bitmap->width, result->active_bitmap->height, source); break; case BI_RLE8: gdip_read_bmp_rle_8bit (pointer, pixels, upsidedown, result->active_bitmap->stride, result->active_bitmap->width, result->active_bitmap->height, source); break; } } else { /* Size contains the size of the lines on disk */ switch (bmi.biBitCount) { case 1: { size = ((result->active_bitmap->width + 31) & ~31) / 8; loop = result->active_bitmap->width / 8; /* we assume 0s for 1 bit, only setting 1s */ memset(pixels, 0, result->active_bitmap->stride * result->active_bitmap->height); break; } case 4: { size = ((bmi.biBitCount * result->active_bitmap->width + 31) & ~31) / 8; loop = ((result->active_bitmap->width + 1) &~1) / 2; break; } case 8: { size = (((bmi.biBitCount * result->active_bitmap->width) + 31) & ~31) / 8; loop = result->active_bitmap->width; break; } default: { size = (((bmi.biBitCount * result->active_bitmap->width) + 31) & ~31) / 8; loop = (bmi.biBitCount * result->active_bitmap->width) / 8; break; } } data_read = (BYTE*) GdipAlloc(size); if (data_read == NULL) { status = OutOfMemory; goto error; } for (i = 0; i < result->active_bitmap->height; i++){ if (upsidedown) { line = result->active_bitmap->height - i - 1; } else { line = i; } size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) { /* special case for missing data in the last line */ if (line == result->active_bitmap->height - 1) { /* MS produce such files for storing ImageList bitmaps, see bug #80797 */ int missing_size = size - size_read; memset (data_read + size_read, 0, missing_size); } else { status = InvalidParameter; goto error; } } switch(bmi.biBitCount) { case 1: case 4: case 8: memcpy(pixels + line * result->active_bitmap->stride, data_read, size); continue; case 16: { int src = 0; int dest = 0; SHORT *pix = (SHORT*) data_read; index = (line * result->active_bitmap->stride); while (src < loop) { BYTE r = ((*pix & red_mask) >> (red_shift - 3)); BYTE g = ((*pix & green_mask) >> (red_shift - 8)); BYTE b = (*pix & blue_mask) << 3; set_pixel_bgra (pixels, index + dest, b, g, r, 0xff); dest += 4; src += 2; pix++; } continue; } case 24: case 32: { int src = 0; int dest = 0; int skip = (bmi.biBitCount >> 3); index = (line * result->active_bitmap->stride); while (src < loop) { set_pixel_bgra(pixels, index + dest, data_read[src+0], data_read[src+1], data_read[src+2], 0xff); dest += 4; src += skip; } continue; } } } GdipFree(data_read); data_read = NULL; } result->active_bitmap->scan0 = pixels; result->active_bitmap->reserved = GBD_OWN_SCAN0; result->active_bitmap->image_flags = ImageFlagsReadOnly | ImageFlagsHasRealPixelSize | ImageFlagsColorSpaceRGB; *image = result; return Ok; error: if (data_read != NULL) { GdipFree(data_read); } if (pixels != NULL) { GdipFree(pixels); } if (result != NULL) { gdip_bitmap_dispose(result); } return InvalidParameter; } /* BMP read from files have a BITMAPFILEHEADER but this isn't the case for the GDI API * (e.g. displaying a bitmap) */ static GpStatus gdip_read_bmp_image_from_file_stream (void *pointer, GpImage **image, ImageSource source) { GpStatus status; BITMAPFILEHEADER bmfh; int size_read; int size = sizeof (bmfh); BYTE* data_read = (BYTE*) GdipAlloc (size); if (!data_read) return OutOfMemory; memset (data_read, 0, size); size_read = gdip_read_bmp_data (pointer, data_read, size, source); if (size_read < size) { status = InvalidParameter; goto error; } bmfh.bfType = ((data_read[1]<<8)|data_read[0]); if (bmfh.bfType != BFT_BITMAP) { status = UnknownImageFormat; goto error; } bmfh.bfSize = (data_read[5]<<24 | data_read[4]<<16 | data_read[3]<<8 | data_read[2]); bmfh.bfReserved1 = ((data_read[7]<<8)|data_read[6]); bmfh.bfReserved1 = ((data_read[9]<<8)|data_read[8]); bmfh.bfOffBits = (data_read[13]<<24 | data_read[12]<<16 | data_read[11]<<8 | data_read[10]); GdipFree (data_read); return gdip_read_bmp_image (pointer, image, source); error: if (data_read != NULL) GdipFree(data_read); return status; } GpStatus gdip_load_bmp_image_from_file (FILE *fp, GpImage **image) { return gdip_read_bmp_image_from_file_stream ((void*)fp, image, File); } GpStatus gdip_load_bmp_image_from_stream_delegate (dstream_t *loader, GpImage **image) { return gdip_read_bmp_image_from_file_stream ((void*)loader, image, DStream); } int gdip_read_bmp_data (void *pointer, BYTE *data, int size, ImageSource source) { switch (source) { case File: return fread (data, 1, size, (FILE*) pointer); case DStream: { /* Streams are not required to return the number of bytes requested, they could return less yet our code seems to assume it will always get what it's asking for; lets loop until we get what was requested or we get an error */ int got; int total; dstream_t *loader; loader = (dstream_t *) pointer; total = 0; do { got = dstream_read (loader, data + total, size - total, 0); if (got < 1) { /* 0 = end of stream, -1 = error */ return total; } total += got; } while (total < size); return total; } case Memory: { MemorySource *ms = (MemorySource*)pointer; int len = (ms->pos + size < ms->size) ? size : ms->size - ms->pos; if (len > 0) { memcpy (data, ms->ptr + ms->pos, len); ms->pos += len; } return size; } default: return -1; } } static void gdip_write_bmp_data (void *pointer, BYTE *data, int size, BOOL useFile) { if (useFile) fwrite (data, 1, size, (FILE*) pointer); else ((PutBytesDelegate)(pointer))(data, size); } static GpStatus gdip_save_bmp_image_to_file_stream (void *pointer, GpImage *image, BOOL useFile) { BITMAPFILEHEADER bmfh; BITMAPINFOHEADER bmi; int bitmapLen; int i; ARGB color; int colours = 0; BYTE *entries; int palette_entries; BitmapData *activebmp; BYTE *scan0; activebmp = image->active_bitmap; if (activebmp->pixel_format != PixelFormat24bppRGB) { bitmapLen = activebmp->stride * activebmp->height; } else { bitmapLen = activebmp->width * 3; bitmapLen += 3; bitmapLen &= ~3; bitmapLen *= activebmp->height; } if (activebmp->palette) { colours = activebmp->palette->Count; } #ifdef WORDS_BIGENDIAN bmfh.bfReserved1 = bmfh.bfReserved2 = GUINT16_FROM_LE (0); bmfh.bfType = GUINT16_FROM_LE (BFT_BITMAP); bmfh.bfOffBits = GUINT32_FROM_LE (14 + 40 + colours * 4); bmfh.bfSize = GUINT32_FROM_LE (bmfh.bfOffBits + bitmapLen); #else bmfh.bfReserved1 = bmfh.bfReserved2 = 0; bmfh.bfType = BFT_BITMAP; bmfh.bfOffBits = (14 + 40 + colours * 4); bmfh.bfSize = (bmfh.bfOffBits + bitmapLen); #endif gdip_write_bmp_data (pointer, (BYTE*) &bmfh, sizeof (bmfh), useFile); gdip_bitmap_fill_info_header (image, &bmi); gdip_write_bmp_data (pointer, (BYTE*) &bmi, sizeof (bmi), useFile); if (colours) { int idx; palette_entries = activebmp->palette->Count; if (activebmp->pixel_format == PixelFormat4bppIndexed) { palette_entries = 16; } entries = (BYTE*) GdipAlloc (palette_entries*4); if (entries == NULL) return OutOfMemory; idx = 0; for (i = 0; i < palette_entries; i++) { color = activebmp->palette->Entries[i]; #ifdef WORDS_BIGENDIAN entries [idx] = color & 0xff; entries [idx + 1] = (color >> 8) & 0xff; entries [idx + 2] = (color >> 16) & 0xff; entries [idx + 3] = color >> 24; idx += 4; #else *((guint32 *) entries + i) = color; #endif } gdip_write_bmp_data (pointer, entries, palette_entries * 4, useFile); GdipFree (entries); } scan0 = activebmp->scan0; if (activebmp->pixel_format == PixelFormat24bppRGB) { int width = activebmp->width; int height = activebmp->height; int mystride; int k; BYTE *current_line; /* rows need to be padded up to the next multiple of 4 */ mystride = width * 3; mystride += 3; mystride &= ~3; current_line = (BYTE*) GdipAlloc (mystride); memset (current_line, 0, mystride); /* Zero padding at the end if needed */ for (i = height - 1; i >= 0; i--) { BYTE *ptr; guint32 *iptr; iptr = (guint32 *) (scan0 + i * activebmp->stride); ptr = current_line; for (k = 0; k < width; k++) { guint32 color = *iptr++; *ptr++ = (color & 0x000000ff); *ptr++ = ((color & 0x0000ff00) >> 8); *ptr++ = ((color & 0x00ff0000) >> 16); } gdip_write_bmp_data (pointer, current_line, mystride, useFile); } GdipFree (current_line); return Ok; } /* Writes bitmap upside down. Many tools can only process bmp stored this way*/ #ifdef WORDS_BIGENDIAN if (gdip_is_an_indexed_pixelformat (activebmp->pixel_format) == FALSE) { int j; BYTE *row_pointer = GdipAlloc (activebmp->width * 4); if (row_pointer == NULL) { return OutOfMemory; } for (i = activebmp->height -1; i >= 0; i--) { for (j = 0; j < activebmp->width; j++) { row_pointer[j*4] = *((BYTE*)scan0 + (activebmp->stride * i) + (j*4) + 3); row_pointer[j*4+1] = *((BYTE*)scan0 + (activebmp->stride * i) + (j*4) + 2); row_pointer[j*4+2] = *((BYTE*)scan0 + (activebmp->stride * i) + (j*4) + 1); row_pointer[j*4+3] = *((BYTE*)scan0 + (activebmp->stride * i) + (j*4) + 0); } gdip_write_bmp_data (pointer, row_pointer, activebmp->stride, useFile); } GdipFree (row_pointer); } else #endif /* WORDS_BIGENDIAN */ for (i = activebmp->height - 1; i >= 0; i--) { gdip_write_bmp_data (pointer, scan0 + i * activebmp->stride, activebmp->stride, useFile); } return Ok; } GpStatus gdip_save_bmp_image_to_file (FILE *fp, GpImage *image) { return gdip_save_bmp_image_to_file_stream ( (void *)fp, image, TRUE); } GpStatus gdip_save_bmp_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image) { return gdip_save_bmp_image_to_file_stream ( (void *)putBytesFunc, image, FALSE); } libgdiplus-4.2/src/ChangeLog0000664000175000017500000070175212377405421013022 000000000000002010-07-20 Sebastien Pouliot * image.c: Use DPI from source image when creating a Graphics instance from it. Fix bug #556181 2010-07-14 Sebastien Pouliot * lineargradientbrush.c: Do not accept empty (width/height) rectangles to create a linear brush. Fix bug #537396 2010-07-07 Sebastien Pouliot * pngcodec.c: security fix in libpng 1.2 broke the define 2010-06-16 Sebastien Pouliot * image.c: Fix #529887 for drawing a part of image with scaling. Patch provided by Dan Parnham 2010-05-17 Tom Hindle * image.c: perform calculated transformation. Fix #606412 2010-05-04 Miguel de Icaza * Apply patch from Matthew Metnetsky which fixes Bug #590286 Passing -1 (to indicate null terminated string) for the string lengths for GdipDrawString and GdipMeasureString causes the program to seg-fault. 2010-04-12 Sebastien Pouliot * pngcodec.c: SuSE provided patch for newer libpng (1.4.x). Made to be backward compatible with 1.2.x 2010-03-26 Miguel de Icaza * Apply patch from Matthew Metnetsky which fixes 590503, GdipCloneImage not cloning the properties. 2010-01-13 Sebastien Pouliot * tiffcodec.c: Don't call TIFFClose with a NULL value. Fix #569940 2009-08-19 Jeffrey Stedfast * font.c (gdip_get_fontfamily_details_from_freetype): Fixed to use values much closer to those returned by GDI+ based on work done in Moonlight. 2009-03-20 Tom Hindle * graphics.c: Allow GdipCreateFromHDC to work on the HDC of objects previousy created with GdipCreateFromHDC. Also allow GdipCreateFromHDC to work with gtMemoryBitmap types. 2009-01-28 Sebastien Pouliot * image.c: Revert last change wrt resolution 2009-01-02 Sebastien Pouliot * image.c: Adjust image width/height wrt its resolution before drawing (this can be used to scale a picture). * bitmap.c: Add more validations to GdipBitmapSetResolution [Fix bug #434583] 2008-12-23 Sebastien Pouliot * text.c (GdipMeasureCharacterRanges): Don't handle empty (zero) width or height at this early stage. * text-cairo.c: Handle negative/zero width/height to match MS GDI+ [Fix bug #449971] 2008-11-07 Sebastien Pouliot * graphics-cairo.c (make_arc): Only compute start points if we actually need them. * graphics-path.c (append_arcs): Fix arcs computation like this was done for #410459 (draw) but in this case we need to keep the direction/increment since the points are part of a path. [Fix bug #442428] 2008-10-30 Sebastien Pouliot * region-bitmap.c (reduce): Fix skipping a color channel while reducing the bitmap to 1bpp (provided by David Binderman) [Fix bug #440127] 2008-09-03 Sebastien Pouliot * general.c: Compute intermediate start/end points correctly on an open curve. Patch by Marek Habersack 2008-09-02 Sebastien Pouliot * graphics-path.c: Add support to compress points (skip on of two identical consecutive points) under some special cases. 2008-08-11 Sebastien Pouliot * image.c: Remove buggy loop in gdip_bitmap_clone which allocates way too much memory when cloning an image with multiple frames (and only free one of them). [Fix bug #411454] 2008-08-04 Sebastien Pouliot * graphics-cairo.c: (make_arcs) Simplify logic so the increment is always positive. Fix arcs going in the wrong direction (wihtout more code). [Fix bug #410459] 2008-08-04 Sebastien Pouliot * pen.c: Pen minimal visual size is 1.0 pixel (whatever the scaling). [Fix bug #410466] 2008-08-04 Sebastien Pouliot * graphics-cairo.c: Only stroke using a 1.0 width line. Also close the path before filling. [Fix bug #413461] 2008-07-18 Sebastien Pouliot * graphics-cairo.c: Don't stroke when filling (required to match GDI+ behavior) when the graphic is being scaled (since the pen's thickness is scaled too). [Fix bug #410124] 2008-07-17 Sebastien Pouliot * graphics-private.h: Add definition for gdip_is_scaled * general.c: Remove static from gdip_is_scaled * graphics-cairo.c: Don't apply AA offset to Ellipses and Pies if the graphic is being scaled. [Fix bug #409672] 2008-07-07 Sebastien Pouliot * font.c: Clone GpFontFamily when creating a new font. [Fix https://bugs.launchpad.net/ubuntu/+source/mono/+bug/246376] 2008-06-27 Sebastien Pouliot * region.c: Handle the case were we compute a negative Height value while building the rectangle list for exclude. [Fix bug #402613] 2008-04-25 Sebastien Pouliot * region.c: Normalize rectangles (apply negative width and height to X, Y) before doing binary operations on them. [Fix second part of bug #383878] 2008-04-25 Sebastien Pouliot * region.c: Fix possible crash in Complement. [Fix part of bug #383878] 2008-04-21 Sebastien Pouliot * general-private.h: Don't clamp values for Cairo >= 1.6 since the fixed point values are now kept in the 24/8 format. * graphics-private.h: Change the CAIRO_AA_OFFSET_X from 1.0 to 0.5 for Cairo >= 1.6. * graphics-cairo.c: Revert earlier AA tweaks (r100945) as it broke rectangles and the change to CAIRO_AA_OFFSET_X does the required fixes. [Fix bug #381737] * graphics-path.c: IsVisible X offset still needs to be 1.0 (whatever version of Cairo being used). 2008-04-18 Jeffrey Stedfast * text-cairo.c (MeasureString): #include for isspace() and also do proper casting so that we don't run into problems on non-GNU systems. 2008-04-18 Sebastien Pouliot * pngcodec.c: If PNG_INCH_CONVERSIONS is not defined (old libpng) then manual compute resolution. If none is available fall back to screen resolution. Fix bug #381169 2008-04-16 Sebastien Pouliot * graphics-cairo.c: Tweak AA (since looks like Cairo 1.6 tweaked it too ;-). Probably not complete but this fix SD unit tests. 2008-04-03 Sebastien Pouliot * image.c: Copy (and later restore) the original matrix before applying any "local" change inside GdipDrawImageRect. Fix bug #376855 2008-02-14 Geoff Norton * carbon-private.c: Display automatic dpi detection for now, its causing too many problems. 2008-01-23 Geoff Norton * Makefile.am: Add carbon-private.* to the build. * general.c: Use gdip_get_display_dpi_carbon to get dpi on the mac * graphics.c: Rename GdipCreateFromQuartz_macosx to GdipCreateFromContext_macosx * carbon-private.c: A mac specific implementation to get the horizontal and vertical dpi of a display. 2007-12-22 Geoff Norton * graphics-private.h: Revert the CAIRO_AA change as it caused regressions in the testsuite and improperly layed out controls. 2007-12-04 Geoff Norton * general.c: Optimize the code path to only check the environment variable once for dpi detection on the Mac. 2007-11-16 Sebastien Pouliot * graphics-cairo.c: If we need to stroke, before filling, then we must preserve the path. Fix bug #342074. 2007-11-15 Geoff Norton * general.c: If we're running on the Carbon driver avoid the call to XOpenDisplay. This fixes a deadlock race condition on Leopard as well as prevents X11 from opening when we start MWF apps. 2007-11-07 Geoff Norton * graphics-private.h: Add CGImageRelease prototype. * graphics.c: Free the CGImageRef after copying it to our display context. Fixes a massive memory leak in the Mac backend 2007-11-01 Sebastien Pouliot * font.c: Fix font face selection (typo) and ensure the font-family doesn't cache a version without bold and/or italics. Fix #338207 * pen.c: Fix pen scaling (either X or Y) by 0. MS GDI+ produce a thin line while Cairo would return an error. Fix bug #338233 * text-pango-private.h: Add ctype.h include to remove warning about isspace. 2007-10-31 Sebastien Pouliot * graphics-path.c: Avoid computing the start point coord unless we need them later. Add URL for formula used here. 2007-10-30 Sebastien Pouliot * lineargradientbrush.c: Remove small (+1) cosmetic fix that breaks severely when a scale transform is applied to the gradient. Fix bug #325178 2007-10-30 Sebastien Pouliot * graphics.c: Remove gdip_plot_path (duplicate) function. * graphics-cairo.c|h: Change [gdip_]convert_fill_mode visibility. * graphics-path.c: Remove old code used for Is[Outline]Visible functions and use the cairo functions (with some adjustments). This fix bug #325502 (ellipse didn't work). This should also fix some cases where GpGraphics should have been used for the check. 2007-10-29 Sebastien Pouliot * lineargradientbrush.c: Nullify linear->pattern since we can return from the function without creating a new pattern (i.e. stall pointer) 2007-10-17 Geoff Norton * graphics.c: Construct the quartz surface with a image backend so all cairo operations can complete without failure. We blit the image to the real cgContext when Flush () is called. * graphics-private.h: Set CAIRO_AA_OFFSET_X to 0.5 when running on a Mac. Add cg_context to Graphics structure when built with the Quartz surface so we can blit the resultant image to the real context. Add declarations for the CoreGraphics structures we need for the blitting. Add declarations for the CoreGraphics / cairo functions we need to call for blitting. 2007-08-13 Sebastien Pouliot * text-pango.c: Ensure we can use the results of MeasureString to DrawString and get the same results. 2007-08-13 Sebastien Pouliot * text.notes: New. Notes about text rendering. * text-cairo.c: Add correct support for MeasureTrailingSpaces * text-pango.c: Optimize the case where the font is underlined and HotkeyPrefixShow is used. 2007-08-10 Sebastien Pouliot * graphics-path.c: Reuse gdip_pango_setup_layout for paths (needs testing). * text-pango.c | text-pango-private.h: Make API usable for GdipAddPathString and free (unref) the PangoLayout. 2007-08-09 Sebastien Pouliot * font.c | font-private.h: Refactor font code to work with either Cairo+FreeType or Pango+FreeType. * graphics-path.c: Adjust for Pango/Cairo rendering in AddString. The Pango part isn't yet done. * text.c: switch between Cairo or Pango rendering at compile time. * text-cairo.c | text-cairo-private.h: Define out if pengo rendering is active. * text-pango.c | text-pango-private.h: New. Pango rendering using the high-level API (PangoLayout). Not all options are supported (but then our Cairo-based rendering never supported all of them either ;-) * Makefile.am: Add text-pango.c and text-pango-private.h to the build. 2007-08-02 Sebastien Pouliot * text-cairo.c: Reverting patch for bug #78777 to fix bug #81572. Fixed the "height" part of bug #78777 (LF isn't on the line you expect it to be). The X position is off because LF aren't characters anymore (and this mess with the ranges). 2007-08-01 Sebastien Pouliot * text-cairo-private.h | text-cairo.c: Fix MeasureCharacterRanges inconsistentency (#77496), i.e. missing descent, without (hopefully) breaking everything else. 2007-08-01 Sebastien Pouliot * bitmap.c: Use [g|s]et_pixel_bgra macros inside premul function to avoid endian issues. * font.c | fontfamily.h: Added GdipCloneFontFamily (fix #80845); 2007-07-31 Sebastien Pouliot * bitmap.c: Ensure proper initialization of palette when locking a bitmap. Make more use of gdip_palette_clone function. * region.c: Add special case for to exclude path/regions from infinity. Updated patch from Yves Bastide. Fix #81833. 2007-07-31 Sebastien Pouliot * graphics-path.c: Simplify GdipClosePathFigure. * text-[cairo|metafile]-private.h: Hide internal functions. 2007-07-31 Sebastien Pouliot * graphics-path.c: Reverse PathTypes. Patch by Yves Bastide. Fix #81859. 2007-07-30 Sebastien Pouliot * graphics-path.c: Avoid allocations/freeing of memory when reversing the array of points. 2007-07-30 Sebastien Pouliot * bitmap.c: Added global functions to deal with pre-multiplication. * bitmap-private.h: New prototypes for pre-multiplication. * texturebrush.c: If required by the format pre-multiply the alpha value of the brush bitmap before it's use as a pattern. Fix #81828. Cleaned-up some unused variables but there's still too much duplication for my taste (added TODO). 2007-07-30 Sebastien Pouliot * graphics-cairo.c: Fix DrawPath offset (bug #82202) and correctly fill the path (which includes stroking in this case). 2007-07-05 Sebastien Pouliot * imageattributes.c: Re-fix alpha. 2007-07-03 Sebastien Pouliot * graphics-path.c: Add missing checks in GdipGetPath[Types|Points] functions (based on parts of #81859 patch by Yves Bastide). * region.c: Add a few shortcuts to empty paths|regions combined with an infinite regions (based on parts of #81833 patch by Yves Bastide). 2007-06-21 Sebastien Pouliot * imageattributes.c: Fix "too clever" optimization with alpha when applying a ColorMatrix. 2007-06-21 Sebastien Pouliot * customlinecap.c: Fix #81829 to allow either a fill or stroke path when creating a GpCustomLineCap. 2007-06-21 Sebastien Pouliot * codecs.h, GdiPlusFlat.h, image.h, dstream.c: Fix #81845 to allow using with C++ compilers and -Werror. Patch by Yves Bastide. 2007-06-21 Sebastien Pouliot * graphics.h: Add missing GdipGetClip prototype. Fix #81844. Patch by Yves Bastide. 2007-06-21 Sebastien Pouliot * general.c|h: Fix signature for GdiplusShutdown. Fix bug #81842. 2007-06-21 Sebastien Pouliot * bitmap.c, bmpcodec.c, icocodec.c, imageattributes.c, image.c, jpegcodec.c, pngcodec.c, tiffcodec.c, gdipenums.h: Fix PixelFormat*Rgb (and Argb) to PixelFormat*RGB (and ARGB) to match MS GDI+ definitions. Patch by Yves Bastide. Fix #81841 2007-06-05 Sebastien Pouliot * emfcodec.c, metafile-private.h, wmfcodec.c, wmfcodec.h: ++ is unsafe to use with the GUINTx_FROM_LE macro. Also avoid macro re-declarations 2007-05-30 Sebastien Pouliot * gifcodec.c: Add support for interlaced GIF. Fix bug #81773 * imageattributes.c: Add support for ColorMatrixFlags and Gray ColorMatrix (quite popular based on MoMA reports); * imageattributes-private.h: Add the gray color matrix and the color matrix flags into the GpImageAttribute structure. 2007-05-28 Sebastien Pouliot * graphics-cairo.c: Adjust the x,y position (-1,-1) when the pen's length is a multiple of 2. This makes the rectangle drawing match MS implementation. Also fix cairo_DrawRectanglesI to use anti-aliasing (like all drawing functions should do). * graphics-cairo-private.h: Add macro to check if a coordinate correction is required for the specified pen's width. 2007-05-25 Sebastien Pouliot * general-private.h: Don't optimize convertions when printing. * text-cairo.c: Ensuew we converting coordinates when printing. Fix bug #81708 2007-05-24 Sebastien Pouliot * graphics-cairo.c: Don't use antialiasing on clipping paths. Fix bug #81721. * image.c: Implement GdipDrawImagePointsRect[I] functions. 2007-05-23 Sebastien Pouliot * pngcodec.c: Add correct support for 2bpp PNG images (promoted to 32bpp ARGB) and fixed palette for 4bpp images. Fix bug #81674. 2007-05-22 Sebastien Pouliot * graphics.c: Fix GdipCreateFromHDC to return OutOfMemory if HDC is NULL. This match MS behavior as seen in (unfixed) bug #81709. 2007-05-17 Sebastien Pouliot * general-private.h: Define G_MININT16 and G_MAXINT16 when not available on a platform. 2007-05-17 Sebastien Pouliot * emfcodec.c: Don't play empty but valid (e.g. recording) metafiles. * graphics.c: Move cairo code to graphics-cairo.c and switch functions between the cairo and metafile backends. * graphics-private.h: Add the required data for the metafile backend. * graphics-cairo.c: New file. Moved cairo-based stuff from graphics.c. * graphics-cairo-private.h: New. header to cairo graphics functions. * graphics-metafile.c: New. Metafile graphics recording functions. * graphics-metafile-private.h: New. header to metafile graphics functions. * image.c: Allow creating GpGraphics contexts on a recording metafile. * metafile.c: Starting support for recording. * metafile-private.h: Add data/functions required for recording. * text.c: Move non-validation code (i.e. cairo code) into text-cairo.c * text.h: Add copyrights header. * text-cairo.c: New file. Moved cairo-based stuff from text.c. * text-cairo-private.h: New. header to cairo-based text functions. * text-metafile.c: New. Metafile-based text rendering. * text-metafile-private.h: New. header to metafile text functions. * Makefile.am: Add new files, remove old one. 2007-05-15 Sebastien Pouliot * graphics-private.h: Add macro to check for position overflows. * image.c: Check for negative width/height values and overflows in function GdipDrawImageRect (not applicable to metafiles). Check GpUnit inside function GdipDrawImageRectRect. 2007-05-12 Miguel de Icaza * image.c (GdipDrawImageRect): Passing a width or height of 0 is a no-op on Windows. Prevents Cairo from setting an INVALID_MATRIX error (the Paint.NET reported bug). 2007-05-08 Sebastien Pouliot * bitmap.c|bitmap-private.h: Add new gdip_create_greyscale_palette function to avoid duplicate work in codecs. * jpegcodec.c: Fix support for 8bpp indexed greyscale images (#81552). * pngcodec.c: Use new greyscale palette function. 2007-05-03 Sebastien Pouliot * print.c: Fix headers inclusion (and re-enable that code). 2007-04-26 Sebastien Pouliot * metafile.c|h: Add delegate-based GdipRecordMetafile... functions to replace the IStream COM based functions outside of Windows. 2007-04-26 Sebastien Pouliot * gifcodec.c: Add image.h so we can build (stubs) without libgif * jpegcodec.c: Add image.h and dtream.h so we can build (stubs) without libjpeg and move up "extern GUID GdipEncoderQuality". * tiffcodec.c: Add image.h so we can build (stubs) without libtiff 2007-04-26 Sebastien Pouliot * emfcodec.h: Include metafile-private.h * emfplus.h: Include metafile-private.h * graphics.c: Correct API wrt public API * graphics.h: Clean up public API (and include missing stuff) * gdiplus-private.h: Add typedef for GpMetafile * image.c: Include metafile-private.h * metafile.c: Add GdipRecordMetafile{Filename][I] functions. * metafile.h: Add new record functions. Remove private stuff (into new private header) and win32 definitions. * metafile-private.h: New file. Private header. * win32structs.h: Add metafile public here * wmfcodec.h: Include metafile-private.h * Makefile.am: Add new metafile-private.h to the build/dist 2007-04-25 Sebastien Pouliot * pngcodec.c: Fix compilation when old headers are used (e.g. rh9 and our debian 3.1 builds on arm and sparc). 2007-04-24 Sebastien Pouliot * font.c: Use guint16 instead of UINT16. * font-family.h: Use guint16 instead of UINT16. * win32structs.h: Remove UINT16 definition. It's also present in some libjpeg headers and some compilers don't like it's redeclaration. 2007-04-24 Sebastien Pouliot * adjustablearrowcap.c: Header/types adjustments. * adjustablearrowcap.h: New file. Public header. * adjustablearrowcap-private.h: New file. Private header. * alpha-premul-table.inc: Types adjustment. * bmpcodec.c|h: Header/types adjustments. * bitmap.c: Header/types adjustments. * bitmap.h: New file. Public header. * bitmap-private.h: New file. Private header. * brush.c: Header adjustments. * brush.h: Move private stuff out. * brush-private.h: New file. Private header. * codecs.h: New file. Contains public codec declarations. * codecs-private.h: New file. Private header. * customlinecap.c: Header adjustments. * customlinecap.h: Move private stuff out, move public stuff in. * customlinecap-private.h: New file. Private header. * dstream.c|h: Header adjustments. * emfcodec.c|h: Header/types adjustments. * emfplus.h: Header adjustments. * font.c: Header/types adjustments. * font.h: New file. Public header. * fontcollection.h: New file. Public header. * fontcollection-private.h: New file. Private header. * fontfamily.h: New file. Public header. * fontfamily-private.h: New file. Private header. * gdip.h: Deprecated. Public and private stuff has been moved into different header files to avoid more errors in the future and make it easier to use libgdiplus as a library. * gdipenums.h: New file. Contains (only) public enums. * gdipstructs.h: New file. Contains (only) public types. * gdiplus-private.h: New file. Main private include file. * GdiPlusFlat.h: New file. This is *the* header file to include from C/C++ projects (i.e. the only one that match MS filenames). Makes it easier not to use internal/private (i.e. changing) libgdiplus stuff. * general.c: Move public types to public header. Use FcFini if available. Remove DEBUG_MEMLEAKS code (valgrind is much better). * general.h: Updated to contain only public stuff. * gifcodec.c|h: Header/types adjustments. * graphics.c: Header/types adjustments. [Draw|Measure]String functions have moved into text.c source file. * graphics.h: Move private stuff out and move public stuff in. * graphics-path.c: Header/types adjustments. * graphics-path.h: Move GpPathIterator functions into their own header file. Moved internal functions into private header file. * graphics-path-private.h: New file. Private header. * graphics-pathiterator.c: Header/types adjustments. * graphics-pathiterator.h: New file. Public header. * graphics-pathiterator-private.h: New file. Private header. * graphics-private.h: New file. Private header. * hatchbrush.c: Header/types adjustments. * hatchbrush.h: Move private definitions into a separate header file. * hatchbrush-private.h: New file. Private header. * icocodec.c|h: Header/types adjustments. * image.c: Header/types adjustments. Move codec GUID into codec source files. * image.h: New file to replace gdipImage.h but contains only public and semi-public stuff. * image-private.h: New file. Private header. * imageattributes.c: Header/types adjustments. * imageattributes.h: New file. Public header. * imageattributes-private.h: New file. Private header. * jpegcodec.c|h: Header/types adjustments. * lineargradientbrush.c: Header adjustments. * lineargradientbrush.h: Moved private stuff into it's own header file * lineargradientbrush-private.h: New file. Private header. * matrix.c: Header adjustments and inline matrix_equals. * matrix.h: Move private stuff out, move public stuff in. * matrix-private.h: New file. Private header. * metafile.c|h: Header/types adjustments. * pen.c: Header/types adjustments. * pen.h: New file. Public header. * pen-private.h: New file. Private header. * pathgradientbrush.c: Header adjustments. * pathgradientbrush.h: Move private stuff out. * pathgradientbrush-private.h: New file. Private header. * pngcodec.c|h: Header/types adjustments. * region.c: Header adjustments. * region.h: Move private stuff out. * region-bitmap.c|h: Header/types adjustments. * region-path-tree.c|h: Header/types adjustments. * region-private.h: New file. Private header. * solidbrush.c: Header/types adjustments. * solidbrush.h: Move private stuff out. * solidbrush-private.h: New file. Private header. * stringformat.c: Header/types adjustments. * stringformat.h: New file. Public header. * text.c: New file. [Draw|Mesure]String is moved here. This will help having an alternate implementation of them. * text.h: New file. Public header. * text-private.h: New file. Private header. * texturebrush.c: Header/types adjustments. * texturebrush.h: Header/types adjustments. * texturebrush-private.h: Move private stuff out. * tiffcodec.c|h: Header/types adjustments. * win32structs.h: New file that contains win32 definitions required by libgdiplus. * wmfcodec.c|h: Header/types adjustments. * Makefile.am: Add new files to the build. 2007-04-23 Sebastien Pouliot * bitmap.c: Use a macro to calculate aligned stride. * bmpcodec.c: Use a macro to calculate aligned stride. * gdip.h: Remove dependency on pixman.h as the alignment is always done on 4 bytes (32 bits) for all architectures. * general.h: Add macro to calculate aligned stride. * gifcodec.c: Use a macro to calculate aligned stride. * icocodec.c: Use a macro to calculate aligned stride. * pngcodec.c: Use a macro to calculate aligned stride. 2007-04-16 Sebastien Pouliot * bitmap.c: Complete (hopefully) endian fixes. 2007-04-16 Sebastien Pouliot * bitmap.c: Report correct error for GdipBitmap[Get|Set]Pixel on a 16bpp grayscale bitmap. 2007-04-13 Sebastien Pouliot * bitmap.c: Fix more endian issues in GdipLockBits and GdipUnlockBits and remove a few unrequired masks. 2007-04-13 Sebastien Pouliot * bitmap.c: Fix endian issues in GdipLockBits and GdipUnlockBits. * gdip.h: Add macros for setting BRG values in a buffer. 2007-04-12 Sebastien Pouliot * bitmap.c: Ensure we don't get out of bounds by one byte when using the 24bbp/3bytes mode. Fix a possible leak in GdipBitmapLockBits (e.g. if the pixel format convertion doesn't work). The 2.0 API allows a test case to be built to validate this. 2007-04-12 Sebastien Pouliot * bitmap.c: Complete the fix for #79246, the previous code was mishandling the fact that Cairo use 4 bytes for 24bpp while GDI+ is using only 3 bytes (so converting between format isn't only get and set operations). * gdip.h: Remove unused structures x11drv_escape_codes and GpLinePointF. Add define for GBD_TRUE24BPP used to tag a GpBitmapData that use 3 bytes for 24bpp (GDI+) versus 4 bytes (Cairo). 2007-04-11 Sebastien Pouliot * bitmap.c: Fix 24/32 mixup between GDI+ requirements and Cairo inner working. Fix bug #80681 and parts of bug #79246. 2007-04-09 Sebastien Pouliot * bmpcodec.c: Fix 32bpp RGB support not to use the (unused) alpha byte in the file since it can contains junk. 2007-04-05 Sebastien Pouliot * font.c: Remove internal (and unused) GdipGetHfont (not in GDI+). Fix GdipCreateFont signature (GpFontStyle isn't defined in GDI+). Fix (precise) GdipGetLogFont[A|W] signatures. * gdip.h: Remove unused GpCachedFont (doesn't exists in GDI+). Fix signature for GdipCreateFont. * tiffcodec.c: Change two functions to static to remove their symbols. 2007-04-05 Sebastien Pouliot * metafile.c: Stretch correctly to the metafile size. 2007-04-04 Sebastien Pouliot * bmpcodec.c: Remove extra symbols introduced in last change. 2007-04-04 Sebastien Pouliot * bmpcodec.c|h: Refactor reading to use ImageSource so metafiles can reuse the codec to load bitmaps. * emfcodec.c: Update reading to ImageSource. * icocodec.c: Update reading to ImageSource. * metafile.c|h: Implement StretchDIBits for #81178. Update reading to ImageSource. * wmfcodec.c: Update reading to ImageSource. 2007-04-04 Sebastien Pouliot * image.c: Hack around codec signature detection to add support for non-placeable WMF metafiles (which MS GDI+ supports even if no codec signature match them). Also add a second hack to report a different image format than the one used to decode the image (non-placeable WMF are reported as EMF). 2007-04-03 Sebastien Pouliot * The great static-fication and hidden-ization of private symbols inside libgdiplus. This brings us much closer to the real GDI+ API. 2007-04-03 Sebastien Pouliot * cairo-embed.h: Rename *all* cairo_* symbols into mono_cairo_*. Should fix bug #81279. 2007-04-02 Sebastien Pouliot * font.c: Avoid locking multiple time for the same font family (e.g. when asking for GetHeight). Make sure we're setting cellascent and celldescent even if the horizontal table isn't available. This also simplify the code and has better error handling. Added better error handling in GdipGetFontHeight and GdipGetFontHeightGivenDPI functions. 2007-04-02 Sebastien Pouliot * font.c: Change some functions to static and remove unused function. * graphics.c: Remove unused externs. 2007-03-30 Sebastien Pouliot * jpegcodec.c: Ensure we throw the "right" exception on the managed side when an invalid file is read. Fix #80980 2007-03-30 Sebastien Pouliot * brush.c: Change contract between GdipDeleteBrush and the destroy function of the specialized brushes. The NULL check and the GdipFree of the brush is now done centrally. * hatchbrush.c: Simplify with new contract. * lineargradientbrush.c: Simplify with new contract. * pathgradientbrush.c: Simplify with new contract. * solidbrush.c: Simplify with new contract. * texturebrush.c: Simplify with new contract. 2007-03-30 Sebastien Pouliot * pen.c: Update solid brush color (if used) when the pen color is changed. Fix #81266. Change GdipGetPenBrushFill to return a clone of the brush and not the original one. * tiffcodec.c: Fix TIFFSetField as it requires at least two parameters (count & type) when used for TIFFTAG_EXTRASAMPLES. Fix valgrind warning. 2007-03-29 Sebastien Pouliot * bmpcodec.h: Use __attribute__ ((packed)) instead of #pragma pack(2) to make this work on the ARM architecture. * metafile.h: Use __attribute__ ((packed)) instead of #pragma pack(2) in the hope this construct works on the ARM architecture. * tiffcodec.c: Fix TIFF crashes on SPARC (it's amazing what an integer can do to get promoted). 2007-03-23 Sebastien Pouliot * jpegcodec.c: Re-enable sigsetjmp to handle malformed JPEG files. Also don't try to load EXIF data if loading failed. Fix bug #80980. * metafile.c: More endian fixes (EMF headers) 2007-03-22 Sebastien Pouliot * emfcodec.h: Some endian fixes. * metafile.c: Some endian fixes. * wmfcodec.c: Some endian fixes. 2007-03-21 Sebastien Pouliot * emfcodec.c: Process ModifyWorldTransform and modify GdiComment to be reusable to detect between "classic" EMF and EMF+/dual. * Makefile.am: Add emfplus.g|h to the build/dist. * metafile.c|h: Fixed display bounds. Added detection of EMF+ (and dual) metafiles. Added ModifyWorldTransform function and a few other TODO. * wmfcodec.c: Process SaveDC, RestoreDC, SetStretchBltMode and StretchDIBits records. 2007-03-21 Sebastien Pouliot * emfplus.c|h: Starting point of the EMF+ (and dual) handling. 2007-03-21 Sebastien Pouliot * pen.c: Ensure we never clear the 'changed' flag when setting pen's properties. Issue #81102 found (and patch) by Choe Hwanjin. 2007-03-20 Chris Toshok * graphics.c (GdipDeleteGraphics): if this is an X drawable, ignore any errors we get destroying the surface. Works around a bug in the RENDER X server support, where the cairo pictures are freed when the drawable/window is destroyed (and so cairo's calls to XRenderFreePicture fail with errors). 2007-03-20 Sebastien Pouliot * emfcodec.h: Add some definitions. * gdip.h: Remove gdip_graphics_init prototype. * general.c: Remove unused stuff. * graphics.c: Make gdip_graphics_init static. * wmfcodec.h: Add some definitions. 2007-03-19 Sebastien Pouliot * bitmap.c: Exclude unused code and made some function static. * gdip.h: Remove un-shared function. * font.c: Fix free in free_cached_pattern to release the 'key' memory (no leak) and not the 'value' memory (double-free). Found/patch by Choe Hwanjin. 2007-03-15 Sebastien Pouliot * gdip.h: Add some missing prototypes to avoid compiler warnings. 2007-03-14 Sebastien Pouliot * image.c: Return InvalidParameter when loading an unknown file format from a stream. System.Drawing will throw the "correct" exception from this error code. * metafile.c: Fix DPI (purfect ;-) and improve bounds calculations. 2007-03-13 Sebastien Pouliot * image.c: Fix codec signature compare when more than one signature- mask exists (e.g. GIF87 files). Fix codec signature length to match the (very large) EMF requirement (44 bytes). * gdipImage.h: Add define for MAX_CODEC_SIG_LENGTH 2007-03-13 Sebastien Pouliot * bitmap.c: Added comment about the special allocation of ColorPalette where Count == 0 (CID273). * image.c: Added comment about the special allocation of ColorPalette where Count == 0 (CID272). * metafile.c: Delete possibly allocated pen if invalid (CID279). Free metafile context if the metafile type is invalid (CID280). * region.c: In gdip_is_rect_infinite make sure rect can never be dereferenced (CID276). 2007-03-08 Sebastien Pouliot * emfcodec.c|h: Initial (i.e. subset of) EMF parser/player. * metafile.c|h: Shared metafile code, like setup, play & cleanup functions and a lot of "record" functions (which looks like the old GDI32 API). * wmfcodec.c|h: Initial (i.e. subset of) WMF parser/player. 2007-03-08 Sebastien Pouliot * gdip.h: Add some missing prototypes to avoid compiler warnings. * image.c: Change drawing metafiles not to require a surface (it will be played on the existing one). 2007-02-27 Sebastien Pouliot * gdip.h: Add some missing prototypes to avoid compiler warnings. * texturebrush.cs: Reworked GdipCreateTexture to use the data from the cloned image (and not the original). Simplified GdipCreateTexture2I to reuse bitmap functions and call GdipCreateTexture. Fix bug #80971. 2007-02-26 Sebastien Pouliot * region.c: Change GdipGetRegionHRgn to return a pointer to a *clone* of the region as this better match MS implementation (multiple calls return different HRGN). It also means that each of them must be freed individually (or this will leak memory). 2007-02-22 Sebastien Pouliot * image.c: Fix DrawImage* functions when using indexed bitmaps. 2007-02-21 Sebastien Pouliot * emfcodec.c|h: Minor update to compile image.c changes. * image.c: Updated all functions to allow them to work on metafiles (i.e. don't touch the bitmap data). * Makefile.am: Add new files to the build. * metafile.c|h: New. Skeleton to make image.c changes compile. * print.c: Moved non-GDI+ (but public) print functions here (from image.c). * wmfcodec.c|h: Minor update to compile image.c changes. 2007-02-16 Sebastien Pouliot * bitmap.c: Refactor to match upcoming metafile definitions. * gdip.h: Update gdip_bitmap_dispose definition to return GpStatus. * gdipImage.h: Remove get_image_format definition, it's now static. * image.c: Rewrite get_image_format to use the codec info (and remove "uneasy" FIXME). Remove unused gdip_image_clone function. Refactor Dispose and Clone functions for upcoming metafile support. Fix GUID to ImageFormat for icons. * tiffcodec.c: Add missing signatures and mask to TIFF ImageCodecInfo. 2007-02-15 Sebastien Pouliot * graphics.c, graphics-path.c, region-bitmap.c, tiffcodec.c: Patch from Dmitriy Lukinov to fix compilation when using gcc 2.95 (and other old C compilers). #80844 2007-02-14 Sebastien Pouliot * bitmap.c: Fix default palettes values (8bpp), flags and encoding (RGB versus BGRA). * gdip.h: Add color palette flags required to fix palettes. 2007-02-13 Sebastien Pouliot * bmpcodec.c: MS generates what looks like invalid (or undocumented) 16bpp bitmaps for storing ImageList bitmaps. The header is bad (missing BI_BITFIELDS), there is no ARGB masks and the last line of the bitmap is incomplete. Fix bug #80797. 2007-02-08 Sebastien Pouliot * matrix.h: Add macros gdip_matrix_get_[x|y]_scale * region.c: Fix matrix operations on infinite region (the result is always an infinite region). Optimize the transform when the matrix is only a scale (or a scale+translate) to avoid converting a rectangular based region into a bitmap based region (fix #80758). 2007-02-07 Sebastien Pouliot * bmpcodec.c: Fix #80751 for that aren't reversed (bug introduced when refactoring for icon support). 2007-02-05 Sebastien Pouliot * cairo-embed.h: Redefine used cairo symbols to avoid coexistance problems with Gtk+ 2.8 (and later). Fix bug # * gdip.h: Rework includes, remove unused cairo_matrix typedef. * general.c: Remove cairo.h from includes. * Makefile.am: Add cairo-embed.h to the build. 2007-02-01 Sebastien Pouliot * general.c|h: Add iround (from graphics-path.c); * graphics.c: Apply world transformations to bounds and fix function GdipGetVisibleClipBounds to use the clipping region. Fix bug #78958; * graphics-path.c: Remove iround (moved to general.c); * region-bitmap.c: Fix typo; 2007-02-01 Sebastien Pouliot * pngcodec.c: Fix codec to return UnknownImageFormat and display a warning when loading an image with more than 32bpp. #80693. 2007-01-31 Sebastien Pouliot * graphics.c: Fix bug #80680 to make MeasureString handle trailing spaces like MS GDI+ 2007-01-19 Sebastien Pouliot * bitmap.c: Fix GdipLoadImageFromFile to return OutOfMemory (like MS GDI+) when the file isn't found. * image.c: Change GdipCreateBitmapFromFile[ICM] to still return (see previous fix) InvalidParameter if the file isn't found (again to match MS GDI+). Not sure why FileNotFound was defined as an error code :-| 2007-01-19 Sebastien Pouliot * graphics.c: Remove extern declaration for gdip_get_cairo_filter * image.c: Fix #77181 by using the pattern (not the surface) to get the interpolation modes to work. Of course the modes are limited by what's available in cairo/pixman (i.e. two modes). * general.h: Add prototype for gdip_get_cairo_filter. 2007-01-18 Sebastien Pouliot * bitmap.c: Handle the case where we're asked to create 15/16 bpp bitmaps. In this case the returned bitmap is a 32bpp RGB (no alpha) which, somewhat, match MS GDI+ when it loads such images. * bmpcodec.c: Switch 15/16 bpp to 32bpp RGB (instead of 24) for the same reasons. 2007-01-18 Sebastien Pouliot * icocodec.c: Add support for 24bpp icons with the alpha 1-bit. * image.c: GdipGetImageGraphicsContext only works for 24bpp and more. 2007-01-17 Sebastien Pouliot * bmpcodec.c: Add support for loading 16bpp bitmaps (555 or 565). Cairo deprecated CAIRO_FORMAT_RGB16_565 so we promote the bitmaps into 24bpp RGB bitmaps. * bmpcodec.h: Add new structures for V4 bitmap headers. 2007-01-17 Sebastien Pouliot * bmpcodec.c: Avoid potential double-free if the image is invalid. 2007-01-15 Sebastien Pouliot * bitmap.c: Clone the bitmap on GdipCreateBitmapFromHBITMAP too. This ensure multiple GpBitmap objects can be created from a single HBITMAP. * icocodec.c: Add support for 32bpp icons (aka XP icons). 2007-01-12 Sebastien Pouliot * icocodec.c: Fix another endian issue and free the bitmap (not just the palette) in case of an error. 2007-01-12 Sebastien Pouliot * bitmap.c: Fix HBITMAP support in GdipCreateBitmapFromHBITMAP and GdipCreateHBITMAPFromBitmap functions so an HBITMAP can survive the deletion of the GpBitmap structure. Implement GdipCreateBitmapFromHICON and GdipCreateHICONFromBitmap functions. See comments about freeing the memory associated with HBITMAP and HICON. * gdip.h: Add new undocumented ImageFlag to match MS results. * icocodec.c: Fix endianess when reading the ICONDIRENTRY. 2007-01-11 Sebastien Pouliot * bitmap.c: Fix GdipCreateBitmapFromScan0 to initialize the flags to 2 (HasAlpha) if the format supports alpha; * image.c: Copy all palette (including flags and count) in function GdipSetImagePalette. Re-adjust the size if the palette size is different. Fix palette handling not to return errors for an unexisting palette (but return a default empty one). 2007-01-10 Sebastien Pouliot * bmpcodec.c|h: Refactor some decoding code to share with the ICON decoder. * icocodec.c|h: Implement icon decoder, reusing some parts of the BMP codec. * image.c: Add ICON format support to GdipLoadImageFromDelegate_linux. 2007-01-08 Sebastien Pouliot * bmpcodec.c: Add missing SigPattern and SigMask to codec; * emfcodec.c|h: New. Plumbing to add the new EMF codec; * gdip.h: Add SHORT type. Add new GUID for ICO, WMF and EMF codecs; * gdipImage.h: Add include files for new codecs; * general.c: Update call to codecs initialization; * gifcodec.c: Add missing SigPattern and SigMask to codec; * icocodec.c|h: New. Plumbing to add the new ICO codec; * image.c: CHange codecs structure to allow a different number of encoders and decoders. * jpegcodec.c: Add missing SigPattern and SigMask to codec; * pngcodec.c: Add missing SigPattern and SigMask to codec; * wmfcodec.c|h: New. Plumbing to add the new WMF codec; * Makefile.am: Add new files for codecs; 2007-01-03 Sebastien Pouliot * alpha-premul-table.inc: New. Table that contains all values of 256x256 divised by 255. This allows to avoid a division and three multiplications for each pixel that requires alpha to be pre-multiplied into the RGB values. * general.c|h: Include/make available the premultiplied table. * imageattributes.c: Use the table when applying a ColorMatrix; * pngcodec.c: Use the table when loading PNG images with alpha. Also ensure we're setting the alpha flag correctly for non-palette bitmaps. Fix bug #79297 and #80366. 2007-01-02 Chris Toshok * general.c (gdip_get_display_dpi): we don't want to get what the rest of X assumes is the dpi. we want the actual dpi of the screen, so that we can correctly map to the actual size of fonts when the user asks for a particular size. This removes the need for the hack of setting the SWF DefaultFont to be 8pt instead of 8.25pt to get things to line up. 2006-12-21 Sebastien Pouliot * imageattributes.c: Fix bug #80323 for ColorMatrix containing alpha values (Cairo uses pre-multiplied alpha which we weren't providing). Improved performance by about 30% (in the supplied sample). 2006-12-16 Miguel de Icaza * jpegcodec.c: Do not load exif information if there was an error loading the file. 2006-11-10 Sebastien Pouliot * general.c: Fix utf8_to_ucs2 to process all the first 65536 chars (not just the first 4096). Patch by choe.hwanjin@gmail.com * graphics.c: When measuring a string and if data is provided, initialize data->has_hotkeys to FALSE. 2006-10-20 Sebastien Pouliot * general.c: Don't delete the font cache hash table unless it was created (which removes the glib runtime errors). This can occurs when doing a C application using libgdiplus. 2006-10-18 Sebastien Pouliot * graphics.c: In MeasureString check for bounding box height when calculating the number of characters to be drawn. 2006-10-17 Sebastien Pouliot * graphics.c: Another fix to StringAlignmentCenter when a single character is drawn (#79685). This adjust the band-aid done for #79573 awaiting a bigger rewrite (to move alignement from drawing to measure) 2006-10-16 Sebastien Pouliot * graphics.h: Define G_MAXINT32 ourselves (if undefined). 2006-10-12 Sebastien Pouliot * gdip.h: Remove stuff related to string measurements. * graphics.h: New. Add stuff specific to string measurements. * graphics.c: Refactor the string measurement code. There are now one (not two) methods to measure a string and one (splitted from measure) to draw the string. Doesn't fix any bug in itself but it already makes it much clearer what some problems are (e.g. alignment). * Makefile.am: Add new graphics.h file to the build. 2006-10-12 Sebastien Pouliot * graphics.c: Remove parts of r60164 added for LinkLabel. It can't work because we're loosing the start lines in the ranges. Actually we are still duplicating some measurement code and we'll need to merge both routine if we want accuracy. 2006-10-11 Sebastien Pouliot * general.h: Add SAFE_FLOAT_TO_INT32 macro. * graphics.c: Fix the cases where we convert an int to float (inside System.Drawing) then reconvert this value to an integer inside libgdiplus. Values like Int32.MaxValue would return as negative due to overflow. Fix bug #79643. 2006-10-06 Sebastien Pouliot * font.c: Always zeroize LOGFONT facename even when we error out. This removes a lot of warnings from valgrind when running unit tests. * graphics.c: '.' can also be used as a wrap point. Fix bug #79594. 2006-10-05 Sebastien Pouliot * graphics.c: Fix StringAlignmentCenter in GdipDrawString. Half fix (#79573) and half band-aid against possible random memory access. 2006-10-02 Sebastien Pouliot * graphics-path.c: Use correct function to free memory (spotted by Gonzalo). * image.c: Fix compiler warning (signess); * texturebrush.c: Fix compiler warning (undefined symbol); 2006-09-29 Sebastien Pouliot * graphics-path.c: Fixed GdipReverse loop, don't reverse path types and free the original point list being replaced. 2006-09-28 Jackson Harper * jpegcodec.c: Fix signature for the #if no libjpeg block. 2006-09-28 Sebastien Pouliot * graphics.c: Re-fix the wrapping case (r58401) if bug #77699 (causing an endless loop in DrawString) to avoid memory corruption. 2006-09-22 Sebastien Pouliot * graphics.c: (GdipMeasureCharacterRanges) Ensure we're always freeing strDetails when we return. Don't return Ok unless the status is Ok. Optimize conversions (done only if required). Handle HotKeyPrefix 2006-09-21 Sebastien Pouliot * stringformat.c: Don't clone by pointer assignement (sigh). Reuse GdipCreateStringFormat to implement GdipStringFormatGetGenericDefault and GdipStringFormatGetGenericTypographic. Fix negative count in GdipSetStringFormatTabStops to reset values properly. 2006-09-21 Sebastien Pouliot * stringformat.c: In GdipSetStringFormatMeasurableCharacterRanges we now check for negative rangeCount (InvalidParameter) and rangeCount over 32 (ValueOverflow). * texturebrush.c: Only apply the inverted texture matrix if one is set (i.e. don't multiply by the graphic matrix). This should fix parts of #79300 (looks right like the old patch) and the texture sample still works correctly. 2006-09-20 Sebastien Pouliot * texturebrush.c: Revert last patch as it breaks the texture sample and didn't fix the original issue #79300. 2006-09-19 Sebastien Pouliot * graphics.c: Fix parameters checking order and remove duplicates checks in GdipMeasureCharacterRanges. * stringformat.c: Set defaults to match MS GDI+. 2006-09-18 Sebastien Pouliot * graphics.c: Avoid unit conversions, when possible, when measuring or drawing strings. Fix both charactersFitted (not total string length, see bug #76664) and linesFitted (floor) in MeasureOrDrawString 2006-09-16 Sebastien Pouliot * pngcodec.c: Fix 24bbp saving for big endian architectures. 2006-09-15 Sebastien Pouliot * bmpcodec.c: Remove non working code for big endian architectures. * graphics.c: Fix bug #79173 (multi-line labels/DrawText) by reverting part of r62329 for bug #78777 (MeasureCharacterRanges bug). 2006-09-15 Sebastien Pouliot * pngcodec.c: Format32bppRgb is a 4bpp format. * tiffcodec.c: Format32bppRgb is a 4bpp format. 2006-09-14 Sebastien Pouliot * bitmap.c: Fix error reporting in GdipBitmapUnlockBits. 2006-09-13 Sebastien Pouliot * general.h: Add/Move macros gdip_near_zero and gdip_near_one (from matrix.h) to avoid comparison between floating points value. * graphics.c: (make_arcs) Make sure the additional angle isn't near zero as this will results in NaN values and break rendering (#78999) * graphics-path.c: (append_arcs) Make sure the additional angle isn't near zero as this will results in NaN values and break rendering * matrix.h: Remove macros and include general.h 2006-09-12 Sebastien Pouliot * general.c: Don't apply the anti-aliasing offsets if we asked Cairo to scale it's rendering (not the best solution but better than the current one where 0 scaled 100 times equals 50). 2006-09-08 Jonathan Gilbert * bmpcodec.c: Fix the pixel format used when loading 32-bit BMP files -- they were being loaded as Format32bppArgb, but MS's GDIPLUS.DLL returns Format32bppRgb Bitmap objects. The alpha data is still loaded, and work-arounds involving copying the raw data over to another Bitmap object with the Format32bppArgb pixel format should work here too. 2006-09-07 Chris Toshok * texturebrush.c (gdip_texture_setup): remove the matrix manipulation here. fixes 79300. 2006-08-31 Sebastien Pouliot * jpegcodec.c: Avoid memory overwrite in the processing loop - this messed up the first two lines (processed backward) of most JPEG files. * texturebrush.c: Test application shows the rotation to be identical between Cairo and GDI+. 2006-08-30 Sebastien Pouliot * texturebrush.c: Fix image copying when only a part of the original image is required for the brush (no cloning here). 2006-08-29 Sebastien Pouliot * bitmap.c: Reintroduce WORDS_BIGENDIAN for performance reasons. * general.c: Remove duplicate macros. * graphics.c: Fix stupid typo in make_curve :( 2006-08-28 Sebastien Pouliot * bitmap.c: Remove WORDS_BIGENDIAN block and use endian-correct macro. * texturebrush.c: Fix three cases (CID #249-251) where we didn't free memory correctly when a error (like an out of memory) occured. 2006-08-27 Sebastien Pouliot * bitmap.c: Fix endianess issues in locked bitmap. 2006-08-25 Sebastien Pouliot * gdip.h: Macro get_pixel_bgra is endian safe. 2006-08-25 Sebastien Pouliot * gdi.h: Add missing GDIPCONST to both GpColorMatrix parameters for function GdipSetImageAttributesColorMatrix; * imageattributes.c: Fix parameter validation on function GdipSetImageAttributesColorMatrix, as colorMatrix can only be NULL if enableFlag is FALSE. Added TODO for unimplemented features. 2006-08-24 Sebastien Pouliot * region-path-tree.c: Fix some endian bug when deserializing a tree. * texturebrush.c: Adjust source for matrix and rectangle changes. Ensure we're always cloning (correctly) the image (i.e. no pointer assignment). Review parameter checks. Fix GdipGetTextureImage to return a clone of the image. Fix some leaks detected with valgrind. * texturebrush.h: Changed GpTexture not to require extra memory allocations for the matrix and the rectangle (it simplifies the code and help avoid leaks). 2006-08-24 Gonzalo Paniagua Javier * dstream.c: (read_from_buffer) return the number of bytes actually copied from the stream buffer. 2006-08-23 Sebastien Pouliot * general.c: Don't manipulate individual bytes when converting ucs4 to ucs2. * graphics.c: In GdipFillRegion ensure the GpGraphics and GpImage are correctly freed even if their allocation function didn't return Ok. * region.c: Fix endian bug when reading region data type; 2006-08-22 Sebastien Pouliot * bitmap.c: Added annotations for allocation functions. * brush.c: Added annotations for allocation functions. * imageattributes.c: Added annotations for allocation functions. Added some out of memory checks. * image.c: Added annotations for allocation functions. Fixed some parameters checks. * pathgradientbrush.c: Added annotations for allocation functions. * stringformat.c: Added annotations for allocation functions. * texturebrush.c: Added annotations for allocation functions. 2006-08-22 Sebastien Pouliot * graphics-path.c: Ensure (3) that we delete a GraphicsPath even if it's cloning failed (e.g. memory could have been allocated). * pathgradientbrush.c: Ensure that we delete a GraphicsPath even if it's creation failed (e.g. memory could have been allocated). * region.c: Ensure that we delete a GraphicsPath even if it's creation failed (e.g. memory could have been allocated). 2006-08-21 Sebastien Pouliot * graphics-path.h: Export gdip_path_has_curve to avoid code duplication. * graphics-path.c: Remove all g_return_val_if_fail. Added annotations for allocation function. * graphics-pathiterator.c: Simplify GdipPathIterHasCurve by reusing code from graphics.c. 2006-08-19 Sebastien Pouliot * graphics-pathiterator.c: Fix all function to deal with a NULL path supplied when creating an iterator. Remove all g_return_val_if_fail. Added annotations for allocation function. 2006-08-18 Sebastien Pouliot * matrix.c: Fix a division by zero case when a rectangle is supplied. 2006-08-17 Sebastien Pouliot * matrix.c: Remove use of g_return_val_if_fail. Added annotations for allocation functions. 2006-08-16 Sebastien Pouliot * graphics-path.c: In GdipAddPathString ensure we are freeing the font even if the creation call status code isn't Ok. * jpegcodec.c: Remove use of g_return_val_if_fail. Add annotations about dead code which isn't totally dead (setjmp/goto). * pngcodec.c: Add annotation about dead code which isn't totally dead (setjmp/goto). * tiffcodec.c: Add annotation about dead code. 2006-08-16 Peter Dennis Bartok * tiffcodec.c: Fixed c+p error. Thanks to coverity for catching that 2006-08-16 Sebastien Pouliot * graphics.c: Try an annotation inside a function. * image.c: Remove use of g_return_val_if_fail. 2006-08-15 Sebastien Pouliot * adjustablearrowcap.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. * font.c: In create_fontfamily_from_name changed default status code to FamilyNotFound (instead of OutOfMemory). Added more checks for OutOfMemory conditions (e.g. after calls to ucs2_to_utf8). Added annotation for allocation functions. * hatchbrush.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. * lineargradientbrush.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. 2006-08-14 Sebastien Pouliot * customlinecap.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. Fix cloning. * gdip.h|image.c: Fix some public API signatures (int -> UINT); * graphics.c: Replace two forgotten g_return_val_if_fail. * pen.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. Fixed allocations to make sure an allocated pen is returned only if status == Ok. * solidbrush.c: Remove use of g_return_val_if_fail. Added annotation for allocation functions. 2006-08-13 Sebastien Pouliot * graphics.c: In GdipSetClipRect, ensure the temporary region gets deleted even if it's creation has failed. Added annotation for allocation functions. * region.c: Fix annotation for GdipCreateRegion. 2006-08-13 Gonzalo Paniagua Javier * dstream.[ch]: read from a stream using delegates, buffers the input and keeps EXIF data buffer around. * bmpcodec.[ch]: use dstream_t to take advantage of the buffering capabilities, as this codec does a lot of small reads. * image.c: use dstream_t for BMP and JPEG stream reading. * jpegcodec.[ch]: use dstream. Load EXIF data if available. * gdipImage.h: fill the gaps for PropertyTagType. * Makefile.am: added new files. 2006-08-12 Duncan Mak * graphics.c (GdipDrawPolygon, GdipDrawClosedCurve2): Add checks for cases when count is less than two, that's an InvalidParameter. * graphics.c: In all cases where convert_points is used, check that count must be greater than zero. 2006-08-11 Duncan Mak * graphics.c (GdipSetTextContrast): The accepted range for 'contrast' was between 0 and 14 before. The docs on MSDN says it should be between 0 and 12 instead. 2006-08-10 Duncan Mak * graphics.c: Rewrote all NULL checks without using g_return_val_if_fail. 2006-08-11 Sebastien Pouliot * font.c: Yet another fix to gdip_logfont_from_font to match MS behaviour more closely (and hopefully fix unit tests under Windows) * region.c: Coverity function annotation worked (it removed a false positive) and found more possible problems (like the unlikely case where we return an error but did allocate memory). Added more annotations. 2006-08-10 Sebastien Pouliot * region.c: Test to see if this help remove a false positive. * graphics.c: Don't loose track of user supplied tension in function GdipDrawClosedCurve2I. * graphics-path.c: Fix stupid typo made after removing that unrequired line. 2006-08-10 Sebastien Pouliot * graphics-path.c: Avoid temporary memory allocation to convert int into floats in GdipAddPathLine2I, GdipAddPathBeziersI and GdipAddPathBeziersI functions. Remove (now) unnecessary int_to_floats function. Replace calloc calls with GdipCalloc. Remove useless line in GdipAddPathCurve2. * pathgradientbrush.c: Fix GdipCreatePathGradientFromPath to return the same value as GDI+. 2006-08-10 Sebastien Pouliot * graphics.c: s/CONVERTION/CONVERSION/ (alp) * general.c: s/CONVERTION/CONVERSION/ (alp) * image.c: s/CONVERTION/CONVERSION/ (alp) * general.h: s/CONVERTION/CONVERSION/ (alp) * region.c: s/CONVERTION/CONVERSION/ (alp) * region-bitmap.c: s/CONVERTION/CONVERSION/ (alp) * matrix.c: Changed some null checks not to print warnings during unit tests. * graphics-path.c: Fix GdipWidenPath to return the same value as GDI+. Changed some null checks not to print warnings during unit tests. 2006-08-10 Sebastien Pouliot * font.c: Deal with gdip_unit_conversion being a function. * general.c: Add OPTIMIZE_CONVERTION to help avoid a floating point division and multiplication when converting units (in the case where source == target). Added gdip_cairo_rectangle, gdip_cairo_move_to, gdip_cairo_line_to and gdip_cairo_curve_to to deal with the 15bits width/height limits (more to come). Added checks for memory allocation failures. * general.h: New. Stop polluting gdip.h with internal macros and prototypes. * graphics.c: Use OPTIMIZE_CONVERTION before doing unit convertions. Removed gdip_unit[x|y]_convgr and gdip_convgr_unit[x|y] functions. They are now macros inside general.h. Changed gdip_unit_conversion to be a function (cleaner and easier for macros). Updated all calls to cairo_move_to, cairo_line_to, cairo_curve_to and cairo_rectangle to use the new gdip_* functions (that deals with coordinate limits, unit convertion and antialiasing). * image.c: Use OPTIMIZE_CONVERTION (or similar) before doing unit convertions. Fix typo in GdipDrawImageRectRect where srcwidth wasn't set and destoryed the dstwidth value. * Makefile.am: Add general.h to the build. 2006-08-09 Sebastien Pouliot * graphics.c: Added more memory allocation failure checks. Be more careful when disposing resources inside GdipDeleteGraphics. * graphics-path.c: Changed null check not to print warnings during unit tests. Added more memory allocation failure checks. * general.c: Added more memory allocation failure checks. * font.c: Remove deadcode (CID 234) introduced by the last fix. 2006-08-08 Sebastien Pouliot * region.c: Fix exclude on rectangular region to work with negative positions (X, Y). 2006-08-07 Gonzalo Paniagua Javier * image.c: don't leak file_name if we fail to open it. 2006-08-07 Sebastien Pouliot * general.c: Avoid double initialization (e.g. multiple appdomains) which would, for example, double the number of image codecs. 2006-08-05 Sebastien Pouliot * graphics.c: Changed null check not to print warnings during unit tests. * font.c: logFont->lfCharSet is always 0 from GDI+ (but it's returned as 1 inside System.Drawing). Fix Mono/Windows test failure. 2006-08-04 Gonzalo Paniagua Javier * bitmap.c: allocate 32-bits space for 24bpp when locking as ReadOnly or ReadWrite too. 2006-08-04 Gonzalo Paniagua Javier * bitmap.c: the destination format for a 24bpp RGB image has 32 bits internally. 2006-08-04 Sebastien Pouliot * graphics-path.c: match GDI+ return value (requires fix to SD); * pathgradientbrush.c: match GDI+ return value (requires fix to SD); * pen.c: match GDI+ return value (requires fix to SD). Changed some null checks not to print warnings during unit tests. 2006-08-03 Sebastien Pouliot * font.c: match GDI+ return value (requires fix to SD); * region.c: match GDI+ return value (requires fix to SD); 2006-08-03 Chris Toshok * graphics.c (make_arc): this was a pain in the butt to find. fix the weird drawing bugs we've been seeing in the ellipse code by using fabs() instead of abs(), as the latter truncates to an int. (make_arcs): more abs -> fabs. (make_pie): same. * graphics-path.c: make analogous s/abs/fabs changes here. 2006-08-03 Duncan Mak * graphics.c (make_pie): * graphics-path.c (GdipAddPathPie): Don't draw pie edges when we will be drawing an ellipse (i.e. when sweepAngle >= 360). 2006-08-01 Sebastien Pouliot * tiffcodec.c: Fix typo to cause crashes when a tiff file has properties (#78886). Fix a leak by calling TIFFRGBAImageEnd. 2006-07-31 Peter Dennis Bartok * gifcodec.c (gdip_save_gif_image): Remove unneeded line causing buffer overflow. 2006-07-24 Alexander Olk * graphics.c: Don't SIGSEGV when making polygons. The last point in the array is count-1 not count. 2006-07-21 Chris Toshok * image.c: include cairo-features.h so CAIRO_HAS_PS_SURFACE will be defined if we have it. 2006-07-07 Sebastien Pouliot * gifcodec.c: Return a GenericError in gdip_save_gif_image if the pixel_format isn't a know value. This makes sure cmap_size is always initialized (before being used). * region-bitmap.c: Don't show up a warning if we're cloning a region containing an empty graphicpath (as it is normal that no bitmap would be required); * tiffcodec.c: Make sure we don't dereference a NULL pointer inside gdip_load_tiff_image (and properly return OutOfMemory). 2006-07-06 Chris Toshok * graphics.c (CalculateStringWidths): don't do the cairo call if we're dealing with a \n, as cairo says its extent is 7 pixels wide. (MeasureOrDrawString): add LineHeight to CursorY on a NEWLINE, not LineHeight * LineFeeds. (MeasureString): same. (GdipMeasureCharacterRanges): don't add strDetail[j].X/Y twice when creating the charRect. 2006-07-06 Sebastien Pouliot * brush.c: Remove empty and unused gdip_brush_destroy; * image.c: Add missing calls to cairo_pattern_destroy when a previous call to cairo_pattern_reference is made on a pattern; * solidbrush.c: Add missing NULL checks for GdipCreateSolidFill and GdipGetSolidFillColor functions and remove duplicate checks for gdip_solidfill_destroy and gdip_solidfill_clone functions. 2006-07-06 Sebastien Pouliot * image.c: Add missing NULL check to GdipDisposeImage. 2006-07-04 Sebastien Pouliot * pen.c: Fix #78742 where an error occurs when we use a pen's width of 0 (not a real value) with a dash style. 2006-06-29 Sebastien Pouliot * region.c: Report OutOfMemory condition in GdipCloneRegion. Ensure all memory is freed from the tree used in GdipCombineRegion* functions and avoid some memory alloc/free when possible. 2006-06-28 Sebastien Pouliot * font.c: Make sure GdipGetLogFont[A|W] always initialize the LOGFONT structure correctly - even if it must return an error. Fix #78721. 2006-06-27 Gonzalo Paniagua Javier * bitmap.c: avoid invalid read when we have a 24bpp format. 2006-06-26 Sebastien Pouliot * font.c: Don't read past allocated memory. * hatchbrush.c: Don't both add a reference when cloning and set base.changed to TRUE (kept the latter); * pen.c: (Again) Don't free, but delete, the brush to ensure it's own data gets freed (e.g. the pattern for hatch brushes). 2006-06-22 Sebastien Pouliot * pathgradientbrush.c: Avoid memory allocations (that were never freed anyway) when creating path gradients. Fix valgrind detected leaks when running unit tests. * pen.c: Don't free, but delete, the brush to ensure it's own data gets freed (e.g. the pattern for hatch brushes). 2006-06-15 Wade Berrier * general.c: Remove dlfnc.h since it's currently not used (this was also a deprecated api on mac 10.4) * Makefile.am: Remove -Werror (Originally for the above issue in general.c, but twas decided to remove it anyway) 2006-06-12 Gonzalo Paniagua Javier * bitmap.c: align the stride to pixman_bits_t in LockBits. 2006-06-08 Sebastien Pouliot * graphics-path.c: Implemented GdipIsVisiblePathPoint[I] functions (except for some cases where a GpGraphics is supplied and used). * hatchbrush.c|h: Fix parts of #78159 where the hatches visual output doesn't match MS. This works better with newer X version (e.g. SuSE10) than older ones (e.g. NLD9). 2006-06-07 Sebastien Pouliot * graphics-path.c|h: Implemented GdipIsOutlineVisiblePathPoint[I] functions (except for some cases where a GpGraphics is supplied). 2006-06-06 Sebastien Pouliot * graphics-path.c|h: Fix declarations (missing GpPen parameter) for GdipIsOutlineVisiblePathPoint[I] functions. 2006-06-05 Sebastien Pouliot * region.c: Fix region-region intersection with infinity (can't have an infinite bitmap but this is identical to unioning with empty ;-) and add some shortcuts for other special cases. 2006-06-02 Sebastien Pouliot * graphics-path.c: Changed GdipWidenPath and GdipWrapPath to show a warning and return Ok instead of NotImplemented (to avoid crash in PDN). * region.c: Fixed clone when the region is empty. Added error checking in GdipCombineRegionRect if path creation fails. 2006-06-01 Sebastien Pouliot * general.c: FcFini was introduced in fontconfig 2.2.91 and we support earlier versions. 2006-05-31 Sebastien Pouliot * font.c: Added a cache for FcPattern to avoid calling (the very slow) FcFontMatch over and over again when no FontCollection is supplied. * general.c: Added code to clear and free the cache at shutdown. * gdip.h: Added prototype for gdip_font_clear_pattern_cache. 2006-05-31 Sebastien Pouliot * font.c: Added mutexes for handling the generic (reference counted) fonts (serif, sans-serif, monospace) and when dealing the fontconfig's FcConfig (which isn't thread-safe and fails under heavy usage in ASP.NET). * general.c: Added calls to fontconfig's FcInit and FcFini in GdiplusStartup and GdiplusShutdown functions. 2006-05-30 Sebastien Pouliot * font.c: Added more error checking when calling fontconfig API. 2006-05-29 Sebastien Pouliot * hatchbrush.c: Ensure we're freeing everything if no more memory can be allocated. 2006-05-26 Sebastien Pouliot * font.c: (GdipCreateFontFamilyFromName) Don't free string before calling FcPatternDestroy. This fix an occasional SIGSEGV (only seen under XSP2). 2006-05-25 Sebastien Pouliot * graphics.c: Implemented GdipSetClipHrgn before finding out (at test time that it's not exposed thru System.Drawing.dll). * region.c: Implement GdipGetRegionHRgn and GdipCreateRegionHrgn. This fix a possible double dispose in S.D. 2006-05-24 Gonzalo Paniagua Javier * image.c: * bitmap.c: * gdip.h: added MEMBMP, its GUID and the mapping from that in-memory format to file type when saving. This changes the default bitmap RawFormat to MemoryBmp and its default file format to PNG. 2006-05-24 Sebastien Pouliot * graphics.c: Remove some warning display from S.D. unit tests. * lineargradientbrush.c: Remove some warning display from S.D. unit tests. 2006-05-24 Sebastien Pouliot * hatchbrush.c|h: Large patch to reduce code duplication and add missing (and fix bad) error checking. *No* visual changes (or fixes) in the hatch output (yet) and valgrinded. 2006-05-24 Sebastien Pouliot * bitmap.c: Zeroize allocated bitmap memory. Fix #78478 * brush.c: Make sure we check for NULL before using any pointer. * pen.c: Clone the supplied brush in the GdipCreatePen2 function (as the user may dispose of it anytime). 2006-05-23 Gonzalo Paniagua Javier * gifcodec.c: support 'combine' animated gifs and top/left positioning of frames. Last part of the fixes for bug #77247. 2006-05-23 Jordi Mas i Hernandez * font.c: removes libgdiplus dependency against Cairo _cairo_toy_font_face_create API function. Change to make Cairo 1.2 linkable with libgdiplus. 2006-05-22 Gonzalo Paniagua Javier * gifcodec.c: null terminate the byte array passed to gdip_bitmapdata_property_add_ASCII to avoid an invalid memory read. 2006-05-21 Sebastien Pouliot * hatchbrush.c: Check all pointers for NULL. 2006-05-19 Gonzalo Paniagua Javier * bmpcodec.c: fix bfSize for 24bpp. 2006-05-19 Gonzalo Paniagua Javier * bmpcodec.c: now we're able to roundtrip a 24bpp bmp file. Don't create the cairo surface when loading the image. Remove unused (obsolete?) gdip_bitmap_save_bmp(). 2006-05-19 Gonzalo Paniagua Javier * bitmap.c: don't leak the allocated 'scan0' when converting indexed to RGB. 2006-05-18 Gonzalo Paniagua Javier * bmpcodec.c: don't change the PixelFormat to 32bpp when it's a 24bpp. * image.c: 24bpp bitmaps are 4-bytes (cairo dixit). Fixes the 24bpp test again. 2006-05-17 Gonzalo Paniagua Javier * bitmap.c: speed up the 8bppIndexed -> 32bpp conversion. 2006-05-17 Sebastien Pouliot * gdip.h: Added GpDashCap dash_cap to GpPen. It's not used (visually) but this way we can keep track of it (unit tests). * pen.c: Multiple fixes to match new unit tests: - fix DashStyleCustom style to use the current DashPattern (no reset); - don't accept non-invertible matrices in GdipMultiplyPenTransform and GdipSetPenTransform; - set the minimum miter limit to 1.0 in GdipSetPenMiterLimit (whatever the value supplied); - fix some error conditions to return the correct error code and also track some unimplemented stuff (rather than throwing); 2006-05-15 Sebastien Pouliot * pen.c: Added an hack to keep the "bad" behaviour in the most common MWF usage (i.e. where the badness isn't visible). 2006-05-15 Sebastien Pouliot * pen.c: Revert the change from r52463. This looks better only when the pen's width is 1 (but looks worse in other cases). This fix both bug #77976 (dash style) and #78059 (double pixel). Also remove a FIXME which is no more required with this fix. 2006-05-12 Sebastien Pouliot * image.c: (GdipSaveImageToFile) don't access image->type before the NULL check for image. (GdipLoadImageFromDelegate_linux, GdipLoadImageFromFile) ensure result isn't NULL before using it. * graphics-path.c: Fix misnamed GdipAdd*Path*String[I] API (#78383) * region.c: Fixed the case where an infinite region was unioned with a rectangle (and didn't result in infinity). 2006-05-12 Peter Dennis Bartok * graphics.c (MeasureOrDrawString): Only make every character a wrappoint if we're single-line and have char trimming (#78336) 2006-05-12 Peter Dennis Bartok * region.c (gdip_combine_union): Hack to allow adding rectangles with negative x/y coordinates. This method should probably be reworked properly, not assuming negative values have a special meaning. 2006-05-12 Sebastien Pouliot * bitmap.c: (GdipCreateBitmapFromScan0) make sure we're not gonna use the default_palette if NULL. (GdipBitmapLockBits) don't use srcRect pointer before it's NULL check. (gdip_propertyitems_clone) free result before returning OutOfMemory. (GdipCloneBitmapAreaI) add missing call to gdip_bitmap_dispose in fail. * gdip.h: Change GpPen.matrix to cairo_matrix_t (to avoid unrequired allocation/free). * graphics-path.c: (GdipGetPathWorldBounds) free workpath in the special case where weonly have a single element after flattening. (GdipAddString) added checks for invalid font and NULL layoutRect. (gdip_convert_bezier_to_lines) removed impossible special case. * lineargradientbrush.c: Ensure we always free the structures we allocated in case we hit an error. * pathgradientbrush.c: Ensure we always free the structures we allocated in case we hit an error. * pen.c: Updated code to avoid multiple dynamic creation and deletion of GpMatrix. * region.c: (GdipCreateRegionRgnData) make sure we free the GpRegion in all error cases. (gdip_combine_complement) avoid possible double free. * stringformat.c: (GdipGetStringFormatTabStops) don't use the format pointer before it's NULL check. 2006-05-11 Sebastien Pouliot * graphics.c: (GdipCreateFromHDC) check for memory allocation failure before using the pointer. (GdipSetClipGraphics) honor the combineMode parameter (in this case by reusing the GdipSetClipRegion function). * graphics-path.c: (GdipAddString) it is possible that some memory is allocated by cairo even if the *_create call fails - so we must call the corresponding *_destroy function on failure to create. * matrix.c: (GdipCreateMatrix3) Ensure we call GdipFree in case of an error (where we do not return the allocated matrix). 2006-05-10 Sebastien Pouliot * pathgradientbrush.c: Sadly Cairo doesn't support path-based gradients. Added support for a special case where we can use cairo's radial gradient. Otherwise we continue to fill using the center color. 2006-05-09 Sebastien Pouliot * pathgradientbrush.c: Apply tricks, knowledge and unit tests from lineargradientbrush as a starting point (i.e. it doesn't fix anything visually but I like those foundations better ;-) * pathgradientbrush.h: Change transform and rectangle not to require extra memory allocations (always allocated, static size). 2006-05-08 Sebastien Pouliot * graphics-path.c: Added pen support to GdipGetPathWorldBounds as the result doesn't have to be very precise (see test cases). Fixed GdipWidenPath to return OutOfMemory if the supplied path as a single point (seems to be a bug, reported as FDBK49685). Fixed GdipWarpPath to reset (empty) the path in the same case (again to match MS); 2006-05-05 Sebastien Pouliot * lineargradientbrush.c: Changed atanf for atan (for older SunOS); * graphics-path.c: Changed GdipGetPathWorldBounds to get better results when curves are used (much better than MS GDI+). Reduced memory allocations. Pen support is still missing. 2006-05-04 Sebastien Pouliot * graphics.c: Fix the default (parameter-less) BeginContainer by introducing a previous_matrix inside GpGraphics. Keeping the effective matrix from the previous container (or the original graphics) allow us to substract it when a call to GdipGetWorldTransform is made. 2006-05-04 Sebastien Pouliot * graphics.c: Removed the reset on the matrix when begining a new container (this is half-right, but better vistually than the current reset). Added a FIXME in GdipGetWorldTransform as it won't return the correct results inside a container. Added MonoTODO to Gdip[Get|Set] PixelOffsetMode as we do not use the value inside libgdiplus (and changing it should affect other values). * region.c: Fixed bug #78284 when doing a transform on an empty region. Also ensure we convert empty region as the some structures are assumed to be allocated after the conversion. * region-bitmap.c: Allow region bitmaps with 0 width and/or height as this is a valid case (i.e. they aren't too big to render ;-). 2006-05-03 Sebastien Pouliot * lineargradientbrush.c: Applied patch for #78185 from Bill Holmes to add support for scalable angle. Changed a bit to use the new matrix function. * matrix.c|h: Added a new function to avoid code duplication when creating a matrix from a rectangle and 3 points. 2006-05-02 Peter Dennis Bartok * bitmap.cs: Only mark the bitmap as own if we actually allocated it (fixes crash exposed by pdn) 2006-05-02 Sebastien Pouliot * gdip.h: Changed GpGraphicsContainer to uint (so it match how we are using the Save/Restore functions). Added text_contrast to GpState and GpGraphics (even if it's not really used ATM). Added missing prototypes for GdipBeginContainer[2][I] functions. * graphics.c: Implemented GdipBeginContainer2 and GdipEndContainer functions. Added partial implementation for GdipBeginContainer2 and GdipBeginContainerI as they don't support the extra parameters (rectangle and units). Added the code to set/get text contrast with Gdip[Get|Set]TextContrast to help the unit test (but it's not being "visually" used). 2006-05-01 Peter Dennis Bartok * graphics.c (GdipMeasureCharacterRanges): Now considers string alignment (which is needed for properly aligned LinkLabels) 2006-05-01 Peter Dennis Bartok * bitmap.c (gdip_pixel_stream_set_next): Fixed wrong shifting. 2006-05-01 Gonzalo Paniagua Javier * pngcodec.c: don't loop forever on truncated images. Fixes bug #78213. Patch by Pavel Sakowski. 2006-05-01 Sebastien Pouliot * graphics.c: Updated and completed Duncan's patch for #76907. We now support the offset and numOfSegments parameters of GdipAddPathCurve3. 2006-05-01 Sebastien Pouliot * graphics.c: Updated and completed Duncan's patch for #76907. We now support the offset and numOfSegments parameters of GdipDrawCurve3. * lineargradientbrush.c: Applied patch for #78179 from Bill Holmes which fixes gradients created using 2 points (and not a rectangle). Also removed two (now) unused functions in the source code. 2006-04-30 Peter Dennis Bartok * image.c: If an attribute changes scan0, it will (now) also change the pixel_format. Save the original so we can properly restore when done. * imageattributes.c: Set the pixel_format of our work-bitmap to 32bppArgb (since most our methods need alpha and the provided format might not have alpha) 2006-04-30 Peter Dennis Bartok * pngcodec.c: Make sure the alpha bit makes it over to the bitmapdata 2006-04-30 Peter Dennis Bartok * pngcodec.c: We were handling transparency wrong. The transtable runs alongside the palette (but possibly shorter), providing the alpha value for the corresponding palette entry 2006-04-29 Peter Dennis Bartok * pngcodec.c: Added reading of select png properties. I might have missed some additional we can support, but for the images I had for testing we return all the same properties as MS. Still need to add saving so we can roundtrip. This replaces the previous hack * bitmap.c (gdip_bitmapdata_property_add_short): Fixed to match other xxx_add_xxx methods, removed length and pointer requirement * gdip.h: Updated prototype * tiffcodec: - Fixed whitepoint reading; we were only readying X - Fixed storage type and size for TransferFunction 2006-04-29 Peter Dennis Bartok * pngcodec.c: Returning fake comment (for pdn) until we read real properties in png 2006-04-29 Peter Dennis Bartok * bitmap.c (gdip_pixel_stream_set_next): The previous 24bit patch ignored that for 32bit copies we need to fill 4 bytes and the first is not blue, but the alpha value, everything is shifted one byte. 2006-04-29 Peter Dennis Bartok * tiffcodec.c: Added a workaround for a broken TIFF I've encountered (winforms/img/multipage.tif) to prevent us from crashing 2006-04-29 Peter Dennis Bartok * gifcodec.c: Comments are not null-terminated, we need to copy the string into a buffer with a null terminator before storing them in our properties (Fixes #78181) 2006-04-29 Sebastien Pouliot * font.c: gdip_cairo_ft_font_lock_face can return NULL is some cases, like when the file fonts.conf is missing. We now check for the NULL value eveywhere the lock is used and issue a warning (console) about the failure. Fix bug #78237. * graphics.c: Check for NULL from gdip_cairo_ft_font_lock_face. 2006-04-27 Sebastien Pouliot * graphics.c: Added MonoTODO because we're not using the numberOfSegments parameter in GdipDrawCurve3[I] functions. * graphics-path.c: Fixed AddPathCurve* functions to deal (in some cases) with curve specified with two points (with strangely not the same behaviour as DrawCurve). Added more checks for memory allocation failures. Added MonoTODO because we're not using the numberOfSegments parameter in GdipAddPathCurve3[I] functions. 2006-04-27 Sebastien Pouliot * graphics.c: Add missing checks in GdipDrawCurve3. Also add a corner case where GdipDrawCurve[2][I] (but not GdipDrawCurve3) functions allows to draw lines (curves with two points). 2006-04-27 Peter Dennis Bartok * pngcodec.c, bmpcodec.c: Missed a few vars in BIG_ENDIAN codepath when doing the image rewrite 2006-04-27 Sebastien Pouliot * gdip.h, graphics.c: Fix prototypes for GdipDrawCurve3 and GdipDrawCurve3I functions (float to int). The System.Drawing wrappers are correct. This is the first part of Duncan's patch for #76907. 2006-04-27 Sebastien Pouliot * graphics-path.h: Add prototypes for GdipAddString and GdipAddStringI * graphics-path.c: Add a basic implementation for GdipAddString[I] which use the path Cairo builds to get the font path outlines. Some options aren't yet supported (e.g. StringFormat) and would require some refactoring of the DrawString code. 2006-04-26 Sebastien Pouliot * image.c: GdipLoadImageFromFile returns OutOfMemory when a file format is unkown (like a text file, an EXE...). This makes S.D. throw an OutOfMemoryException (which is MS compatible). 2006-04-26 Sebastien Pouliot * image.c: Patch by Bill Holmes to fix bug #75063. This correctly implement all cases (including rotation) when points are given as positions to draw an image. 2006-04-26 Gonzalo Paniagua Javier * bmpcodec.c: for 32bpp on little endian platforms, we can use memcpy here. * bitmap.c: special case for 24bppRgb in LockBits, as gdip_get_pixel_format_bpp returns 32bpp for it. Fixes bug #76193. 2006-04-26 Sebastien Pouliot * lineargradientbrush.c: Fix some angles that were still in degrees (when converted from LinearGradientMode). 2006-04-26 Sebastien Pouliot * lineargradientbrush.c: Applied patch for #78185 from Bill Holmes (billholmes54@gmail.com). This implements correctly the FlipX, FlipY and FlipXY modes and removes an incorrect check in GdipGetLineTransform. 2006-04-24 Sebastien Pouliot * lineargradientbrush.c: Second patch from Bill Holmes (and friends) which redo my complex matrix setup into a simpler one with much better results. 2006-04-24 Sebastien Pouliot * lineargradientbrush.c: Avoid the unrequired allocations for the rectangle and the matrix. Avoid multiple convertion of the angle from degrees to radians. Fix angle calculation when the gradient is built from two points. 2006-04-24 Sebastien Pouliot * lineargradientbrush.c: Gradients are now much better looking using a patch from Bill Holmes. 2006-04-22 Alexander Olk * image.c: Fixed build for warning: control reaches end of non-void function in GdipGetPropertyIdList 2006-04-21 Peter Dennis Bartok * bitmap.c (gdip_bitmap_clone_data_rect): Now calculating the size of the new bitmap based on source parameters if the new bitmap is just being created. This fixes the failing Bitmap.Clone() unit test. 2006-04-21 Peter Dennis Bartok * image.c: Implemented GetPropertyIdList 2006-04-21 Sebastien Pouliot * graphics.c: Fixes to clipping when resetting (resets the clipping matrix) and when setting the matrix (to apply inverted matrix). * gdip.h: Added missing prototypes for clipping. 2006-04-21 Alexander Olk * tiffcodec.c: Fixed the build for "older" gcc versions. They don't like uint32 pointers when they expect guint32 pointers in gdip_property_get_long 2006-04-21 Gonzalo Paniagua Javier * imageattributes.c: don't apply the color matrix to transparent pixels. Now the disabled toolbar buttons in sharpchess are displayed correctly. 2006-04-20 Peter Dennis Bartok * tiffcodec.c: Cleaned up unused stuff 2006-04-20 Peter Dennis Bartok * tiffcodec.c: - Added reading and setting of dpi when loading image - Now distinguishes between images with or without alpha and sets the appropriate image flags when loading tiff images - Added ability to save images as RGB instead of ARGB if the flags indicate it's ok to do so - Added saving of properties associated with each picture (we now successfully roundrip images) - Setting the TIFF Error and Warning handler to NULL to suppress error and warning output on the console * gdip.h: Added prototypes for property getters * bitmap.c: Implemented property getter helper methods to allow codecs to easily translate saved properties for saving 2006-04-20 Peter Dennis Bartok * tiffcodec.c: - Switched from passing the file pointer to passing the filename for saving. Apparently when a FILE is fdreopen()ed it doesn't seek properly anymore, and we need the ability to seek when saving multi-file images - Moved page counter inside page loop - Added definition for the private Exif IFD tag (for those using older versions of TIFFLIB) * image.c: We no longer pass a file pointer for saving TIFF files, instead we pass the target filename * tiffcodec.h: Changed prototype to match tiffcodec.c 2006-04-20 Peter Dennis Bartok * gdipImage.h: Fixed typo in tag name * tiffcodec.c: Implemented reading of TIFF tags and translating them into properties. 2006-04-20 Sebastien Pouliot * lineargradientbrush.h: Added DEFAULT_GRADIENT_ANGLE constant. * lineargradientbrush.c: Simplify brush creation and fixed initial matrix calculations. Fixed matrix operations functions. Don't create an extra surface in create_tile_linear (other wrap mode still need to be updated). This is "closer" to the real thing (much better results in ZedGraph) but there are still issue mainly with rotations. 2006-04-20 Peter Dennis Bartok * gifcodec.c: Loader is now alpha/transparency aware and always sets up the palette with alpha set. If transparent color is specified, the the matching palette entry alpha is set to zero. * bitmap.c (gdip_bitmap_indexed_to_rgb): Now properly handles palettes with alpha values. 2006-04-20 Peter Dennis Bartok * gdip.h: Added transparent tracking field to BitmapData * bitmap.c: Added copying new transparent field to bitmap cloning * gifcodec.c: - Now reads transparency color from ext block and stores in BitmapData - Now writes transparency, loop, delay and comment properties back out when saving. We can now roundtrip our gif properties 2006-04-20 Peter Dennis Bartok * image.c: Implemented all GdipGetProperty, GdipSetProperty and GdipRemoveProperty functions. * gdipImage.h: - Added PropertyTag and PropertyTagType enums - Fixed wrong GdipGetPropertyItem prototype * bitmap.c: - Implemented gdip_bitmapdata_property_xxx helper methods for manipulating property data associated with a bitmap - gdip_bitmapdata_clone now sets appropriate image_flags * gdip.h: Added prototypes for new functions in bitmap.c * gifcodec.c: - Added GGifSlurpMono, AddExtensionBlockMono and FreeExtensionMono functions derived from libgif, to work around libgif bug that prevents us from retrieving any extensions after the last image block (where it seems certain apps place their comments) - Added handling of trailing extension block, adding comments in that block will cause all images in the frame to have the comment - Added reading of LoopCounter, and subsequent storing as property - Horizontal and vertical DPI are now retrieved from display 2006-04-20 Peter Dennis Bartok * bmpcodec.c, general.c, image.c, jpegcodec.c, tiffcodec.c, imageattributes.c, gdipImage.h, region-bitmap.c, gifcodec.c, texturebrush.c, pngcodec.c, gdip.h: - Changed BitmapData, FrameData, GpImage and GpBitmap structures to more accurately reflect gdiplus behaviour; removed broken dual frame and single bitmap concept, instead everything is organized into frames, with an active bitmap designating the currently used bitmap. - Added property components to BitmapData to allow implementing properties per bitmap - Updated all image related code to use new structures - Lots of added sanity checks and logic bug fixes - Fixed up sources to use tabs instead of spaces (png, jpeg) and removed buttloads of trailing whitespace on lines in all files - Rewrote gif load and save methods to properly deal with animation, transparency and reading/storing animation delay times - Streamlined many functions, removed deep nesting, introduced single point of error handling for each encoder and decoder - Now allows for disparate sizes of bitmaps in a single frame - Implemented ImageLockModeUserInputBuf for GdipBitmapLockBits and several other unimplemented features 2006-04-19 Gonzalo Paniagua Javier * bmpcodec.c: fixed same error that Peter fixed in his last commit, but different place. 2006-04-19 Sebastien Pouliot * graphics-path.c: Avoid, when possible (i.e. null/identity), matrix calculations in GdipTransformPath (which gets inherited by every call using it). Also added a OutOfMemory check in GdipTransformPath if points can't be allocated. Added common path preparation (flattening and/or matrix) to GdipWindingModeOutline, GdipWidenPath and GdipWarpPath. 2006-04-19 Peter Dennis Bartok * bmpcodec.c: Fixed common math error when adding values to pointers. Was causing nasty memory overwrites when saving bmps. 2006-04-18 Peter Dennis Bartok * general.cs (MeasureOrDrawString): Remove padding from bounding rectangle calculations. It is causing issues with AutoHeight controls not matching MS 2006-04-18 Sebastien Pouliot * gdip.h: Add prototype for gdip_get_pattern_status function. * general.c: Added a new function to check the status of a cairo pattern (check for NULL isn't enough). If invalid the pattern will be destroyed. 2006-04-13 Sebastien Pouliot * font.c: Keep a static collection for the system font that will be leaked (on purpose, see comments). Added missing initialization (allocation) and nullification (freeing) to avoid using bad references (which also helps to get better results from valgrind). Reworked GdipPrivateAddMemoryFont to return the error codes leading to the expected exceptions in the System.Drawing.dll unit tests. 2006-04-13 Sebastien Pouliot * matrix.c|h: Fix public API signatures to use BOOL (not int). * region.c: Give a better chance to revert to a simpler (rectangular) region in GdipCombineRegionRect. 2006-04-11 Gonzalo Paniagua Javier * pngcodec.c: don't use any filter (makes the saved image smaller) and generate sRGB,gAMA and cHRM information as MS does. 2006-04-11 Gonzalo Paniagua Javier * pngcodec.c: no need for gdip_stream_png_source, just pass the function pointer. 2006-04-11 Sebastien Pouliot * graphics.c: Fixed bug #77129 where we shouldn't draw (or fill) rectangle(s) with either a negative width or height. 2006-04-10 Sebastien Pouliot * matrix.c: Fixed misimplemented GdipCreateMatrix3[I]. Reworked allocations to report OutOfMemory conditions. 2006-04-07 Sebastien Pouliot * region-bitmap.c: Changed free for GdipFree. Removed unused variable. 2006-04-03 Gonzalo Paniagua Javier * imageattributes.c: (gdip_process_bitmap_attributes): the default fallback condition was wrong and caused the function to not process or incorrectly process the attributes, as it either used the default attributes or did nothing on the bitmap. It works now (tested with BitMap.MakeTransparent() and using "imageAttr.SetColorKey (color, color, ColorAdjustType.Bitmap);"). 2006-04-03 Gonzalo Paniagua Javier * bmpcodec.c: fix offset when saving to a file and speed up writing the palette (15% faster saving). 2006-03-31 Peter Dennis Bartok * graphics.c: - Removed reset of clip_matrix whenever the clip is reset, since the matrix still would apply were another clip rectangle set later - Fixed signature of several methods from UINT to int, to match MS signature. Fixes TextBox not displaying the first char 2006-03-31 Sebastien Pouliot * graphics-path.c: Don't read past the end of the allocated points structure. 2006-03-30 Sebastien Pouliot * graphics.c: Check that the matrix is invertible in function GdipMultiplyWorldTransform. Fix typo for return value in function GdipScaleWorldTransform. * lineargradientbrush.c: Avoid memory allocation for GpRectF in function GdipCreateLineBrushFromRectI. Reduce the number of calls between GdipCreateLineBrush* functions. 2006-03-30 Sebastien Pouliot * lineargradientbrush.c: Fixed cloning (points and count). Added better error handling for cairo_pattern_create_linear. Check that the matrix is invertible in GdipSetLineTransform. * matrix.c: Matrix identity isn't an equality test and accept a margin for errors/precision. 2006-03-29 Sebastien Pouliot * graphics-path.c: Ensure we start/close figures correctly in every GdipAddPath* functions. Unit tests confirms the new behaviours. 2006-03-28 Peter Dennis Bartok * graphics.c (GdipSetPageUnit): We should be able to set all units. Not sure why that code was there. (Fixes #77829) 2006-03-28 Sebastien Pouliot * gdip.h: Added new member clip_matrix for GpState; * graphics.c: Add the clipping matrix to the information saved by GdipSaveGraphics and restored by GdipRestoreGraphics. 2006-03-27 Sebastien Pouliot * gifcodec.c: Added missing DGifCloseFile to reclaim memory. 2006-03-27 Sebastien Pouliot * gdip.h: Added new member clip_matrix for GpGraphics; * graphics.c: Make sure the applied transforms to the graphics are also affecting the clipping; * matrix.h: New macro to reverse the order to apply the matrix; 2006-03-27 Sebastien Pouliot * matrix.c: GdipIsMatrixInvertible shouldn't invert the matrix! 2006-03-26 Sebastien Pouliot * graphics.c: Add support for complex (after binary operations) clipping paths. Hackish but I don't see any alternative... * matrix.h: New. Header file for private region functions. * matrix.c: Added private functions for gdip_is_matrix_empty (moved from region.c) and gdip_is_matrix_a_translation (to enable an optimization). * region.c: Adjusted code for the renamed gdip_is_matrix_empty. Added a optimization to call GdipTranslateRegion from GdipTransformRegion if the matrix only does a translation. This allows to skip "rectangle to path" convertion and the invalidation/creation of a region bitmap. * Makefile.am: Added the new matrix.h header file to the build. 2006-03-25 Sebastien Pouliot * gdip.h: Add missing prototypes for GdipTranslateClip[I] functions. * graphics.c: Adjust anti-aliasing so that graphics can draw thin lines in SmoothingModeAntiAlias and SmoothingModeHighQuality modes (thanks to Peter Bartok). * graphics-path.c: Fix GdipTransformPath when the path is empty (to return Ok, not an error). 2006-03-25 Sebastien Pouliot * gdip.h: Added new structures required for path tree (GpPathTree) and regions bitmaps (GpRegionBitmap). * gdipImage.h: Added prototype for GdipGetImageGraphicsContext. * graphics.c: Re-implement GdipFillRegion to use the alpha bitmap provided for by region-bitmap. Correct clipping wrt infinite regions. * region.c: Adjust existing API to use the bitmap regions for path based regions, while keeping the existing code for rectangular based regions. * region.h: New. Header file for private region functions. * region-bitmap.c|h: New. Code to generate bitmap for regions and the binary operators on them (union, intersection, exclude, complement, xor). * region-path-tree.c|h: New. Code to create and manipulate trees of path with binary operators. This allows to re-create any region from a small set of serialized data. * Makefile.am: Add the new files to the build. 2006-03-23 Peter Dennis Bartok * graphics.c (MeasureOrDrawString): Avoid trying to draw 0-length lines (fixes #77699) 2006-03-23 Sebastien Pouliot * lineargradientbrush.c: Set the count value when cloning and Free the matrix when destroying the brush. 2006-03-23 Sebastien Pouliot * lineargradientbrush.c: Don't lose the original context 'ct' when flipping and free the new context. Remove obsoleted comments. 2006-03-22 Peter Dennis Bartok * font.c: - GdipDeletePrivateFontCollection: No longer free's the passed variable but instead the memory the passed var points to, since that's what's been allocated. Sigh. - GdipDeletePrivateFontCollection: Only destroy the FcFontSet and FcConfig if we have one allocated. - GdipDeleteFontFamily: Only free the pattern if it's actually been allocated. - GdipGetFontCollectionFamilyList: Where do I begin? It was very much broken and memory was not handled right, with bad overwrites. It now properly writes the font families to the pointers it's supposed to. Got a bit simpler in the process. 2006-03-22 Peter Dennis Bartok * image.c: - GdipDrawImageRect: Dropping the save/restore and putting in the proper fix for Digger and other apps not drawing properly after drawing an image. - GdipDrawImagePoints: Saving/Restoring the original source pattern 2006-03-22 Peter Dennis Bartok * image.c (GdipDrawImageRectRect): We're now properly saving and restoring the original source pattern (fixes #77438) * imageattributes.c: Setting copied pointer to null to avoid double usage 2006-03-22 Peter Dennis Bartok * image.c: - GdipDisposeImage: Single-frame images will have the frameDimensionList[].frames pointer point to the image's BitmapData block. We now consider that fact and free the image BitmapData only if it wasn't also part of the frames list (and was free'd there) - Removed a useless call to cairo that caused a leak but had no effect on rendering * bitmap.c: - gdip_bitmap_clone: Resetting all pointers to null after copying BitmapData. Otherwise the surface will get used without proper refcounting, and we would illegally free the memory off the wrong object. - GdipCloneBitmapAreaI: Eliminated intermediate stack var and memcpy - GdipCreateBitmapFromHBITMAP: Cloning the whole image instead of just the bitmap part. That way we also get the palette, etc. 2006-03-22 Sebastien Pouliot * lineargradientbrush.c: Don't needlessly allocate GpPointF structures in GdipCreateLineBrushI. Fix pointers when accesing a brush matrix in GdipGetLineTransform and GdipSetLineTransform. Fix error handling in GdipMultiplyLineTransform (to match GDI+). 2006-03-21 Sebastien Pouliot * imageattributes.c: Allocate enough memory before copying GpColorMap in GdipSetImageAttributesRemapTable. Also handle mapSize ==0 case and OutOfMemory condition. * region.c: Calling gdip_add_rect_to_array reallocate the array so we must update the recttrg variable. 2006-03-21 Sebastien Pouliot * texturebrush.c: Don't keep a reference to the "image" (but Clone) in GdipCreateTexture (we're not the owner of it). Fixed all the _flip functions that were broken (since the cairo 1.0 update ?). * image.c: Add a comment for a leak (it leak for texture clones but crash elsewhere if freed). 2006-03-20 Peter Dennis Bartok * font.c (gdip_cairo_ft_font_lock_face): Initialize the matrix to avoid using uninitialized memory in cairo 2006-03-20 Sebastien Pouliot * texturebrush.c: Ensure we destroy the matrix and the surface when disposing the brush. Add a reference to the surface when cloning. 2006-03-20 Sebastien Pouliot * font.c: Re-work font locking not to leak memory (and not to create a scaled font when unlocking). * graphics.c: Use CleanString (as String has been freed). 2006-03-20 Sebastien Pouliot * graphics.c: Clear the clipping region before data copying into it. * region.c: Remove static from gdip_clear_region as we need it in graphics.c for clipping. 2006-03-20 Sebastien Pouliot * image.c: Free the filter in GdipGetImageGraphicsContext. * pen.c: Use the GDI+ call to create the matrix (GdipCreateMatrix). Delete the default (empty) matrix when cloning a pen. Delete the matrix when disposing of the pen. 2006-03-19 Sebastien Pouliot * lineargradientbrush.c: The GpRect structure was never freed in GdipCreateLineBrushFromRectWithAngleI. Now allocated on the stack. Temporary matrixes weren't freed in gdip_linear_gradient_setup and create_tile_linear functions. * image.c: Reordered code to avoid using memory we just freed in gdip_get_imageformat_from_codec_clsid. 2006-03-18 Sebastien Pouliot * image.c: Free the image palette on dispose. Also copy (not refer) the palette when cloning the image (so we don't double-free it). 2006-03-17 Sebastien Pouliot * general.c: Call XCloseDisplay after we convert the DPI string as we do not own the 'val' pointer. * image.c: Destroy (cairo_pattern_destroy) the pattern we use as a filter in GdipDrawImageRectRect. 2006-03-16 Sebastien Pouliot * pen.c: Delete the temporary matrix created during gdip_pen_setup. 2006-03-14 Sebastien Pouliot * matrix.c: Add missing validations on count parameters. Fix return value for an invalid GpMatrixOrder in GdipMultiplyMatrix. 2006-03-14 Peter Dennis Bartok * image.c (DrawImageRect): Added a cairo_save/cairo_restore to fix the issue exposed by Digger (title score board background not drawn when doing the FillRectangle) 2006-03-13 Sebastien Pouliot * graphics-path.c: Add missing checks for markers. This fixes some issues (e.g. accesing item -1) and also reduce memory allocations for empty paths. Return Ok and display a warning when GdipAddString[I] is called (instead of returning NotImplemented). 2006-03-06 Jonathan Gilbert * pngcodec.c: Added block to handle saving of 8:8:8 images without an alpha channel. The underlying encoding of the image includes a filler byte, so that even Format24bppRgb is 32 bpp under the hood, but when libpng is told to expect RGB data, it expects only 24 bits per pixel, which was corrupting PNG output for Format24bppRgb and Format32bppRgb. 2006-02-24 Sebastien Pouliot * graphics-path.c: Add missing free in a special case (only one element) of GdipGetPathWorldBounds. Fix typo (X->Y) in GdipGetPathWorldBoundsI. 2006-02-10 Peter Dennis Bartok * font.cs: - Switched GdipCreateFontFromHfont name to GdipCreateFontFromHfontA to allow support charset-based naming when marshaling - Implemented GdipCreateFontFromLogfontA and GdipCreateFontFromLogfontW 2006-02-08 Sebastien Pouliot * graphics.c: Added a missing cairo_set_fill_rule in FillPath (which fixes bug #77408. Changed DrawPath to use 0, 0 (like FillPath) so they both draw at the same place (no blanks) and also behave like DrawRectangle(s) and FillRectangle(s) when compared side-by-side. 2006-02-03 Sebastien Pouliot * region.c: Fixed a case where gdip_combine_exclude wasn't excluding a rectangle if it was identical to the excluding one (see bug #77408 for an example). Also in gdip_combine_xor we do not need to call gdip_combine_exclude if there's no intersection between the rectangles 2006-02-01 Sebastien Pouliot * image.c: Added some missing argument checks. Implemented GdipDrawImagePointRect to fix bug #77428. 2006-01-31 Sebastien Pouliot * region.c: Added gdip_copy_region to help reusing region copying in GdipCloneRegion and GdipGetClip. * graphics.c: Fixed GdipGetClipBoundsI to get (not set) the clip. GdipGetClip and GdipFillPath now works with non-rectangular regions. Implemented GdipSetClipPath function. Added null checks for parameters in many functions. 2006-01-27 Sebastien Pouliot * gdip.h: Remove duplicate (and identical) definition for LF_FACESIZE. * graphics.c: GdipFillRegion now works with non-rectangular regions by either calling GdipFillPath or GdipFillRectangles. * graphics-path.c: Implemented GdipFlattenPath be re-using Sodipodi's libnr nr_curve_flatten. * graphics-path.h: Added a recursion limit of 10 when flattening. * region.c: Added gdip_is_region_empty which works with any type of region (rectangular or path based). Added special case support (empty and/or infinite region) in GdipCombineRegionPath. The common case is still missing. GdipTranslateRegion now works with non-rectangular regions. 2006-01-27 Jordi Mas i Hernandez * graphics.c: - Fixes font size for printing - Fixes unit conversions from diferent units * font.c, gdip.h - Implements GdipGetFontHeight, GdipGetFontHeightGivenDPI and GdipGetFontSize. 2006-01-26 Sebastien Pouliot * font.c: Use the reference count to [re-]created the generic font family (as the pointer isn't null after it is disposed). 2006-01-18 Peter Dennis Bartok * jpegcodec.c: Upconvert an indexed image, to allow saving it; added 1 and 4 bit as supported formats as well. This fixes #77270 2006-01-18 Peter Dennis Bartok * gdip.h: Switched GpRection.Cnt to int, to avoid signedness mismatch problems 2006-01-18 Sebastien Pouliot * graphics.c: Started adapting functions to recognize path based regions (while keeping rectangular regions working). * region.c: Added function to convert a rectangle based region to a path based region. Started adapting functions to recognize path based regions (while keeping rectangular regions working). Implemented GdipCreateRegionRgnData, GdipGetRegionDataSize and GdipGetRegionData (for both path and rectangle based regions). * gdip.h: Reordered some typedef to include a GpPath inside GpRegion. Added export for GdipCreateRegionRgnData. 2006-01-17 Peter Dennis Bartok * graphics.c: If no trim flag is set we need to wrap, not trim. Every character can be used as wrap character in that case. Fixes #76034 2006-01-16 Sebastien Pouliot * graphics-path.c: Implemented GdipGetPathWorldBounds[I] minus Pen support. 2006-01-15 Jordi Mas i Hernandez * graphics.c, image.c, gdip.h, general.c: - Implements PageUnit functionality - Converts units to Cairo user-space (postscript or display) - Each surface has its own x and y dpi - Allows setting Postscript dpy's 2006-01-13 Sebastien Pouliot * graphics-path.c: Added checks for the number of points added when using AddBeziers (4 points for the first, 3 afterward) and the minimum of point required to add a Curve, ClosedCurve and a Polygon. 2006-01-01 Jordi Mas i Hernandez * bitmap.c: Fixes 77131 2005-12-23 Peter Dennis Bartok * texturebrush.c: Added handling for indexed texture images 2005-12-22 Peter Dennis Bartok * texturebrush.c: Fixed generation of texturebrushes. Was seriously broken 2005-12-22 Jordi Mas i Hernandez * graphics.c: Postscript support for handle * image.c: Postscript drawble support for printing * gdip.h: Postscript Drawable 2005-12-09 Jordi Mas i Hernandez * graphics.c, image.c: Unreference the surface properly. Now, we do not leak those and cairo_surface_finish is called. 2005-12-07 Jordi Mas i Hernandez * graphics.c: Fixes 76923 2005-12-06 Peter Dennis Bartok * gdip.h: - Removed old wine leftovers for bitmaps - Added GpStatus return value to gdip_bitmap_clone() * bitmap.c: - Added handling of failures to gdip_bitmap_clone(), including returning a status - Implemented the GdipCreateBitmapFromHBITMAP() and GdipCreateHBITMAPFromBitmap() functions. Like with other handles the handle is equivalent to the gdi+ memory pointer 2005-12-05 Peter Dennis Bartok * gdip.h: - Removed wine leftover - Added LOGFONTA and LOGFONTW structures (for GdipGetLogFontX) - Added face var to GpFont struct to remember face name * font.c: - Implemented GdipGetLogFontA() and GdipGetLogFontW() functions - Implemented GetGetFontFromHfont() function - Droped wine leftovers and added code to remember (and free) the face name of a font 2005-12-02 Jonathan Gilbert * bitmap.c: Fixed support for PixelFormat24bppRgb in pixel streams. The count of bytes per pixel for pixel formats with depths of more than 8 bits is now stored negated in the state->pixels_per_byte member of the StreamingState structure. * gdip.h: Added comment explaining the meaning of negative values in the pixels_per_byte member of struct StreamingState. * bitmap.c: Fixed the copying back of changed bitmap data in the GdipBitmapUnlockBits() method. The condition was erroneously checking for the presence of the GBD_READ_ONLY flag instead of its absence. 2005-11-29 Duncan Mak * graphics.c (make_arcs, make_pie): * graphics-path.c (append_arcs, GdipAddPathPie): Scale alpha and beta accordingly because GDI+ deals with elliptical arcs, instead of circular arcs. Thanks to Bertram Felgenhauer from #cairo for helping me figure this out. This fully fixes #76846. 2005-11-29 Duncan Mak * graphics.c (make_arcs): * graphics-path.c (append_arcs): Add a new flag 'enough' to signify that we're done drawing all the subarcs. This fixes #76846. Previously, the check for 'enough' incorrectly filters out sweep angles with a negative value (i.e. drawing 'backwards'). 2005-11-13 Miguel de Icaza * image.c: Implement a little bit of mandolin. 2005-11-10 Geoff Norton * pngcodec.c: Readd a removed but needed variable for big endian build 2005-11-08 Peter Dennis Bartok * gdip.h: Added aa offset vars and hatch origin vars * graphics.c: - For all x and y coordinates that are passed to cairo, but not used for fills we now add an offset if anti aliasing is turned off. - Fixed Get/SetRenderOrigin. It is supposed to track the origin for dithering and hatchbrushes. * hatchbrush.c: - hatch lines are no longer are antialiased, except for the diagonal hatches, which are required to (Removes some fixmes) - Using square cairo line caps for now, to get diagonal lines to connect - Switched some numbers to more closely match MS again now that we're turning AA off * pen.c: Work around cairo drawing a linecap for every element of a dashed line 2005-11-07 Jackson Harper * pen.c: Set the width of dashes when creating the dashed array, cairo uses the values in the dashed array as the size of the dash. This fixes dashed lines with a width greater then 1. 2005-11-07 Kornél Pál * bmpcodec.c: Load 32-bit bitmaps as Format32bppRgb. 2005-11-05 Jordi Mas i Hernandez * graphics.c: Fixes 76111 (DrawString does not honor NoWrap) 2005-11-01 Peter Dennis Bartok * graphics.c: Implemented smoothing mode support. Now defaulting to non-antialiased drawing 2005-11-01 Jonathan Chambers * pen.c: LineCapFlat needs to translate to square cairo line caps in order for line lengths to be correct when not aliased 2005-10-23 Jonathan Gilbert * image.c: Renamed gdip_FlipX() and gdip_rotate_180_FlipX() to gdip_flip_x() and gdip_flip_y() respectively. * image.c: Updated GdipDrawImageRectRect to call the functions by their new names. * image.c: Renamed copy_pixel()'s third argument 'components' to 'size', as pixel components can be more than one byte in size. * image.c: Rewrote gdip_flip_x() to use only a single scan of buffer space instead of redoing the entire image. Moved gdip_flip_x() to be adjacent to gdip_flip_y(). * image.c: Replaced gdip_rotate_90(), gdip_rotate_180(), and gdip_rotate_270() with gdip_rotate_orthogonal_flip_x() which handles all types of rotation and can also integrate a horizontal flip into the rotation. All of the RotateFlipTypes can be reduced to a clockwise rotation of a multiple of 90 degrees optionally followed by a horizontal flip. * image.c: Added gdip_rotate_flip_packed_indexed() which does what gdip_rotate_orthogonal_flip_x() does but for 1- and 4-bit Bitmaps, where a single byte contains more than one pixel. * image.c: Reworked GdipImageRotateFlip to determine the rotation and whether a flip is required first and then call one of the two core rotation functions to do the appropriate operation. * bitmap.c, gdip.h: Moved the definition of the pixel stream code's struct StreamingState from the middle of bitmap.c to gdip.h. The functions were already being exported (non-static), but the structure was inaccessible making pixel streams unusable outside of bitmap.c. * gdip.h: Added prototypes for pixel stream functions so that they could be used by gdip_rotate_flip_packed_indexed() in image.c. 2005-10-21 Miguel de Icaza * hatchbrush.c (gdip_hatch_clone): Also copy and reference the brush. This bug was identified by Zoltan's change to the runtime where segfaults in unmanaged code are not translated into NullReferences. 2005-10-19 Jordi Mas i Hernandez * font.c: Make us more resistant to situations like bug #74761 2005-10-17 Ruediger Oertel * gifcodec.c: Switching from libungif to libgif 2005-10-10 Jordi Mas i Hernandez * graphics.c: fixes line width issues when drawing underline/strikeout 2005-10-10 Jordi Mas i Hernandez * graphics.c: remove unused vars and dead code * font.c: remove unused vars * bmpcodec.c: remove unused vars * general.c: remove unused vars * pathgradientbrush.c: remove unused vars * image.c: remove unused vars * jpegcodec.c: remove unused vars * region.c: remove unused vars * tiffcodec.c: remove unused vars * imageattributes.c: remove unused vars * gifcodec.c: remove unused vars * texturebrush.c: remove unused vars * matrix.c: remove unused vars * customlinecap.c: remove unused vars * bitmap.c: remove unused vars * pen.c: remove unused vars * pngcodec.c: remove unused vars * graphics-path.c: remove unused vars * lineargradientbrush.c: remove unused vars 2005-10-06 Peter Dennis Bartok * adjustablearrowcap.c: Removed unused vars * bitmap.c: Removed unused vars * font.c: Switched 0 to NULL 2005-10-06 Peter Dennis Bartok * general.c: Fixed bug in ucs2 termation code; code assumed a byte array, so we always terminated twice as many bytes in as we wanted to. This was also causing 'random' crashes at much later times since depending on the situation we'd write 0 past the end of ucs2_len (This is half of the bugfix for #74871 and #75534) 2005-10-06 Jordi Mas i Hernandez * gifcodec.c: Fixes a warning (an error since we use -Werror) when using libgif 4.0) 2005-10-06 Jordi Mas i Hernandez * image.c: Partially fixes 75063 * matrix.c: Some documentation about matrices 2005-10-03 Duncan Mak * graphics.c (make_arcs): * graphics-path.c (append_arcs): Helper functions for dividing the arcs into smaller segments. Properly handles negative starting angles and sweep angles. * graphics-path.c (GdipAddPathArc, GdipAddPathPie): * graphics.c (GdipDrawArc, make_pie): Simplified to make use of the new helper functions. 2005-09-20 Jordi Mas i Hernandez * image.c, gdip.h, image.c: Creates the surface and then creates the graphics context. This is not only reduces the operations need it, also and more avoids to lose the values that we have init into cairo. 2005-09-21 Peter Dennis Bartok * bmpcodec.c: The alpha value in a indexed color table is never valid. Since the indexed bitmap code uses the color value from the table directly, we need to always set the alpha to 0xFF. This matches MS behaviour (Custom cursors are a good testcase for this, since they are generated through an intermediate BMP step) 2005-09-20 Jordi Mas i Hernandez * bitmap.c: Fixes bug 76152 2005-09-19 Peter Dennis Bartok * graphics.c: Remove AA setting; fixes bug #76135. Needs to have a save restore of previous AA settings 2005-09-15 Jordi Mas i Hernandez * region.c: Speed ups CombineModeReplace mode and fixes setting Infite 2005-09-13 Jordi Mas i Hernandez * graphics.c: * gdip.h: - Fixes some default values - Fixes bug 76089 - GdipRestoreGraphics and GdipSaveGraphics save all the status - Fixes pixelOffsetMode setting 2005-09-13 Jordi Mas i Hernandez * region.c: Fixes region for combine (used in clipping) 2005-09-12 Jordi Mas i Hernandez * font.c: Fixes font creation and italic issues, death code * general.c: Fixes font creation and italic issues, death code * gdip.h: Fixes font creation and italic issues, death code 2005-09-09 Jordi Mas i Hernandez * graphics.c: Implements GdipFlush 2005-09-08 Peter Dennis Bartok * graphics.c: - MeasureOrDrawString: Fixed underline/strikethrough calculations - Removed old conditional code attempting to avoid cairo AA problems - Implemented setting/getting of AntiAlias variables - MeasureOrDrawString: Added code to handle font antialiasing options; still inoperative * gdip.h: Added fields to support antialias settings 2005-09-07 Jordi Mas i Hernandez * graphics.c: fixes cairo handles leaks * image.c: optimise and fix leaks 2005-09-06 Jordi Mas i Hernandez * graphics.c: Makes DrawString clipping not destroy previous clipping 2005-09-06 Jordi Mas i Hernandez * graphics.c: removes non-ansi comments or not longer need it * font.c: removes non-ansi comments or not longer need it * general.c: removes non-ansi comments or not longer need it * image.c: removes non-ansi comments or not longer need it * pen.c: removes non-ansi comments or not longer need it * gdip.h: removes non-ansi comments or not longer need it * lineargradientbrush.c: removes non-ansi comments or not longer need it 2005-09-06 Jordi Mas i Hernandez * graphics.c: Clipping support 2005-09-06 Jordi Mas i Hernandez * graphics.c: several fixes to rect/region clipping operations * region.c: fixes and include CombineModeReplace mode 2005-09-05 Jordi Mas i Hernandez * image.c: fixes return parameter and GdipLoadImageFromFileICM call * gdipImage.h: include GdipLoadImageFromFileICM definition * bitmap.c: new GDI calls * gdip.h: definitions 2005-08-26 Geoff Norton * graphics.c: Update the Quartz constructors for the new Cairo 1.0 API calls 2005-08-26 Jordi Mas i Hernandez * lineargradientbrush.c: fixes issues with angle 2005-08-26 Peter Dennis Bartok * hatchbrush.c: Wouldn't it be nice to clean the cairo stuff when destroying the brush 2005-08-26 Peter Dennis Bartok * image.c: Now scales/resizes images to destination rectangle * gdip.h: Removed gdip_cairo_set_surface_pattern() prototype * general.c: Removed gdip_cairo_set_surface_pattern() method, it's no longer used 2005-08-26 Peter Dennis Bartok * gdip.h, general.c: Removed gdip_cairo_set_surface_pattern_with_extend since it's no longer needed (replaced with less code directly in hatchbrush) 2005-08-26 Peter Dennis Bartok * hatchbrush.c: Fixed context leaks (We're also no longer abusing the passed cairo_t context as the pattern context) 2005-08-26 Peter Dennis Bartok * hatchbrush.c: Fixed 40% and plaid drawing, resolved ct corruption and nesting bugs 2005-08-26 Hisham Mardam Bey * hatchbrush.c: remove extra paint calls and fix cairo_save/restore calls. 2005-08-25 Peter Bartok * hatchbrush.c: Preventing 50% hatch brush ct from getting whacked (need to do all other styles as well) * lineargradientbrush.c: - Fixed missing initialization of brush matrix - Preventing cairo context from getting whacked 2005-08-25 Jordi Mas i Hernandez * image.c: fixes issues of images drawn on the wrong place 2005-08-25 Jordi Mas i Hernandez * graphics.c: - Fixes leaking on GdipDeleteGraphics - Fixes GdipGetDC bug exposed by Marek changes into graphics.cs 2005-08-25 Jordi Mas i Hernandez * hatchbrush.c: use correct enumerator for cairo calls * matrix.c: fixes GdipShearMatrix method 2005-08-25 Hisham Mardam Bey * hatchbrush.c: removed cairo_paint calls, we still have a few, must look into them. Fixed remaining cairo_paint and patter problems. * general.c: added gdip_cairo_set_surface_pattern_with_extend * gdip.h: added gdip_cairo_set_surface_pattern_with_extend 2005-08-24 Peter Bartok * hatchbrush.c: Fixed 50% hatchbrush drawing. Still need to fix all other 50 gazillion hatchbrushes :-( 2005-08-24 Peter Bartok * gdip.h: Removed prototypes for internal strikethrough and underline functions; those are no longer used * font.c: - Cairo switched to positive font descent number, fixed code to match - Removed unused methods for strikethrough and underline; drawstring handles that behaviour internally * graphics.c (DrawString): Cairo switched to positive descent values for font extents, switched the code to handle that 2005-08-24 Jordi Mas i Hernandez * graphics.c: fixes gcc 4 warning * general.c: from_cairoformat_to_content function * texturebrush.c: fixes texture brushes * matrix.c: * All the create function allocate the memory * Fixes GdipCloneMatrix function * Fixes GdipIsMatrixEqual * Fixes GdipIsMatrixInvertible (always returned true) * Fixes GdipGetMatrixElements (wrong order) 2005-08-24 Hisham Mardam Bey * pen.c : remove debugging printf. 2005-08-24 Jordi Mas i Hernandez * hatchbrush.c, lineargradientbrush.c. Cairo has changed the format enum parameter for cairo_surface_create_similar. This fixes many samples not running. 2005-08-23 Peter Bartok * graphics.c: The original CalculateStringWidths method was dependent on FT and internal knowledge of cairo font matrix behaviour, and the function broke with the newer cairo due to changes to this behaviour. Renamed the original to CalculateStringWidthsUTF8 and wrote a new method which uses cairo_text_extents to calculate character widths. This is somewhat slower but works font-backend independent. * general.c: Added ucs2 to utf8 char encoder and decoder (allows faster calculations than the malloc-dependent utf8 string functions) * gdip.h: Added prototypes for utf8 character functions 2005-08-22 Jordi Mas i Hernandez * region.c: fixes memory leaks * pen.c: releases the solid brush when is owned by us * gdip.h: releases the solid brush when is owned by us 2005-08-19 Zoltan Varga * gifcodec.c (gdip_save_gif_image_to_file): Fix compilation without GIF support. 2005-08-19 Jordi Mas i Hernandez * graphics.c: Standarize mem alloc/free with GdipAlloc/GdipFree * font.c: Standarize mem alloc/free with GdipAlloc/GdipFree * bmpcodec.c: Standarize mem alloc/free with GdipAlloc/GdipFree * general.c: Implement linked list to keep track of leaks * image.c: Standarize mem alloc/free with GdipAlloc/GdipFree * region.c: Standarize mem alloc/free with GdipAlloc/GdipFree * jpegcodec.c: Standarize mem alloc/free with GdipAlloc/GdipFree * imageattributes.c: Standarize mem alloc/free with GdipAlloc/GdipFree * gifcodec.c: Standarize mem alloc/free with GdipAlloc/GdipFree * texturebrush.c: Standarize mem alloc/free with GdipAlloc/GdipFree * bitmap.c: Standarize mem alloc/free with GdipAlloc/GdipFree * stringformat.c: Standarize mem alloc/free with GdipAlloc/GdipFree * pen.c: Standarize mem alloc/free with GdipAlloc/GdipFree * gdip.h: define GdipCalloc * graphics-path.c: Standarize mem alloc/free with GdipAlloc/GdipFree 2005-08-19 Jordi Mas i Hernandez * bmpcodec.c: fixes codec for 24 bits bmps. It passes the tests again. 2005-08-18 Jordi Mas i Hernandez * graphics.c: C ANSI language fixes * bmpcodec.c: C ANSI language fixes * general.c: C ANSI language fixes * tiffcodec.c: C ANSI language fixes * bitmap.c: C ANSI language fixes 2005-08-17 Jordi Mas i Hernandez * region.c: Rewritten region support 2005-08-10 Jordi Mas i Hernandez * region.c: Rewritten gdip_combine_intersect method 2005-08-09 Jordi Mas i Hernandez * region.c: Optimise union operation 2005-07-21 Duncan Mak * graphics.c (make_pie): Fix #75475. Use sweepAngle (instead of endAngle) when drawing the arcs. "The arc always starts at 0. For the fill method the effect is that a pie ending at 360 will fill the whole circle..." Patch from Patrick Michel . 2005-07-01 Jonathan Gilbert * bitmap.c: Fixed bug in GdipCreateBitmapFromScan0's default palette initialization. Corrected GdipBitmapGetPixel to permit the operation on indexed bitmaps (uses pixel streams :-). 2005-06-30 Peter Bartok * general.c (ucs2_to_utf8): Added argument to allow specifying the string length (to allow converting substrings) * graphics.c (MeasureOrDrawString, MeasureString): Fixed handling of Tabs, now properly advances to the next valid tab stop, if tabs are specified. * font.c, image.c: Changed usage of ucs2_to_utf8 to match new prototype * gdip.h: - Removed TabWidth from GpStringDetailStruct, was obsoleted by tab-redo - Changed prototype of ucs2_to_utf8(), added length argument 2005-06-21 Geoff Norton * graphics.c (GdipCreateFromQuartz_macosx): Set the size of the context in the bounds structure. Fixes #75326 2005-06-13 Peter Bartok * bitmap.c, image.c, gdip.h, bmpcodec.c, jpegcodec.c, tiffcodec.c, gifcodec.c, gifcodec.h, pngcodec.c, pngcodec.h: Re-applied two previous changes, since #75254 is now fixed 2005-06-13 Peter Bartok * Rolled back last two checkins, to r45601, pre palette patch, due to the regression caused with Icons (bug #75254) 2005-06-07 Geoff Norton * bmpcodec.c: * image.c: Fix some (un)signed mismatch issues so that gdiplus will compile on gcc 4.0 again with -Werror 2005-05-30 Jonathan Gilbert * bitmap.c: Added indexed pixel formats to gdip_is_a_supported_pixelformat(). * bitmap.c: Added gdip_is_an_indexed_pixelformat(). Added its prototype to gdip.h; not sure if this is the correct place. * bitmap.c: Added support for PixelFormat.Format4bppIndexed to GdipCreateBitmapFromScan0 (maps to CAIRO_FORMAT_A8, like PixelFormat.Format8bppIndexed). Palettes will be created as needed. Bitmaps with a 4bpp indexed pixel format will be given 256-entry ColorPalette structures, as the cairo_format indicates 8-bit data. * bitmap.c: GdipCreateBitmapFromScan0 now computes stride for indexed pixel formats differently, and does not convert indexed pixel formats to 32-bit RGB. It also makes images with 32-bit pixel formats initially black instead of initially transparent and fills the palette with the default values for 1-, 4- and 8-bpp indexed images. * bitmap.c: Added support for indexed images to gdip_bitmap_clone_data_rect(). * bitmap.c: Rewrote GdipBitmapLockBits () to be maintainable while supporting indexed pixel formats. Added gdip_can_window_without_copy (), gdip_is_a_32bit_pixelformat (), gdip_make_alpha_opaque () and gdip_is_an_alpha_pixelformat (). * bitmap.c: Moved gdip_from_ARGB_to_RGB () and gdip_from_RGB_to_ARGB () above gdip_bitmap_change_rect_pixel_format (), so that gdip_bitmap_change_rect_pixel_format () can call them. * bitmap.c: Added struct StreamingState and methods gdip_init_pixel_stream (), gdip_pixel_stream_has_next (), gdip_pixel_stream_get_next () and gdip_pixel_stream_set_next () to work with Bitmaps of various formats in an abstract way. gdip_pixel_stream_get_next () returns and gdip_pixel_stream_set_next () accepts 32-bit ARGB values for 15, 16, 24, 32, 48 and 64 bit formats and palette indices for 1, 4 and 8 bit formats. gdip_pixel_stream_get_next () and gdip_pixel_stream_set_next () cannot be mixed; call either one or the other on a given stream, but never both. * bitmap.c: Rewrote gdip_bitmap_change_rect_pixel_format to use pixel streams, which adds support for indexed pixel formats and increases maintainability. * bitmap.c: Added check to GdipBitmapSetPixel ensuring that the bitmap is not indexed (despite what MSDN says, in practice Microsoft's implementation rejects SetPixel on indexed Bitmaps). * bitmap.c: Added gdip_convert_indexed_to_rgb (), which will be used by the functions implementing DrawImage, since gdip_bitmap_ensure_surface () is not compatible with indexed image data. * image.c: Added support for indexed pixel formats in GdipDrawImageRect and GdipDrawImageRectRect. The support is for the image being drawn to be indexed, not the image being drawn on. :-) * image.c: Implemented GdipGetImagePalette (), GdipSetImagePalette () and GdipGetImagePaletteSize (). * bmpcodec.c: Corrected gdip_bitmap_fill_info_header ()'s interpretation of pixel bit widths. * bmpcodec.c: Added include directive for gdipImage.h, for utility function gdip_get_pixel_format_bpp (). * bmpcodec.c: Updated gdip_bitmap_save_bmp () to save the palette for indexed bitmaps. Also modified the save function to not swap bytes for indexed pixel formats on big-endian architectures. * bmpcodec.c: Updated gdip_read_bmp_image_from_file_stream () to maintain 1, 4 and 8 bpp indexed data instead of converting it on-the-fly to 32 bpp RGB data. * bmpcodec.c: Updated gdip_get_pixelformat () to translate a bit width of 1 into Format1bppIndexed. * bmpcodec.c: Added support for decoding 4- and 8-bit RLE bitmaps. * gifcodec.c: Updated gdip_save_gif_image () to support saving indexed images. Also, an off-by-one error in the 32-bit ARGB side of the encoder was corrected (the image was translated left one pixel). * jpegcodec.c: Updated gdip_save_jpeg_image_internal () to reject 8bpp indexed images that are not grayscale (the previous behaviour was to assume all 8bpp indexed images are grayscale). * tiffcodec.c: Updated gdip_save_tiff_image () to reject indexed images as NotImplemented, for now at least. * pngcodec.c: Updated gdip_load_png_image_from_file_or_stream () to handle 1-, 4- and 8-bit PNG files separately, without upsampling the data to 32-bit RBG. * gdip.h: Fixed the set_pixel_bgra () macro; a lack of parentheses and no cast down to 'unsigned char' was making expressions like set_pixel_bgra (&array[i], ...) fail to compile, and it wasn't a proper statement; it could not be used in a construct like "if (...) set_pixel_bgra(...); else ...;". 2005-05-25 Peter Bartok * graphics.c, font.c, image.c, general.c, gdip.h: Replaced UTF8/UTF16 conversion with UCS2/UTF8 conversion (The MS APIs do not use UTF16) 2005-05-24 Duncan Mak * graphics-path.c (append_arc): Append PathPointTypeLine instead of PathPointTypeStart, so that arcs will be joint properly. This fixes bug #75015. Thanks to Elliot Paquette for reporting and fixing this bug. 2005-05-24 Duncan Mak * graphics.c (make_pie, GdipDrawArc): * graphics-path.cs (GdipAddPathArc, GdipAddPathPie): Rewrote the code for calculating arcs: instead of drawing two arcs via a mid-point, draw multiple arcs at intervals of 90 degrees. This results in prettier arcs/pies and a better match to the output produced by MS. 2005-05-20 Duncan Mak * graphics-path.c (GdipAddPathArc): Added a special case for drawing ellipses, and remember to use abs() with 'sweepAngle' to ensure correctness when the angle is negative. This is basically a port of the previous commit. 2005-05-09 Duncan Mak * graphics.c (make_pie, GdipDrawArc): when evaluating angles, always use abs(). This fixes the drawing of arcs and pies when the sweep angle is negative. Bug #63360 has also been fixed. This was a bug reported by Ravindra in August '04 about a hang when "the difference between width and height of rectangle is 1 and angles sum is close to 360". My change doesn't affect this bug. #63360 didn't hang in libgdiplus 1.1.7 as is, so it was actually fixed by the Cairo guys. 2005-05-06 Jordi Mas i Hernandez * image.c: Only free memory blocks that are owned by us 2005-05-05 Jordi Mas i Hernandez * graphics.c: - Empty the region before working with it - Move printf into debug bloc * region.c: - Fixes infinite regions 2005-04-28 Jordi Mas i Hernandez * tiffcodec.c: Inits Byte and ByteCount to avoid releasing not allocated blocks GdipDisposeImage. Fixes testgdi.c test. 2005-04-27 Jordi Mas i Hernandez * graphics.c: - Set bounds when using a X Drawable - Fixes GdipGraphicsClear to make it work with X Drawables * gdip.h: define new function 2005-04-20 Jackson Harper * hatchbrush.c: Don't require that hatch brushes be created on a context with an attached bitmap. 2005-04-07 Neale Ferguson * gifcodec.c: Eliminate warning message and optimize breakdown of RGB field. 2005-03-30 Peter Bartok * font.c: Added locking for font cache * general.c: Grab DPIs on startup, avoid potential race condition with multiple threads using gdiplus and trying to get dpi 2005-03-29 Peter Bartok * bitmap.c: Removed set_pixel_bgra() and get_pixel_bgra() functions, re-made them as macros, since inlining only works for static functions * gdip.h: Added set/get_pixel_bgra macros; removed prototypes * imageattributes.c: Fixed code to work with set/get_pixel_bgra macros * bmpcodec.c: Added code to deal with the (wrong) assumption that Stream.Read will always return the number of bytes requested if the stream end has not been hit (related to bug #72588) 2005-03-22 Jordi Mas i Hernandez * image.c, bitmap.c: implement gdip_image_clone to copy Image structs properly and fix GdipCloneImage memory corruption problems. * gdip.h: inline set_pixel_bgra/get_pixel_bgra functions 2005-03-22 Jordi Mas i Hernandez * bmpcodec.c: - Fixes 24 bits bitmap loading - Fixes leaks when exiting on error conditions - Sets the img->image.pixFormat propertly - Sets bmfh.bfOffBits when saving *before* start using it * imageattributes.c - Implements colour matrix processing and GdipSetImageAttributesColorMatrix * bitmap.c: - Fixes stride calculation (was causing many problems) - Moves set_pixel_bgra into bitmap.c and creates get_pixel_bgra 2005-03-18 Peter Bartok * graphics.c: Instead of throwing NotImpl exception, we display a message that the function isn't implemented yet on the TransformPoints functions 2005-03-18 Peter Bartok * imageattributes.c: Instead of throwing NotImpl exception, we display a message that the function isn't implemented yet on the SetColorMatrix function 2005-03-18 Peter Bartok * graphics-path.c: Instead of throwing NotImpl exception, we display a message that the function isn't implemented yet on the Bounds functions 2005-03-18 Peter Bartok * gifcodec.c: Fixed prototype for no gif lib codepath; was missed with GCC4 changes 2005-03-17 Jordi Mas i Hernandez * pngcodec.c: fixes warnings for GCC4 * gdip.h: fixes warnings for GCC4 * graphics.c: fixes warnings for GCC4 * font.c: fixes warnings for GCC4 * bmpcodec.c: fixes warnings for GCC4 * image.c: fixes warnings for GCC4 * jpegcodec.c: fixes warnings for GCC4 * tiffcodec.c: fixes warnings for GCC4 * gifcodec.c: fixes warnings for GCC4 * texturebrush.c: fixes warnings for GCC4 * gifcodec.h: fixes warnings for GCC4 * bitmap.c: fixes warnings for GCC4 * pngcodec.c: fixes warnings for GCC4 2005-03-17 Peter Bartok * image.c (iGdipLoadImageFromDelegate_linux): Now calls GetHeader delegate for determining the image type, instead of GetBytes, to allow usage with non-seekable streams * gdipImage.h: Changed GdipLoadImageFromDelegate_linux() prototype to include the new StreamGetHeader method * gdip.h: Added definition for new GetHeader delegate 2005-03-15 Jordi Mas i Hernandez * graphics.c: Fixes GdipSetWorldTransform. We should copy the passed matrix not to point to it 2005-02-24 Jordi Mas i Hernandez * region.c: Fixes IsVisible methods 2005-02-22 AJ Frantz * bitmap.c: 64bit stride fixes. 2005-02-20 Peter Bartok * bitmap.c: More 64bit stride fixes * pngcodec.c: 64bit stride fixes 2005-02-20 Peter Bartok * gdip.h: Added pixman.h include to get pixman_bits_t * bitmap.c: Made stride calculations based on pixman_bits_t, to properly work on 64bit platforms as well 2005-02-19 Peter Bartok * graphics.c: - Setting the appropriate cairo operator when GdipSetCompositingMode is called. - Added (very hacked) GdipMeasureCharRanges() 2005-02-19 Geoff Norton * bitmap.c: (GdipBitmapSetPixel) Make this endian aware. 2005-02-18 Miguel de Icaza * graphics.c: Implement GdipGetCompositingMode, GdipSetCompositingMode, GdipGetCompositingQuality, GdipSetCompositingQuality: The quality ones dont do anything. * solidbrush.c: Setup the alpha channel, only if the composite mode is set to ComposintingModeSourceOver (the default) that does alpha blending. * pen.c (GdipGetPenEndCap, GdipSetPenEndCap): Avoid crashing, even if we dont do anything with them yet. 2005-02-16 Peter Bartok * bitmap.c (gdip_bitmap_clone_data_rect): Patch suggested by Scott Mohekey, preventing use of uninitialized variable 2005-02-16 Miguel de Icaza * bitmap.c: Handle the case where GdipAlloc returns NULL, propagate the error everywhere. 2005-02-10 Geoff Norton * general.c: Drop the last usage of GDIPLUS_NOX, if we can't open the display fall back to 96.0f (changed new default to 96 from 72) 2005-02-06 Geoff Norton * gifcodec.c: Fix a typo 2005-02-03 Jordi Mas i Hernandez * region.c: Call GdipSetInfinite for empty regions 2005-01-28 Peter Bartok * gdip.h, graphics.c: Switched hDC type from int to void. That's what MS has for them, and also, it is required to compile on 64bit platforms (fixes bug #71823) 2005-01-28 Geoff Norton * bmpcodec.c: Make this endian aware for saving bitmaps. 2005-01-28 Peter Bartok * pathgradientbrush.c (GdipMultiplyPathGradientTransform): Don't destroy the matrix we're about to destroy. Fixes bug introduced in r39075. Patch by Peter Johanson 2005-01-27 Geoff Norton * tiffcodec.c: Make this endian aware for image saving as well 2005-01-26 Peter Bartok * pngcodec.c (gdip_save_png_image_to_file_or_stream): Moved definition of variable into new block, to keep Ansi compilers happy, also helped readability by giving both Big and Little endian their own loop 2005-01-26 Geoff Norton * tiffcodec.c: Fix problem with file callback writer. 2005-01-26 Geoff Norton * pngcodec.c: jpegcodec.c: gifcodec.c: Make these write files properly on big endian machines 2005-01-26 Peter Bartok * bmpcodec.c: We convert all images to 32bit, no longer need the palette 2005-01-26 Geoff Norton * tiffcodec.c: Use the tiff callback functions to allow tiff reading to work on Mac. 2005-01-26 Geoff Norton * gifcodec.c: Use set_pixel_bgra so that big endian machines can load gif and have them look right. 2005-01-26 Geoff Norton * jpgcodec.c: Use set_pixel_bgra so that big endian machines can load jpgs and have them look right. 2005-01-26 Geoff Norton * bmpcodec.c: Move set_pixel_bgra to gdip.h * gdip.h: Add set_pixel_bgra * pngcodec.c: Use set_pixel_bgra so that big endian machines can load pngs and have them look right. 2005-01-26 Peter Bartok * bmpcodec.c: Since we 'upgrade' all bitmaps to 32bit, make sure we store the format as such, too 2005-01-26 Peter Bartok * bmpcodec.c: Implemented 32bit support; while no 32bit BMP files exist, we will generate those internally, to support icons and cursors 2005-01-26 Peter Bartok * bmpcodec.c: - Fixed generation of color tables (RGBA order) - Fixed monochrome image translation 2005-01-26 Geoff Norton * bmpcodec.c: Swap from RGBA to ABGR on big endian systems. 2005-01-26 Peter Bartok * bmpcodec.c: Fixed R/B swap mistake 2005-01-26 Peter Bartok * bmpcodec.c: Cleaner version, also a bit faster 2005-01-26 Peter Bartok * bmpcodec.c: Added ability to read 1, 4 and 8 bit images as well as 24 bit images, simplified readying by doing the read/assignment and RGB to ARGB in one go 2005-01-20 Peter Bartok * graphics.c: - Using new macro to deal with post 0.3.0 cairo changes in font APIs - Added Geoff Norton's changes for Mac OS X support * font.c: Using new macro to deal with post 0.3.0 cairo changes in font APIs * gdip.h: - Changes to match cairo 0.3.0 release - Added code for post 0.3.0 cairo support 2005-01-20 Jackson Harper * graphics.c: These are floats. 2005-01-17 Peter Bartok * graphics.c: * lineargradientbrush.c * lineargradientbrush.h: * pathgradientbrush.c: * matrix.c: * texturebrush.c: * texturebrush.h: * pen.c: * gdip.h: Another attempt at dealing with the cairo change making the cairo_matrix_t type internal. I gave Jackson some wrong info in the previous attempt. 2005-01-14 Jackson Harper * graphics.c: * lineargradientbrush.c * lineargradientbrush.h: * pathgradientbrush.c: * matrix.c: * texturebrush.c: * texturebrush.h: * pen.c: * gdip.h: Current cairo in cvs has made the cairo_matrix_t variable internal. These are updates to compile with current cairo, all the changes should work with older versions of cairo as well. 2005-01-14 Jackson Harper * gdip.h: Remove the hdc stuff that was used with wine. Add fields for the x display and drawable so that they can be used when creating a graphics object from an hdc. * graphics.c (GdipCreateFromHDC): Implement, just create a new graphics object and copy the drawable from the old one. * graphics.c (GdipCreateFromXDrawable_linux): Copy the display and drawable params to the graphics structure so they can be used in CreateFromHDC. 2005-01-07 Peter Bartok * graphics-path.c, hatchbrush.c: Applied patch submitted by andersb@blacksun.ca to compile with gcc2, fixes bug #65708 2005-01-07 Peter Bartok * image.c (GdipDrawImageRect): Start a new path before calling cairo_translate, it seems thats what other cairo apps do, and it fixes the problem Jackson reported, where images would not show after text was drawn 2005-01-07 Peter Bartok * font.c: replaced tempnam() with mkstemp() as requested by tempnam() documentation * general.c: Removed c++ - ism * gdip.h: Added unistd.h for functions used in font.c 2005-01-06 Miguel de Icaza * tiffcodec.c: Cast the third argument to thandle_t to supress errors on certain distros. Fixes 70456 2005-01-05 Peter Bartok * graphics.c (MeasureOrDrawString): If the string doesn't fit in the bounding box and no breaks are allowed or possible, the code will now not loop anymore. 2005-01-04 Peter Bartok * graphics.c (MeasureOrDrawString): Return 0 instead of InvalidParameter if the string being measured has zero length, this matches MS behaviour; also added earlier check for zero length to avoid utf conversion overhead. 2005-01-02 Jordi Mas * graphics.c, font.c, general.c, bmpcodec.h, image.c, region.c, jpegcodec.h, imageattributes.c, gdipImage.h, tiffcodec.h, gifcodec.h,bitmap.c, stringformat.c, pngcodec.h, Makefile.am, gdip.h: removes old Wine glue code * gdip_win32.c, gdip_win32.h: remove it 2004-12-30 Miguel de Icaza * bitmap.c (gdip_bitmap_clone): Also clone the ->Bytes array which is fileld in by gifcodec.c and image.c as well 2004-12-28 Zoltan Varga * graphics.c (CalculateStringWidths): Fix 64 bit issues. 2004-12-27 Zoltan Varga * gdip.h: Make the members of various structures the same size as their managed counterparts on 64 bit platforms. * gdip_win32.h: Do not define __stdcall under amd64. 2004-12-16 Peter Bartok * graphics.c: - GdipGetDC(): Removed Wine logic - GdipReleaseDC(): Removed Wine logic * font.c: - Removed CreateFontFromHDCorHfont (Wine specific) - GdipCreateFontFromDC(): Removed Wine logic - GdipCreateFontFromHfont(): Removed Wine logic - GdipGetLogFontA(): Removed Wine logic - Added non gdi+ GetFontMetrics call to support MWF, since DrawString/MeasureString do not support retrieving the ascent/descent of a font * gdip_win32.c: Removed references to Wine GetTextMetrics 2004-12-16 Peter Bartok * graphics.c (MeasureOrDrawstring): Removed extra padding calc 2004-12-07 Geoff Norton * graphics.c, gdip_win32.h, gdip.h: Initial support for the Quartz backend to cairo. 2004-11-29 Jordi Mas * image.c: fixes bug #69089 2004-11-18 Ravindra * graphics.c (GdipGraphicsClear): Save and restore the existing graphics settings. Otherwise, we lose the cached brush settings. 2004-11-11 Jordi Mas * gdip.h, font.c, general.c: implements font caching 2004-11-10 Peter Bartok * graphics.c (MeasureOrDrawString): Enabled clipping again, cairo appears to have the required fixes for it now. 2004-11-10 Peter Bartok * graphics.c (MeasureOrDrawString): Cleanup of earlier fix 2004-11-10 Peter Bartok * graphics.c (MeasureOrDrawString): Removed some unneeded cairo calls to improve performance; added comments 2004-11-10 Peter Bartok * general.c: - Removed _install_font_matrix(), now in graphics.c - Removed _gdip_cairo_matrix_compute_scale_factors(), now part of the new _install_font_matrix() - Removed gdip_utf8_to_glyphs(), now combined with CalculateStringWidths * graphics.c: - Renamed CalculateStringSize to CalculateStringWidths - Streamlined CalculateStringSize, combined with gdip_utf8_to_glyphs - Removed unused parts of gdip_utf8_to_glyphs() and CalculateStringSize - Dropped unneeded allocation of glyph memory * gdip.h: - Removed gdip_utf8_to_glyphs prototype 2004-11-09 Peter Bartok * graphics.c (MeasureOrDrawString): Added check to prevent crash if bogus data is returned from freetype. (MeasureOrDrawString): Instead of calling GdipFillRectangle we call cairo directly to draw underlines and strikeouts (GdipDrawLine): Jackson's matrix patch to align pixels and effectively avoid AA lines (GdipDrawRectangle): Same patch as for GdipDrawLine 2004-11-04 Miguel de Icaza * graphics.c (CalculateStringSize): Free leaked Glyphs. 2004-10-29 Jordi Mas * gdip.h, font.c: cache fontfamily details. Performance enhancement. 2004-11-05 Ravindra * graphics-path.c: Fixed int_to_float () function. We should not increase the pointer that is to be returned. 2004-10-29 Jordi Mas * font.c gdip.h gdip_win32.h gifcodec.c graphics.c matrix.c pathgradientbrush.c texturebrush.c tiffcodec.c: fixes issues with strict C compilers 2004-10-29 Jordi Mas * bitmap.c font.c graphics-path.c graphics.c image.c imageattributes.c lineargradientbrush.c stringformat.c: fixes issues with strict C compilers 2004-10-28 Miguel de Icaza * graphics.c (GdipSetClipRegion): Fix the test, it should test for either value being null. 2004-10-28 Ravindra * tiffcodec.c: We should not close the MemoryStreams that we got from user. 2004-10-28 Ravindra * bitmap.c: Fix for bug #68270. We need to initialize frames for images created from MemoryStreams as well. 2004-10-19 Jordi Mas * image.c: Speeds up GdipDrawImageRect arround 10% 2004-10-19 Jordi Mas * imageattributes.c: fixes alpha color setting 2004-10-19 Ravindra * jpegcodec.c: Fixed bug #68117. Retrieves the proper resolution info from Jpeg image. 2004-10-17 Jordi Mas * image.c: bug fix, restores pattern after image drawing 2004-10-09 Ravindra * hatchbrush.h: Added 'pattern' member of cairo_pattern_t type to GpHatch struct. * hatchbrush.c: Added support for caching. * lineargradientbrush.h: Removed the 'changed' member from GpLineGradient struct. It is moved to GpBrush struct. * lineargradientbrush.c: Added support for caching. * pathgradientbrush.h: Removed the 'changed' member from GpPathGradient struct. It is moved to GpBrush struct. * pathgradientbrush.c: Added support for caching. * texturebrush.h: Removed the 'changed' member from GpTexture struct. It is moved to GpBrush struct. * texturebrush.c: Added support for caching. 2004-10-09 Ravindra * solidbrush.h: Added color components A,R,G,B to SolidFill struct for caching. * solidbrush.c: Added support for caching. * pen.c: Added support for caching. 2004-10-09 Ravindra * gdip.h: Added 'last_pen' and 'last_brush' members to GpGraphics struct for caching. * brush.h: Added a boolean type 'changed' member to GpBrush. * brush.c: Added caching, to avoid multiple brush setups. * graphics.c: Initialization of cached pen and brush. Removed unwanted calls to cairo_save/cairo_restore. 2004-10-08 Ravindra * image.c: Fixed GdipDisposeImage function. 2004-10-05 Ravindra * pen.c: Fix for the bug #66665. Using a dirty bit on pen to avoid multiple setups has a flaw. It does not work well when we use the different pens with the same graphics. 2004-09-27 Mart Roosmaa * general.c: Fallback to 72 dpis if we can not determine this information. 2004-09-22 Ravindra * jpegcodec.c: Set proper image flags for JPEG colorspaces. 2004-09-22 Ravindra * jpegcodec.c: Added support for CMYK and YCCK colorspaces. Fixes bug #50081. 2004-09-16 Ravindra * gdip.h: Removed the redundant graphics member from GpImage struct. * bmpcodec.c: Removed the unnecessary usage of GpImage->graphics. * gifcodec.c: Same as above. * graphics.c: Same as above. * jpegcodec.c: Same as above. * pngcodec.c: Same as above. * tiffcodec.c: Same as above. * image.c: Same as above and removed some commented code. Fixed GdipGetImageDimensions and GdipImageGetFrameDimensionsList functions. Applied a fix from David Mitchell for bug #66055 in GdipGetImageGraphicsContext function. 2004-09-15 Ravindra * graphics.c: Applied a fix from David Mitchell for bug #65963 in GdipDeleteGraphics function. 2004-09-10 Ravindra * image.c: Fixes a bug in DrawImageRect function. Reset the matrix after drawing the image. 2004-08-21 Ravindra * gifcodec.c: Return UnknownImageFormat instead of NotImplemented when required libraries are not installed. * jpegcodec.c: Same. * pngcodec.c: Same. * tiffcodec.c: Same. 2004-08-17 Ravindra * font.c: Fix for bug #63098. 2004-08-05 Ravindra * font.c: Fixed GdipDeleteFont function. 2004-08-02 Ravindra * graphics.c: Commented out cairo_clip calls from GdipDrawString, as these were causing problems. Thanks to Peter for suggesting this fix. This fixes, bug #60386, #60663, #61414. These bugs were actually because of some problem with Cairo clipping. And, these are not reproducable with Cairo cvs, because Cairo seems to have some changes which have solved the problem with clipping in Cairo. Also, fixed gdip_plot_path function to handle path point types properly. 2004-07-30 Ravindra * font.c: Fixed GdipGetEmHeight function. 2004-07-30 Sanjay Gupta * tiffcodec.c: Added page no information while saving a multi page tiff file. 2004-07-27 Sanjay Gupta * tiffcodec.c: Fixing issues in saving multiple images to a file. 2004-07-26 Sanjay Gupta * image.c: Some memory management. 2004-07-26 Sanjay Gupta * bitmap.c: Initialization of data members in gdip_bitmap_init(). * gdip.h: Corrected casing in BitmapData structure. * gifcodec.c: Casing changes, because of change in gdip.h. 2004-07-23 Sanjay Gupta * tiffcodec.c: Corrected the sequence of writing information to tiff file. 2004-07-23 Ravindra * stringformat.c: Fixed GdipCloneStringFormat function and some formatting (replaced 8 spaces by tabs). 2004-07-22 Sanjay Gupta * gdip.h: Modified GdipBitmapData structure to hold information about position and graphic control extension for a gif frame. * bitmap.c: Modified gdip_bitmap_dispose (). * gifcodec.c: Corrected memory handling while saving frames to a gif file, implemented reading and writing Graphic Control Extension data and added a cool hack from Raja, which reduced size of our gif file. (30% saving in size on my sample file with new implementation). 2004-07-22 Ravindra * gdip.h: Added CharacterRange stuct. Added 'charRanges' and 'charRangeCount' members in GpStringFormat struct. Added function declarations for GdipMeasureCharacterRanges, GdipGetStringFormatMeasurableCharacterRangeCount and GdipSetStringFormatMeasurableCharacterRanges. * graphics.c: Added stub for GdipMeasureCharacterRanges. * stringformat.c: Implemented following two functions, 1. GdipGetStringFormatMeasurableCharacterRangeCount and 2. GdipSetStringFormatMeasurableCharacterRanges. Corrected default values for substitute and trimming in GdipStringFormatGetGenericDefault function. Corrected default value for substitute in GdipStringFormatGetGenericTypographic function. Also, Added null checks. 2004-07-22 Sanjay Gupta * tiffcodec.c: Implemented saving multiple pages of an image to a tif file. 2004-07-21 Ravindra * gdip.h: Added position members to GpPathIterator stuct. Added start_new_fig flag to GpPath struct. * graphics-path.c: Fixed and implemented various functions. Added null checks and some code formatting. Fixed: (append) (GdipClonePath) (GdipAddPathClosedCurve2) (GdipAddPathRectangle) (GdipAddPathRectangles) (GdipAddPathRectanglesI) (GdipAddPathEllipse) (GdipAddPathPath). Implemented: (GdipStartPathFigure) (GdipClosePathFigures). * graphics-pathiterator.c: Some fixes and implemented missing subpath functions. 2004-07-21 Sanjay Gupta * gifcodec.c: Minor modifications. 2004-07-20 Sanjay Gupta * gifcodec.c: Implemented saving multiple frames of an image to a gif file. 2004-07-16 Ravindra * Makefile.am: Added graphics-pathiterator.c to the sources list. * gdip.h: Corrected GpPathPointEnum and added GpPathIterator stuct. * graphics-path.c: Fixed GdipDeletePath, GdipResetPath, GdipSetPathMarker, GdipGetPathLastPoint, GdipAddPathLine and implemented GdipClosePathFigure and some formatting. * graphics-path.h: Added function declarations for graphics-path iterator. * graphics-pathiterator.c: First implementation. 2004-07-16 Sanjay Gupta * image.c: Resolved a crash which was occuring because of attempting to free same memory twice. 2004-07-14 Ravindra * adjustablearrowcap.c: Added a note. * customlinecap.c: Added a note. * brush.h: Moved common internal structs in here from lineargradientbrush.c. These will be used by pathgradientbrush also. * graphics-path.h: Corrected some function signatures. * graphics-path.c: Corrected some function signatures and return 'NotImplemented' status instead of 'Ok' in unimplemented functions. * lineargradientbrush.[ch]: Moved common internal structs from here to brush.h. And, some minor corrections. * pathgradientbrush.[ch]: Tested and fixed all the properties and implemented all the missing functions. Now, we are missing only the setup function and it can be done only after cairo supporting the required pattern for this brush. Also, corrected indentation. 2004-07-13 Sanjay Gupta * tifcodec.c: Implemented functionality to read all the frames present. 2004-07-12 Ravindra * gdip.h: Added 'interpolation' member in GpGraphics struct. Fixing bug #61400. * bitmap.c: Check for null before initializing the GpBitmap. * general.c: Added a helper function for converting an InterpolationMode value to cairo_filter_t. Fixing bug #61400. * graphics.c: Set the cairo filter on the surface as per the interpolation mode set. Fixed GdipSet/GetInterpolationMode functions. Fixing bug #61400. * image.c: Set the cairo filter on the surface as per the interpolation mode set. Fixing bug #61400. 2004-07-09 Ravindra * lineargradientbrush.c: Implemented GdipSetLineSigmaBlend function. * general.c: Added gdip_erf function used for setting sigma blend by gradient brushes. 2004-07-09 Sanjay Gupta * gdip.h: Modified FrameDimensionInfo structure to carry data related to various frames of a multi frame image. The structure is now renamed to FrameInfo. * gifcodec.c: Implemented functionality to read all the frames present. * image.c: Implemented SelectActiveFrame() method. Modified associated memory disallocation and changes while reading single frame image. 2004-07-07 Ravindra * pngcodec.c: Fixes saving RGB file and one perf improvement in image loading. Fixes bug #61156. 2004-06-29 Jordi Mas * pngcodec.c: fixes saving 24-bit images (it was saving corrupted files before) 2004-06-29 Jordi Mas * tiffcodec.c: fixes saving images to stream. It was giving an exception before 2004-06-25 Ravindra * lineargradientbrush.c: Couple of fixes and some missing bits. Also implemented GdipSetLineLinearBlend function. * pen.c: Changed return status of GdipSetCompoundArray to Ok. 2004-06-24 Ravindra * graphics.c: Modified GdipFillXXX operations to make use of the matrix set by brush setup. Also, moved all the GdipFillXXX functions to one place. 2004-06-24 Sanjay Gupta * gdip.h: Changed function signature for SeekDelegate function. * tiffcodec.c: Minor modification in passing flags to libtiff. 2004-06-23 Jordi Mas * gdip.h, graphics.c: Implement Get/Set Unit and Scale. We will need when we implement GdipTransformPoints 2004-06-23 Jordi Mas * image.c: fixes bug 60601, simple images where not drawn on the right place 2004-06-22 Ravindra * lineargradientbrush.h: Added two members 'changed' and 'pattern' to GpLineGradient struct to avoid unnecessary multiple brush setup. * lineargradientbrush.c: Changes related to above and some fixes. 2004-06-22 Jordi Mas * gdip.h, graphics.c: implement Clip API function calls * region.c: remove unused vars 2004-06-22 Ravindra * texturebrush.c: We need to reset the 'changed' flag after doing brush setup. 2006-06-21 Sanjay Gupta * tiffcodec.c: Added dummy functions and changed the way we were reading/writing tif image from/to stream. 2006-06-17 Sanjay Gupta * tiffcodec.c: ABGR 2 ARGB conversion while saving. Default tiff format of ARGB was converted to our local format ABGR while reading, but in write operation we were not converting back to ARGB format and hence messy image. 2004-06-17 Sanjay Gupta * image.c: Removed a commented line of code. Got checked in by mistake. 2004-06-16 Sanjay Gupta * gdipImage.h: Modifed function signature GdipSaveImageToDelegate_linux(). * image.c : Modified call to save tiff image from stream delgate. * tiffcodec.c, tiffcodec.h : Modified API signature and implemented functions to save tiff images to stream. 2004-06-16 Sanjay Gupta * tiffcodec.c, tiffcodec.h: Implemented methods for loading tiff images from stream. 2004-06-16 Ravindra * graphics.c: Removed unnecessary calls to cairo_save and cairo_restore from GdipFillXXX functions. 2004-06-15 Ravindra * texturebrush.h: Added two members 'changed & pattern' to GpTexture struct to avoid unnecessary texture setup. * texturebrush.c: Fixed the code to avoid the seam. Setup related enhancement. Replaced cairo_show_surface by cairo_fill for creating pattern. This was required to fix the problem with Graphics.DrawXXX, as DrawXXX functions stopped working for texturebrush because of transformation matrix fix in pen.c (my previous checkin). 2004-06-15 Sanjay Gupta * gdip.h: Added function typedefs, (*CloseDelegate), (*SizeDelegate). * gdipImage.h: Modifed function signature GdipLoadImageFromDelegate_linux(). * image.c : Modified call to load tiff image from stream delgate. * tiffcodec.c, tiffcodec.h : Modified API signature for loading tiff images from stream. 2004-06-14 Peter Bartok * general.c: Fixed internal cairo function name to be gdi specific. 2004-06-10 Sanjay Gupta * gifcodec.c: Minor error handling. * tiffcodec.c, tiffcodec.h: Added function stubs for loading and saving images from/to streams. Also modified API to include encoder parameter. * image.c: Minor indentation fixes, fixed incorrect image format assignment in loading images from stream, error handling and including call to load/save tiff images from stream. 2004-06-10 Jordi Mas * gifcodec.c: fixes the stubs signatures when libgif is not installed 2004-06-09 Jordi Mas * font.c, gdip.h: implemtents cache for generic family fonts, and properly keep track of resources and deallocate them. 2004-06-08 Ravindra * graphics.c: Added notes to GdipDrawXXX functions. * pen.c: We need to take into account the graphics->matrix also when stroking. Fixed the same. 2004-06-04 Ravindra * graphics.c: Fixed GdipDrawXXX functions as per the fix in pen.c. * pen.c: Added a flag to avoid multiple unnecessary setups of the same pen and fixed transform matrix usage. * gdip.h: Added a 'changed' bool type to GpPen struct. 2004-06-04 Sanjay Gupta * bitmap.c: Resolved issue with saving of 24 bit bmps. 2004-06-03 Ravindra * graphics.c: Fixed GdipDeleteGraphics and gdip_graphics_attach_bitmap functions. 2004-06-01 Ravindra * hatchbrush.c: Peformance improvements in some of diagonal hatch styles. These were quite slow earlier. 2004-05-31 Ravindra * graphics.c: Fixed GdipResetWorldTransform, GdipDrawPie and GdipFillPie. ResetWorldTransform should set the copy_of_ctm as well as the graphics->ct matrix to identity. Draw/FillPie functions do not do anything, if sweep angle is zero deg. This is done to fix the crash that we face when we draw/fill pie with zero deg sweep angle. And, some formatting. 2004-05-28 Duncan Mak * graphics.c (GdipResetWorldTransform): Remember to synchronize graphics->copy_of_ctm with the graphics' matrix. 2004-05-28 Ravindra * hatchbrush.c: Completed the remaining hatch styles. 2004-05-28 Jordi Mas * tiffcodec.c, image.c: added support for saving TIFF files 2004-05-28 Jordi Mas * bitmap.c, image.c, tiffcodec.c: reformmated using Mono code style. No code changes made 2004-05-28 Ravindra * gdip.h: Added declarations for GdipDrawRectangles, GdipDrawRectanglesI, GdipFillRectangleI, GdipFillRectangles, GdipFillRectanglesI functions for Graphics. * graphics.c: Implemented the functions mentioned above. Added g_return_val_if_fail macro. Did some of formatting. I have tested this, hope I'm not going to break anything. 2004-05-28 Ravindra * graphics.c: Changed DrawLinesI and DrawLines functions not to call DrawLineI and DrawLine respectively, as it results in setting up pen so many times unnecessarily. * hatchbrush.c: Formatting. 2004-05-27 Duncan Mak * matrix.c (set_translate, set_scale, set_rotate, set_shear): Removed, we are not allocating a new GpMatrix * anymore. (TranslateMatrix, ScaleMatrix, RotateMatrix, ShearMatrix): All the functionality of set_foo has been moved back into here. 2004-05-27 Miguel de Icaza * pen.c (gdip_pen_setup): Fix indentation, and do not set the pen matrix. The pen matrix trumps any other transformations on the graphics->ct, someone must fix this properly. * matrix.c: Remove some heavy use of routines with something lighter, Duncan will look at this further. 2004-05-27 Ravindra * hatchbrush.c: Implemented couple of hatch styles. 2004-05-27 Jordi Mas * pngcodec.c: added stubs for when libpng is not present 2004-05-27 Sanjay Gupta * bmpcodec.c: Added support for converting 24BPP to 32 BPP for usage by cairo, in function for loading bmp. 2004-05-27 Sanjay Gupta * bmpcodec.c: Abstracted reading bmp from file and stream to single function. * bmpcodec.h: Added function declarations for above implementation. 2004-05-27 Jordi Mas * bitmap.c: added support for drawing 24-bits images tru DrawImage 2004-05-27 Sanjay Gupta * bmpcodec.c: Fixes in function to save bmp to stream. 2004-05-26 Sanjay Gupta * bmpcodec.c: Implemented function to save bmp to stream. * bmpcodec.h: Added function declarations for above implementation. 2004-05-26 Sanjay Gupta * bmpcodec.c: Resolved issue with saving images to bmp format. 2004-05-26 Sanjay Gupta *image.c: Resolved issue with wrong comparison between image format guid and enocder clsid in GdipSaveImageToDelegate_linux() fn. 2004-05-26 Jordi Mas * gifcodec.c, gifcodec.h, image.c: implemented saving GIF images to file, stream and loading them from a stream. 2004-05-26 Ravindra * hatchbrush.c: Implemented Plaid and Wave hatch styles. 2004-05-26 Ravindra * hatchbrush.c: Implemented Sphere hatch style. 2004-05-26 Jordi Mas * bitmap.c, gdip.h: remove death code * gifcodec: no code changes made, reformmating to be able to work with it 2004-05-25 Jordi Mas * bitmap.c, gdip.h, image.c, imageattributes.c: - Implemented SetImageAttributesWrapMode: Tile, TileFlipY, TileFlipY and TileFlipXY - ImageAttributes fails to default category if nothing is setup - Minor bug fixes 2004-05-25 Jordi Mas * bitmap.c: fixes bug in gdip_bitmap_clone. We were not cloning the bitmap data itself 2004-05-24 Jordi Mas * bitmap.c, gdip.h, image.c, imageattributes.c: implemented functions for ImageAttributtes 2004-05-21 Ravindra * pen.c: We draw a line of a pixel width, if pen width is set to zero or less than zero. 2004-05-20 Ravindra * hatchbrush.c: Implemented SolidDiamond hatch style. * pen.c: Minor fix in GdipSetPenDashArray function. * gdip.h: Added a comment and inserted #ifndef around uglify typedefs. * gdip_win32.h: Removed the mono dependency uglify.h. It was also breaking the build. 2004-05-19 Miguel de Icaza * gdip.h: Removed the dependency on Mono for uglify.h by copying here all the required things from mono/io-layer/uglify.h. 2004-05-15 Vladimir Vukicevic * image.c, jpegcodec.c, jpegcodec.h, gdip.h: Add support for EncoderParameters. Currently, only jpeg Quality is exported (MS doesn't support any params for anything but Jpeg and Tiff) * image.c, gdip.h, gdipImage.h: Renamed some things which were clsid to format_guid to avoid confusion (they're not clsids) 2004-05-14 Peter Bartok * gdip.h: Added various missing structs and enumerations required for the new stubs. * bitmap.c: Removed warning; added missing stubs * font.c: Implemented GdipGetLogFontA, GdipPrivateAddMemoryFont * graphics.c: Implemented GdipSetInterpolationMode, GdipGetPageScale, GdipGetPageUnit; added missing stubs * imageattributes.c: Added missing stubs * image.c: Added missing stubs 2004-05-14 Duncan Mak * gdip.h (GpPathPointType): Make all the elements use hex values for consistency. * graphics-path.c (append): Handle the CloseSubpath flag. This is needed for SetPathMarker. * graphics-path.c (GdipClearPathMarkers, GdipSetPathMarker): Implemented. (GdipAddPathCurveI, GdipAddPathCurve2I, GdipAddPathCurve3I): Implemented. The float versions were committed a long time ago, but I forgot to do the same to the integer overrides. * graphics-path.c (GdipStartPathFigure, GdipClosePathFigure, GdipClosePathFigures) (GdipAddString, GdipWindingModeOutline): (GdipFlattenPath, GdipWidenPath, GdipWarpPath) (GdipGetPathWorldBounds, GdipIsVisiblePathPoint) (GdipIsOutlineVisiblePathPoint): Stubbed, they all now return Ok, but we have a MonoTODO comment to remind us to implement them. 2004-05-14 Jordi Mas * adjustablearrowcap.c ,customlinecap.c, gifcodec.c, graphics-path, hatchbrush.c, jpegcodec.c, lineargradientbrush.c, matrix.c, pathgradientbrush.c, pngcodec.c,texturebrush.c,tiffcodec.c: added missing licenses. 2004-05-14 Jordi Mas * bmpcodec.c, gifcodec.c, jpegcodec.c, pngcodec.c, tiffcodec.c: remove redudant CLSID definitions and use global definitions 2004-05-14 Ravindra * Makefile.am: Added source file entries for customlinecap and adjustablearrowcap. * pen.c: A minor fix in SetPenDashArray () function. 2004-05-14 Ravindra * adjustablearrowcap.c: First implementation of AdjustableArrowCap. 2004-05-14 Ravindra * customlinecap.[ch]: First implementation of CustomLineCap. It needs further work. I need to get it working with pen. 2004-05-14 Ravindra * gdip.h: Added missing functions for Pen. Added compound array to GpPen struct. Fixed some of Pen function signatures. Moved around few enums for compilation. Added typedefs and functions for CustomLineCap and AdjustableArrowCap. * pen.c: Added compound array functions. Fixed dash array functions and added stubs for custom linecaps. 2004-05-13 Jordi Mas * does a proper pixelformat check 2004-05-13 Ravindra * gdip.h: Added GpPenType enum and moved GpBrushType enum here from brush.h. Added GdipGetPenFillType function declaration. * brush.h: Moved GpBrushType enum to gdip.h. * pen.c: Implemented GdipGetPenFillType function. 2004-05-12 Peter Bartok * pngcodec: Since the code handles interlace just fine I removed the error condition for interlaced pictures; this fixes bug #55934 2004-05-12 Peter Bartok * font.c: Implemented GdipCreateFontFromDC 2004-05-12 Duncan Mak * gdip.h (GpCoordinateSpace): Defined. * graphics.c (GdipScaleWorldTransform): Implemented. (GdipSetWorldTransform): Fixed memory management bug pointed out by Vlad. 2004-05-12 Miguel de Icaza * image.c (GdipLoadImageFromFile): Added error checking in case the codec fails to load a valid image. 2004-05-12 Jordi Mas i Hernandez * bitmap.c, image.c, gdpi.h: - Correct support for Format24bppRgb, Format32bppArgb, Format32bppPArgb, Format32bppRgb pixel formats - Fixed GdipBitmapLockBits to return the format and behavior than GDI+ - GetPixel/SetPixel do not work when the bitmap is locked 2004-05-10 Peter Bartok * gdip_win32.c: Added ObjectList to manage Win32 object that can be deleted. Solves problem of asynchronous deletion of object when GC kicks in. While we could also use Control.BeginInvoke this method allows us to keep private gdip handles away from System.Drawing. Currently handles fonts but any other object that could be subject to GC should also be managed through the ObjectList code. * gdip.h: Added prototype * general.c: Shutdown code now also calls the new gdip_win32 shutdown function. 2004-05-10 Duncan Mak * gdip.h (fcmp): Added. * general.c (fcmp): Use the fcmp function from fcmp.sf.net. * graphics-path.c (append): Check for point count before calling GetPathLastPoint. Use fcmp instead of == when comparison floating point numbers. 2004-05-09 Peter Bartok * graphics.c: Completely rewrote DrawString and MeasureString: - No longer only works for us-ascii - Now handles multiple sequential linefeeds in DrawString - Now properly calculates the bounding box size - Now handles StringFormat flags (NoWrap, Vertical, Ellipsis) - Now properly breaks lines at whitespace or characters - Now properly handles tabstops - Now properly allows multiple hotkey characters * stringformat.c: Changed trimming default to TrimWord (like MS) * gdip.h: Fixed DrawString prototypes, replaced DrawString support structs 2004-05-09 Jordi Mas i Hernandez * bmpcodec.c: Move BMP specific functions to bmpcodec * bitmap.c: Move BMP specific functions to bmpcodec 2004-05-07 Ravindra * hatchbrush.c: Implemented 11 hatching styles. * texturebrush.c: Fixed destroy function. 2004-05-04 Jordi Mas i Hernandez * bmpcodec.c: We use always RGB32 internally * bitmap.c: We use always RGB32 internally * image.c: We use always RGB32 internally 2004-05-06 Sanjay Gupta * image.c: Removed a printf stmt. * gifcodec.c: Implemented reading information about time and page based frames. 2004-05-05 Peter Bartok * gdip_win32.c: Added support for SetMapMode; fixed fontsize conversion for Cairo->Wine fonts * font.c: Added call to SetMapMode to have predictable units for font size * gdip_win32.h: Added support for SetMapMode 2004-05-04 Jordi Mas i Hernandez * bitmap.c: calculate strides as GDI+ 2004-05-05 Sanjay Gupta * gdipImage.h: Added CLSID for FrameDimensions. * image.c: FrameDimensionsCount, FrameDimensionList and ImageFrameCount taken into consideration while loading image. * gifcodec.c: Corrected implementation of reading no of image description records present. 2004-05-04 Sanjay Gupta * image.c: Implemented functions GdipImageGetFrameDimensionsCount(), GdipImageGetFrameDimensionsList(), GdipImageGetFrameCount(). UNTESTED * gdip.h: Modifieid GpImage structure and added FrameDimensionInfo struct. * gifcodec.c: Modified to read the no of image description records present. 2004-05-04 Jordi Mas i Hernandez * image.c: implements GdipImageRotateFlip: 90, 180, 270, degree, plus FlipX and combinations 2004-05-04 Ravindra * matrix.c: Added macros for checking null pointers. 2004-05-04 Ravindra * pen.c: Added assert macros for checking null pointers. Also fixed Get/Set/Reset PenTransform functions. * graphics.c: Fixed a mistake in Clear function. Cairo takes color values in the range [0.0, 1.0], instead of [0, 255]. * gdip.h: Added return type to gdip_pen_setup function. * lineargradientbrush.[ch]: Fixed Get/Set LineTranform functions. * texturebrush.c: Fixed Get/Set TextureTransform functions. 2004-05-03 Jordi Mas i Hernandez * bitmap.c: adds Format32bppRgb support for get/set pixel * graphics.c: fixes bug 56798 (RTL support) 2004-05-03 Jordi Mas i Hernandez * bitmap.c: fixes stride in GdipCloneBitmapAreaI, copy of different pixel formats, uninit data in Bitmap struct, etc. 2004-04-30 Ravindra * lineargradientbrush.[ch]: Few fixes. 2004-04-30 Jordi Mas i Hernandez * region.c: fixes bug at GdipSetInfinite detected by the tests 2004-04-30 Jordi Mas i Hernandez * bitmap.c: fixes bug causing a cloned imaged not been able to save it. 2004-04-29 Duncan Mak * graphics-path.c (append): Moved the aforementioned logic into here instead; append_point should still just only delegate to append. 2004-04-29 Duncan Mak * graphics-path.c (append_point): Add some logic here. Don't append a move_to (PathPointTypeStart) if we're already at the point we need to be in. This fixes problems we have with filling, as Cairo closes all subpaths before a fill op. (GdipAddPathLine, GdipAddPathLineI): Removed precaution checks for move_to, we're doing it once and for all in append_point. This should fix the drawing bug Miguel sees in the GraphicsPath in the test form. 2004-04-29 Peter Bartok * gdip.h: Added flag for multiline strings * graphics.cs: Fixed bug #56800, DrawString now handles \n (and ignores \r, like Microsoft) 2004-04-29 Jordi Mas i Hernandez * image.c: fixes GdipSaveImageToFile using FormatID as parameter instead of the coded Clsid 2004-04-28 Jordi Mas i Hernandez * bmpcodec.c: added codecInfo * gdip_win32.h: added ImageCodecInfo struct * general.c: init codecinfo * gifcodec.c: added codecInfo * image.c: added GDI+ encoder/decoder functions * jpegcodec.c: added codecInfo * pngcodec.c: added codecInfo * tiffcodec.c: added codecInfo 2004-04-27 Ravindra * lineargradientbrush.[ch]: First implementation of lineargradientbrush. * Makefile.am: Added lineargradientbrush sources to the list. 2004-04-27 Vladimir Vukicevic * gdip.h: Added EncoderParameterValueType enum * image.c (GdipDrawImageRectRect, GdipDrawImagePoints): implemented. (gdip_encoder_parameter_search_int): start of some encoder parameter stuff 2004-04-26 Duncan Mak * general.c (gdip_open_curve_tangents): (gdip_closed_curve_tangents): Simplified. Use only one coefficient, instead of a set of coefficients per each point on the curve. We now take care of tension when calculating tangents. (gdip_calculate_coefficients): Removed. Microsoft doesn't use such a nice way of calculating coefficients. Their implementation is a lot more simplistic. Thanks to Professor Rasala for figuring this out. * graphics.c (GdipDrawClosedCurve2, GdipDrawCurve3) (GdipFillClosedCurve2): Add tension paramater. * graphics-path.c (GdipAddPathCurve3): Implemented. (GdipAddPathCurve, GdipAddPathCurve2): Pass the work onto GdipAddPathCurve3. * gdip.h (gdip_closed_curve_tangents, gdip_open_curve_tangents): Updated function signature to include tension. 2004-04-26 Sanjay Gupta * image.c: Implemented function GdipGetImageRawFormat. * gdip.h: Modifieid GdipImage structure and added ImageFormat enum from gdipImage.h * gdipImage.h: Removed ImageFormat enum to gdip.h 2004-04-25 Vladimir Vukicevic * graphics.c (GdipCreateFromXDrawable_linux): added method, so that we can interface with Gtk (i.e. to draw to a DrawingArea) 2004-04-24 Ravindra * graphics.c: Fixed GdipGraphicsClear() function. * gdip.h: Removed some unwanted lines. 2004-04-23 Vladimir Vukicevic * bitmap.c (GdipCloneBitmapAreaI): wrong sense of assert test, oops * image.c (GdipDrawImagePoints): implemented. 2004-04-23 Peter Bartok * graphics.c: Fixed bug #57551. Hotkey prefix now properly placed no matter on what line it is or how the text is aligned. 2004-04-23 Peter Bartok * graphics.c: Implemented GdipCreateFromHWND() 2004-04-22 Vladimir Vukicevic * bitmap.c (GdipCloneBitmapAreaI): implemented with format conversion * image.c (GdipDrawImageRect): use gdip_bitmap_ensure_surface to create a surface if it's missing. Fixes 57323 * bitmap.c (gdip_bitmap_ensure_surface): added as a way to access a bitmap image's surface, creating it if it's missing 2004-04-21 Peter Bartok * font.c: Added private GdipCreateFontFromHfont function to support the System.Drawing.Font.FromHfont method. * gdip_win32.c: Added import of Wine GetTextMetrics and GetTextName functions * gdip_win32.h: Added some prototypes and LOGFONTA and TEXTMETRICA structures 2004-04-19 Sanjay Gupta * image.c: Added function call to load bmp image from stream in switch case stmt. 2004-04-20 Jordi Mas i Hernandez * region.c - more work on regions. New methods, fixes, and funtionality * graphics.c - Fixed font bug * gdip.h - new region functions 2004-04-19 Vladimir Vukicevic * graphics-path.c (GdipAddPathStringI): renamed GdipPathString -> GdipAddPathString (the real name); still NotImplemented * bitmap.c: Implemented new LockBits/UnlockBits that's consistent with MS semantics, and that can do conversions. (Also some random whitespace cleanup, mainly as I touched functions.) * gdip.h: Some ARGB access macros, also a cleanup of the PixelFormat enum (there is a method to the madness). Some missing prototypes also. * image.c: Got rid of unused gdip_getpixel_formatsize (it can be inferred from the pixel format). * pathgradientbrush.c: Sets the cairo rgb color to the center color of the gradient. Not pretty, but better than nothing. * Makefile.am: Added -Wall -Wno-unused -Wno-format. Lots of functions that should have been returning values weren't, functions used without prototypes, etc. Touched files to fix missing return issues: bmpcodec.c, brush.h, font.c, gdip_win32.h, general.c, graphics.c, hatchbrush.c, imageattributes.c, 2004-04-19 Sanjay Gupta * bmpcodec.c: Fixed function for loading image from stream 2004-04-16 Jordi Mas i Hernandez * region.c - more work on regions. New methods, fixes, and funtionality * graphics.c - GdipFillRegion implemented 2004-04-16 Ravindra * gdip.h: Included glib.h. * brush.h, solidbrush.h: Removed internal functions and added return type to vtable functions. * brush.c: Now we return status from internal functions also. * texturebrush.c, hatchbrush.c, solidbrush.c, pathgradientbrush.c: Now we return status from internal functions also and do check for null pointers. 2004-04-16 Sanjay Gupta * bmpcodec.c: Implemented function for loading image from stream 2004-04-15 Ravindra * general.c (gdip_cairo_set_surface_pattern): Check for null pattern and return the status. * gdip.h (gdip_cairo_set_surface_pattern): Return status. 2004-04-15 Ravindra * hatchbrush.h: Moved internal functions to hatchbrush.c. * hatchbrush.c: Moved some internal functions around. 2004-04-15 Ravindra * texturebrush.h: Moved internal functions to texturebrush.c. * texturebrush.c: Few fixes to handle scale/rotate functions. But, we still don't get scaling/rotation right. Seems to be some problem with Cairo. Checking in code now, will see this later when I'm sure that Cairo is doing right. 2004-04-14 Jordi Mas i Hernandez * bitmap.c - fixes biXPelsPerMeter fields * bmpcodec.c - fixes strides, fixes new WinNT BMP headers, support for OS/2 bitmaps, 8 and 24 bits, upside bitmaps, gets different pixelformats correct loading/saving, reformatted to 8 tabs, support for load/save palette if present (RGBTRIPLE and SQUADS), fixes bitmap writting to allow to work with more tools (saving it upside down), etc. 2004-04-14 Duncan Mak * graphics-path.c (GdipAddPathLine, GdipAddPathLineI): Only append a starting point if the current point is not the same as the point we're appending. This removes unnecessary subpaths, and fixes GdipFillPath. 2004-04-13 Vladimir Vukicevic * jpegcodec.c (gdip_save_jpeg_image_internal): Check for pixformat equal to Format24bppRgb, not 32bpp when deciding whether to do argb conversion. Fixes #56967. * texturebrush.h: Moved WrapMode enum to gdip.h, to share it with the pgbrush * general.c (gdip_rect_expand_by): Helper function to build bounding rects * gdip.h: Bunch of new prototypes * pathgradientbrush.c: Stub implementations of this. Real version will probably require me to add gouraud triangle shading to cairo, which will happen Real Soon Now. 2004-04-12 Vladimir Vukicevic * gdip.h, image.c: I misread the *I methods. Implement them correctly, keeping the corrent int/float distinction. Also added a bunch of GdipDrawImage* stubs. 2004-04-11 Vladimir Vukicevic * general.c (GdiplusStartup): I really meant $GDIPLUS_NOX to mean "no X" instead of "require X". * texturebrush.c, image.c: Use gdip_cairo_set_surface_pattern * general.c: (gdip_cairo_set_surface_pattern) helper function to create a new pattern from a surface and set it. (GdiplusStartup): Don't acquire an X display if GDIPLUS_NOX is set (gdip_get_display_dpi): use GDIP_display instead of creating a new XDisplay 2004-04-10 Vladimir Vukicevic * gdip.h, graphics.c: Added lots of Get/Set stuffs. 2004-04-12 Ravindra * texturebrush.h: Internal functions should not appear here. Removed internal functions. Uncommented few implemented functions. * texturebrush.c: Moved around few functions as per the change in header file. 2004-04-11 Peter Bartok * gdip_win32.c: Added fontsize translation when creating HFONT * font.c: Added private function to retrieve the HFONT handle 2004-04-10 Vladimir Vukicevic * image.c (GdipDrawImageRectI): put back version that handles scaling correctly and doesn't create an extra graphics context unnecessarily. * graphics.c (gdip_graphics_attach_bitmap): set the surface on a GpBitmap after setting it as the cairo target; each GpBitmap should always have an associated cairo surface. (fixes #56803) * image.c (gdip_image_init): can't call get_display_dpi(), because we might not have an X display at all. 2004-04-10 Peter Bartok * bitmap.c: Removed the hack that set the Win32 bitmap to white. Instead it now simulates alpha blending and merges the Win32 bitmap onto the cairo image surface. This makes drawing between cairo and Wine/Win32 fully compatible, albeit with two drawbacks: First, the copying of the bitmap is done pixel by pixel, and second, the color value of UNALTERED_PIXEL in a Win32 bitmap will be treated as transparent. * image.c: Removed the 'improved' GdipDrawImageRectI function. I lost a whole day tracking down why SWF stopped working. The 'improved' version doesn't seem to work (yet). Left the broken version with an #if 0 for future fixing. * gdip_win32.c: Added functions to create/delete HFONT handles tracking the cairo fonts. * gdip_win32.h: Added prototypes * font.c: Now also creates/deletes Wine font tracking the cairo font * gdip.h: Added HFONT element to GpFont structure 2004-04-10 Duncan Mak * graphics.c (GdipDrawCurve): (GdipDrawClosedCurve, GdipFillClosedCurve): Added all the overloads, properly delegate the work to avoid code duplication. Handle the case when tension = 0; in that case, we draw/fill a polygon for closed curves, and just draw straight lines for open curves. (GdipDrawCurve3): Fixed signature, there was a missing offset argument. * gdip.h: Added open and closed curve drawing and filling functions. 2004-04-10 Duncan Mak * general.c (gdip_open_curve_tangents): Fixed some more errors in the porting of the algorithm. We should be passing Z to gdip_calculate_coefficients instead of count. Z = 2 * count - 1. 2004-04-10 Duncan Mak * graphics.c (GdipDrawCurve): Doh! Use the ask for tangents for open curves, not closed curves. * graphics-path.c (GdipResetPath): Don't set them to NULL. That wouldn't work, doofus. * graphics.c (GdipDrawCurve2I): Fixed function signature and use convert_points to pass the work onto GdipDrawCurve2. (GdipDrawCurve3I): Fixed function signature. * general.c (gdip_open_curve_tangents): Fix typo. 2004-04-09 Peter Bartok * Makefile.am: Added region.c to list of sourcefiles 2004-04-09 Jordi Mas i Hernandez * region.c - fixes to regions 2004-04-09 Duncan Mak * graphics-path.c (append_curve): Moved it to the top along with the other append helper functions. (GdipAddPathCurve, GdipAddPathCurveI): Implemented using gdip_open_curve_tangents. (GdipAddString): Fixed signature. * general.c (gdip_open_curve_tangents): Implemented.o (gdip_closed_curve_tangents): Fixed memory leak here. * gdip.h (gdip_open_curve_tangents): Add here. To be shared between graphics.c and graphics-path.c. 2004-04-08 Jordi Mas i Hernandez * region.c - Started regions implementation * gdip.h - signature changes 2004-04-07 Ravindra * texturebrush.[ch]: Added the missing functionality of clipping a rectangle out of image provided. 2004-04-06 Vladimir Vukicevic * jpegcodec.c (gdip_save_jpeg_image_internal): remove stray JCS_GRAYSCALE setting, which was generating very bizzare images. * jpegcodec.c, pngcodec.c: Allow reading/writing non-RGBA data. The GpBitmap.data struct holds cairo-compatible data (always 32bpp RGBA), whereas the GpImage.pixFormat field holds what this data is actually supposed to be (i.e. grayscale). Still no support for colormapped images. 2004-04-07 Duncan Mak * graphics.c (make_pie): Retort to make_ellipse *after* drawing the line. 2004-04-06 Vladimir Vukicevic * jpegcodec.c (gdip_save_jpeg_image_internal): implement jpeg saving, both files and streams. Format options are ignored for now. * image.c (GdipSaveImageToFile, (GdipSaveImageToDelegate_linux): add JPEG * image.c (gdip_get_pixel_format_components): added function * jpegcodec.c (gdip_load_jpeg_image_internal): add missing jpeg_destroy_decompress() 2004-04-06 Duncan Mak * graphics.c (make_arc): Just follow what I did with GraphicsPath and use a boolean flag instead of doing FP comparison. It's not worth it. 2004-04-06 Vladimir Vukicevic * gdip.h: Added stream handling delegate prototypes, and some missing function protos * gdipImage.h: stream delegate loading/saving functions * image.c: stream loading/saving bits, implemented via linux-specific delegates. Added guids for various file formats, and a gdip_image_format_for_clsid() helper function * jpegcodec.c: supports reading from a stream * pngcodec.c: supports writing; also supports reading/writing with a stream * image.c: blit surface directly for painting images, instead of creating a graphics context for it first * gifcodec.c, jpegcodec.c, pngcodec.c, tifcodec.c: Write data with the correct flags and resolution bits, to (almost) match what win32 outputs 2004-04-04 Vladimir Vukicevic * gifcodec.c, tiffcodec.c, pngcodec.c: include config.h, which actually enables this code.. so that the glaring bugs as a result of it never having been compiled before can be fixed. *cough* * image.c (GdipDrawImageRectI): do correct scaling if source and dest width/height don't match. (GdipLoadImageFromFile): fseek back to the start before passing to the loader. 2004-04-04 Vladimir Vukicevic * image.c: Changed loader calls to use correct load prototypes * pngcodec.c, gifcodec.c: Implemented png and gif loading * gdip.h: Changed ColorPalette to match GDI+; Entries is part of the allocated struct, not a separate pointer. Also added some ARGB convenience macros. * bmpcodec.c, bmpcodec.h: Updated load prototypes to match usage 2004-04-04 Vladimir Vukicevic * src/image.c, src/gdip.h: Added GdipDrawImage/DrawImageRect * src/jpegcodec.c, src/tiffcodec.c: Implemented loading jpeg and tiff images. Need to test these out on windows, to see exactly what formats stuff gets retruned in, but I think we should be ok for the most common cases. No file saving yet. * src/bmpcodec.c, src/gifcodec.c, src/pngcodec.c: Remove calls to bogus (and undefined) gdip_image_new() 2004-04-04 Duncan Mak * graphics.c (make_curve): Renamed from gdip_make_closed_curve. Added a new _CurveType argument. (convert_points): Moved to general.c, as it's used in graphics-path.c as well. * graphics-path.c (append_curve): Add a _CurveType argument. Renamed from gdip_append_closed_curve for consistency. (GdipAddPathClosedCurve2I): Hook it up. * general.c (convert_points): Moved here from graphics.c (gdip_open_curve_tangents): Declare here. No code yet, need to investigate end tangents. * gdip.h (_CurveType): New (private) enum for distinguishing open and close curves. 2004-04-04 Duncan Mak * graphics-path.c (append_arc): Added a new boolean argument. to determine if we're continuing an existing curve. 2004-04-04 Duncan Mak * graphics.c (make_arc): Only call move_to when we're not already at that point. This fixes FillPie, as cairo_fill implicitly closes all subpaths before filling. The extraneous move_to call earlier was causing Cairo to close early. (make_pie): Removed the debug messages. 2004-04-02 Duncan Mak * graphics.c (make_pie, GdipDrawArc): If the delta is greater than or equal to 360 degrees, then we're effectively drawing an ellipse, so make it do so. 2004-04-02 Duncan Mak * graphics.c (GdipFillPieI, GdipDrawPieI): Instead of having another copy of the code, just use the float equivalent. (GdipDrawPie): Add restore/save pair. (make_pie): This is broken right now. Added some debugging messages. 2004-04-01 Duncan Mak * graphics.c (GdipFillClosedCurve, GdipFillClosedCurveI): Implemented. 2004-04-02 Ravindra * texturebrush.c: Implemented TileFlipXY wrapmode. 2004-04-01 Duncan Mak * graphics.c (convert_points): New helper function to turn a list of GpPoints into GpPointFs. (GdipDrawClosedCurveI): Implemented using convert_points, then just call GdipDrawClosedCurve. 2004-04-01 Duncan Mak Implemented drawing ClosedCurves in Graphics and GraphicsPath. These functions are implemented with the help of Prof. Rasala at Northeastern University. The algorithm is described in: Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584. Remaining TODO: Finish open curves and consider tension. * graphics.c (gdip_make_closed_curve): Translates vertices and tangents for cairo_curve_to. (GdipDrawClosedCurve): Implemented. * graphics-path.c (gdip_append_closed_curve): Translates vertices and tangents into append_bezier. (GdipAddPathClosedCurve2): Implemented. 2004-04-01 Duncan Mak * gdip.h: Added the new functions for calculating tangents. (CURVE_MIN_TERMS, CURVE_MAX_TERMS): Constants used in tangent calculations. * general.c (gdip_calculate_coefficients) (gdip_closed_curve_tangents): Two helper functions for drawing closed curves. 2004-03-30 Sanjay Gupta *pngcodec.c Implemented one more method. *gdip.h Modified ColorPalette structure. 2004-03-31 Sachin Kumar * Makefile.am: Updated file to make it work for 'make distcheck'. 2004-03-30 Jordi Mas i Hernandez * image.c - GdipGetImageBounds and fixes * bitmap.c - keep the witdh, height and pixel format in sync with the image struct 2004-03-30 Sanjay Gupta *pngcodec.c Added crc check *pngcodec.h Added crc check 2004-03-28 Sanjay Gupta * pngcodec.c implementing png encoder * pngcodec.h implementing png encoder 2004-03-26 Duncan Mak * graphics.c: Prepare for the Curve and CloseCurve work by stubbing out some functions. * graphics.c (gdip_plot_path): Fixed the handling of paths containing PathPointTypeBezier points. Previously, we were resetting the index to zero at the head of each loop, so we were never drawing Bezier curves correctly. Also, we need to draw the curve immediately once we've stored 3 points, instead of waiting till the next iteration (which may never come). This is an off-by-one error. * graphics-path.c (append_arc): Use floats instead of ints to hold the center points, use doubles to hold the trig points. 2004-03-26 Jordi Mas i Hernandez * image.c - dpis and parameter checking 2004-03-26 Ravindra * texturebrush.c: Implemented TileFlipY wrapmode and fixed TileFlipX wrapmode. 2004-03-26 Duncan Mak * graphics-path.c: Port the changes made to graphics here. (append_arc): New function, modeled after make_arc for appending arcs (a set of Bezier points) to the Path. (GdipAddPathArc): Calculate the middle angle correctly and call append_arc. (GdipAddPathPie): Removed duplication, call append_arc appropriately. 2004-03-26 Duncan Mak * graphics.c (make_arc): Use the end angle instead of the sweep angle. Previously, the code was misbehaving because I used the sweep angle as the end angle. (make_pie, DrawArc): Determine the middle angle correctly in cases where the delta > 180. Even though this sounds simple, it took a long time for me to figure out. (make_pie): Simplifed things a bit. Instead of replicating most of the arc-drawing algorithm here, use of make_arc instead. This reduced some of the duplicates in the code. (DrawArcI): I'm tired on maintaining so many copies of the same code, so just call DrawArc now. With this patch, we should be drawing Arcs and Pies correctly. 2004-03-25 Ravindra * texturebrush.[ch]: Fixing texture brush. Still needs some work. 2004-03-24 Jordi Mas i Hernandez * imageattributes.c - created and first methods 2004-03-23 Peter Bartok * gdip_win32.h: Added definitions for Wine X11DRV_ExtEscape function; removed definition and reference to internal wine structures * gdip_win32.c: Added import of X11DRV_ExtEscape to allow pulling the X11 Drawable without knowledge of internal structures * graphics.c: Now uses the X11DRV_ExtEscape function to retrieve the drawable from Wine * general.c: Made x11drvHandle accessible for other source files (needed for X11DRV_ExtEscape) 2004-03-23 Ravindra * gdip.h: Changed file format to Unix. 2004-03-22 Jordi Mas i Hernandez * graphics.c: added GdipFillPieI and GdipFillPie 2004-03-22 Sanjay Gupta * gdip.h: Typo error * gdipImage.h: Fixed issue because of typo * image.c: Fixed issue because of typo 2004-03-21 Sanjay Gupta * Makefile.am: Included codec files. * gdip.h: Added few structure definitions. * gdipImage.h: Included codecs .h files. * image.c: Work on codecs. 2004-03-18 Miguel de Icaza * graphics.c (GdipDrawString): Fixed what looked like a typo X and Y. (GdipFillPath): Implement this routine. Factor code into gdip_plot_path. Stub out a few more routines to avoid crashes when running. 2004-03-18 Peter Bartok * pen.c: Fixed leak and bug that returned wrong pointer for dash array 2004-03-15 Jordi Mas i Hernandez * graphics.c - Bug fixing, suport for hotkeys, code reoganisation * stringformat.c - string format tab support 2004-03-11 Peter Bartok * bitmap.c: Added temporary hack to always initialize the bitmap scan (pixel) data (for SWF) 2004-03-10 Ravindra * hatchbrush.c: Coding style fixes. 2004-03-10 Ravindra * hatchbrush.h: Modified few internal function signatures. * hatchbrush.c: Implemented couple of hatching styles. 2004-01-10 Alexandre Pigolkine * bitmap.c * gdip.h GdipBitmapData struct. Memory ownership stored in Reserved field * general.c small fix 2004-03-08 Ravindra * hatchbrush.c: Implemented cross hatch style. * hatchbrush.h: Modified a function signature. 2004-03-08 Ravindra * solidbrush.c: cairo_set_rgb_color bug fix. * hatchbrush.c: cairo_set_rgb_color bug fix. 2004-03-07 Sanjay Gupta * gdip.h: Included ImageFlag enum and moved certain enums from gdipImage.h * gdipImage.h: Moved few enums to gdip.h * image.c: Implemented few functions 2004-03-06 Ravindra * pen.c: Indentation. * solidbrush.c: Coding style. * hatchbrush.c: Coding style and removed printf. 2004-03-05 Duncan Mak * graphics-path.c (GdipAddPathPath): Fix index, it should be 0, not 1. (GdipAddPathPolygon): Add a line back to the starting point to complete the polygon if the first and last points are not the same. 2004-03-04 Duncan Mak * graphics-path.c (GdipAddPathPath): Implemented. 2004-03-04 Jordi Mas i Hernandez * stringformat.c - DigitSubstitution and TabStob methods 2004-03-03 Miguel de Icaza * gdip_win32.c (_load_gdi32, _load_user32): Use the _WINE_SHAREDLIB_PATH environment variable to locate our dynamic libraries. * general.c (_load_x11drv): Load the library from the special location provided by the Wine init function. 2004-03-03 Jordi Mas i Hernandez * stringformat.c - coding style 2004-03-02 Jordi Mas i Hernandez * graphics.c - Implemented font strikeout and underline * font.c - Implemented font strikeout and underline, allows multiple attributes 2004-03-01 Sanjay Gupta * bitmap.c: Access modification in Get/Set Pixel() 2004-02-29 Ravindra * hatchbrush.c: Implemented four vertical hatching styles and did few comment improvements. 2004-02-28 Miguel de Icaza * font.c: Coding style, ANSI-C-ification * Makefile.am: Add -ansi, -pedantic and -Werror, to keep this clean. * bitmap.c (GdipBitmapSetPixel): Optimize SetPixel, remove non-ANSI-isms. * region.c: Ansi C again. * hatchbrush.c: ANSI C again. * graphics.c: Clean up the mess in this file: Turn into ANSI C: No // for comments; No variable declarations in the middle of a file. Fix the coding style (spacing, indentation). 2004-02-28 Sanjay Gupta * bitmap.c: Implemented GetPixel and SetPixel method. * gdip.h: Added declaration for GetPixel and SetPixel method. * gdipImage.h: Removed typedef for ARGB 2004-02-27 Ravindra * hatchbrush.c: First implementation. Implementing only four hatching styles as of now. More to be added. * hatchbruush.h: Defines hatch struct, hatchstyle enum and also declaration for hatch brush functions. * Makefile.am: Added hatchbruch.[ch] to sources. 2004-02-26 Ravindra * graphics.c: Added cairo_save () and cairo_restore () function calls in Draw and Fill functions. 2004-02-25 Jordi Mas i Hernandez * StringFormat.c - new methods * Font.c - PrivateFontCollection methods 2004-02-24 Jordi Mas i Hernandez * font.c - added metrics for font families 2004-02-23 Jordi Mas i Hernandez * graphics.c - added GdipMeasureString 2004-02-22 Ravindra * texturebrush.c: First implementation. Needs some fixing. * texturebrush.h: Defines texture struct, wrapmode enum and also declaration for texture functions. * Makefile.am: Added texturebruch.[ch] to sources. 2004-02-21 Sanjay Gupta * gdip.h: Added typedef for UINT * Image.h: Added function stubs for image functions * gdipImage.h: Added new file containing image function declaration 2004-02-17 Jordi Mas i Hernandez * fonts.c - remove unnecesary code and fixes 2004-02-17 Jordi Mas i Hernandez * fonts.c suport for unit conversion * general.c - suport for unit conversion * graphics.c - single line drawing 2004-02-16 Ravindra * gdip.h: Moved GpStatus enum and GpGraphics struct back from brush.h in here. Thanks to Duncan, for pointing this out. * brush.h: Moved out GpStatus enum and GpGraphics struct back to gdip.h. 2004-02-13 Ravindra * brush.h: Added. For implementing brushes in OO-C, we have Brush and BrushClass (vtable) structs defined here and related functions are declared. * solidbrush.h: Added. For implementing brushes in OO-C, we have SolidBrush struct defined here. Also, solid brush functions are declared. * gdip.h: Moved out brush functions to brush.h and solidbrush functions to solidbrush.h. Also, moved GpStatus enum and GpGraphics struct to brush.h. (This is just to satisfy compiler). * brush.c: All functions are modified to call functions from vtable. * solidbrush.c: new(), init(), setup(), clone() and destroy() functions are modified. * pen.c: gdip_pen_setup(): Modified to call gdip_brush_setup irrespective of brush type. GdipCreatePen2(): Added status checks. Now we set color also when SolidBrush is in the question. This applies to GdipSetPenBrushFill() method also. * stringformat.c: Renaming method gdip_brush_init to gdip_stringformat_init. Because the method name is used in brush.c. 2004-02-13 Jordi Mas i Hernandez * fonts.c fixed re-use of the same font, fixed size problems * graphics.c - string format, aligment, etc * stringformat.c - initial implementation 2004-02-05 Duncan Mak * gdip.h (GpRect, GpRectF): Instead of storing coordinates in terms of top, left, right, bottom, changed it to use X, Y, Width and Height instead. This matches the requirements for GDI+ (Flat API and the C++ wrapper) as well as System.Drawing. * bitmap.c (GdipBitmapLockBits): * matrix.c (GdipCreateMatrix3, GdipCreateMatrix3I): * graphics.c (GdipDrawString): * graphics-path.c (GdipAddPathRectangles, GdipAddPathRectanglesI): Use X, Y, Width, Height coordinates instead of the old system. 2004-02-05 Duncan Mak * graphics.c: Fixed indentation. 2004-02-05 Jordi Mas i Hernandez * font.c - first implementation 2004-01-29 Duncan Mak * bitmap.c (gdip_bitmap_dispose): Add a check for own_scan0. (GdipCreateBitmapFromScan0): Set own_scan0 flag if we own the incoming buffer, scan0. * gdip.h (GdipBitmapData): Add new field, own_scan0. 2004-01-26 Duncan Mak * bitmap.c (GdipCreateBitmapFromScan0): Use GdipAlloc here instead of malloc. (gdip_bitmap_dispose): Call GdipFree on bitmap->data.scan0 here. Jordi did the work for this, not me; I'm just the messenger. 2004-01-26 Duncan Mak * graphics.c (GdipDrawPath): Doh! Added stupid breaks inside the switch, so we can draw simple paths (lines) now. For more complex curves, the array is holding some NaNs, so I'll need to look into that. * bitmap.c: (GdipCreateBitmapFromScan0): Set allocate memory for scan0 if it is NULL. Thanks to Jordi for fixing this, we can now write out to a file again. 2004-01-26 Duncan Mak * graphics.c: Use C style comments instead of C++ style. * pen.c (clone_dash_array): new helper function. (GdipClonePen): Copy matrix and dash_array, removed the FIXME. 2004-01-23 Duncan Mak * graphics.c (GdipDrawPath): Implemented. 2004-01-20 Ravindra * pen.c (GdipGetPenTransform): Fixed function signature, this fixes bug #52811. 2004-01-19 Duncan Mak * graphics-path.c (GdipGetPathPoints): Fixed. (GdipCreatePath): Remember to initialize the arrays instead of just setting them to NULL. (GdipGetPathTypes, GdipGetPathPoints): Fix signature. * Makefile (local_sources): Add graphics-path.c to the build. 2004-01-13 Duncan Mak * matrix.c (GdipCreateMatrix): Use gdip_get_status instead of just returning Ok; 2004-01-13 Bernie Solomon * graphics-path.c (append): fix struct initialization for old fashioned C compilers 2004-01-13 Ravindra * pen.c: Initialized pen.matrix field to identity matrix. 2004-01-10 Alexandre Pigolkine * bitmap.c * brush.c cosmetic changes * gdip.h new field added to GpPen structure * gdip_win32.h conditional compilation flag used to reflect changes in Cairo > 0.14 * graphics.c restore position in GRAPHICS_STATE stack * matrix.c order of matrices in GdipMultiplyMatrix changed * pen.c initialization of fields, protection in GdipDeletePen function added 2003-12-25 Duncan Mak * graphics-path.c (GdipAddPathLine): Use append instead of append_point. (GdipTransformPath): Remember to reset the points after the transformation. 2003-12-25 Duncan Mak * graphics.c (DrawBezier, DrawBezierI): Well, it's pretty obvious that the code was incorrect before. After Christmas, I'm gonna hook up the GraphicsPath code and work on testing and making sure this stuff is correct. I'm pretty sure, in a first pass, there are lots of littles bugs waiting to be fixed. * graphics-path.c (new_point): Removed, we now pack the point inside the append functions. (append): New function that takes the X, Y coordinates directly. (append_bezier): Take coordinates instead of GpPointFs. Use the new append function instead of append_point. 2003-12-23 Duncan Mak * graphics-path.c: * graphics-path.h: Implemented GraphicsPath. * Makefile: Added graphics-path.c. * gdip.h (GpPathPointType, GpWarpMode): Added. 2003-12-21 Duncan Mak * graphics.c (C1): Made it more precise. (make_pie): Fixed. (make_arc): New helper function for getting the right Bezier for an elliptical arc, based on an algorithm found in the comp.text.pdf FAQ. 2003-12-02 Bernie Solomon * pen.c (GdipSetPenLineCap): fix arg type so it compiles using HP compiler. * gdip.h: fix spelling of GdipSetPenLineJoin and add prototype for GdipGetPenLineJoin 2003-11-28 Duncan Mak * brush.c (gdip_brush_setup): Check on the type of the brush and delegate the implementation to the concrete Brushes, (GdipCloneBrush, GdipDeleteBrush, GdipGetBrushType): Implemented. * gdip.h (DashStyle): Fixed typo. (PenAlignment, BrushType): Added new enumerations. (GpBrush): Added new type field. (GpPen): Added new fields: color, brush, mode, dash_array and unit. Updated the header file to include new Pen functions. * pen.c (convert_dash_array): Utitlity function for converting from a float* from GDI+ to a double* for Cairo. (GdipCreatePen2, GdipClonePen): Implemented. (PenWidth, BrushFill, Color, PenMode, PenUnit, DashStyle): (DashOffset, DashCount, DashArray): Implemented the Get/Set function pairs for these properties. (GdipGetPenCompoundArray, GdipSetPenCompoundArray): (GdipGetPenCompoundArrayCount): Stubbed. * solidbrush.c (gdip_solidfill_init): Utility for initializing a SolidBrush. Sets type as BrushTypeSolidColor. (gdip_solidfill_setup): Moved from gdip_brush_setup. (gdip_solidfill_clone): Implementation for GdipCloneBrush for a GpSolidFill. (GdipSetSolidFillColor, GdipGetSolidFillColor): Implemented. 2003-11-22 Duncan Mak * matrix.c (GdipCreateMatrix3, GdipCreateMatrix3I): Implemented. (GdipCloneMatrix): Fixed. (GdipShearMatrix, set_shear): Implemented. * graphics.c: (GdipGetWorldTransform, GdipMultiplyWorldTransform): Implemented. (GdipRotatePenTransform, GdipTranslatePenTransform): Use GDI+ functions instead. * gdip.h (GdipRotatePenTransform, GdipTranslatePenTransform): Fix signature. (GdipCreateMatrix3, GdipCreateMatrix3I): Use const appropriately. 2003-11-17 Duncan Mak * matrix.c (matrix_equals): New helper function help test matrix equality. (GdipIsMatrixIdentity, GdipIsMatrixEqual): Use matrix_equals. (GdipGetMatrixElements): Don't malloc here, because the caller should hand us an allocated array. 2003-11-16 Duncan Mak * matrix.c (GdipCreateMatrix2, GdipCreateMatrix3) (GdipCreateMatrix3I): Implemented. * pen.c (GdipResetPenTransform): (GdipMultiplyPenTransform, GdipTranslatePenTransform): (GdipScalePenTransform, GdipRotatePenTransform): Implemented. * matrix.c (set_translate, set_scale, set_rotate): Helper functions copied from Cairo. We are doing this because you can specify the order of multiplcation in GDI+, but not in Cairo. 2003-11-15 Duncan Mak * graphics.c: Moved PI and GRADTORAD to gdip.h. * gdip.h: Renamed GRADTORAD to DEGTORAD. * matrix.c (GdipCloneMatrix): Fix argument order. * matrix.c (GdipMultiplyMatrix, GdipTranslateMatrix, GdipScaleMatrix): (GdipRotateMatrix, GdipInvertMatrix): (GdipTransformMatrixPoints, GdipVectorTransformMatrixPoints): (GdipSetMatrixElements, GdipGetMatrixElements): (GdipIsMatrixInvertible): Implemented. * matrix.c (GdipIsMatrixIdentity, GdipIsMatrixEqual): Implemented. 2003-11-14 Duncan Mak * general.c (gdip_get_status): Take cairo_status_t instead of cairo_t. We need this because this is used in matrix.c and we only have cairo_matrix_t there. * graphics.c: Updated calls to gdip_get_status. * pen.c (convert_line_cap, convert_line_join): Added static keyword. (GdipDeletePen): Implemented. * matrix.c (GdipCreateMatrix2, GdipCloneMatrix, GdipInvertMatrix): Use gdip_get_status instead of just returning Ok. (GdipRotateMatrix, GdipScaleMatrix, GdipTranslateMatrix): Implemented. 2003-11-12 Duncan Mak * bitmap.c, brush.c, general.c: * graphics.c, image.c, matrix.c: * pen.c, solidbrush.c: Use gdip.h instead of gdip_main.h. * gdip.h: New header file, merged from gdip_main.h and gdip_defs.h. * gdip_main.h, gdip_defs.h: Removed. * pen.c (convert_line_join, convert_line_cap): new function for converting enumerations between GDI+ and Cairo. (gdip_pen_setup): set miter limit and line join. (GdipSetPenMiterLimit, GdipGetPenMiterLimit): (GdipSetPenLineJoin, GdipGetPenLineJoin): (GdipSetPenLineJoin, GdipGetPenTransform): implemented. 2003-11-12 Alexandre Pigolkine * bitmap.c copy image funciton added 2003-11-06 Duncan Mak * graphics.c (GdipDrawRectangle): Add call to gdip_pen_setup so that we stroke with the right color. 2003-11-05 Duncan Mak * graphics.c (make_pie, make_ellipse, make_polygon): Add static keyword. * gdip_defs.h: Update headers to include DrawBezier, DrawBeziers, DrawEllipse, DrawPie, DrawPolygon, DrawRectangle, FillEllipse, FillPolygon and the RenderingOrigin property. * Makefile (install-local): Added missing semi-colons. 2003-11-03 Bernie Solomon * gdip_main.h, gdip_win32.h, gdip_win32.c: fixes for non-GCC compilers 2003-11-02 Alexandre Pigolkine * bitmap.c convert 24/32 bpp images in LockBits 2003-11-01 Duncan Mak * matrix.c (GdipCreateMatrix, GdipCreateMatrix2, GdipCloneMatrix): (GdipDeleteMatrix, GdipInvertMatrix): Implemented; the rest of the functions are stubbed out. * gdip_defs.h (GpMatrixOrder): Added. * gdip_main.h (GpRect, GpRectF): Synonyms for Rect and RectF. (GpMatrix): An alias of cairo_matrix_t. * Makefile: Added matrix.c. 2003-10-28 Duncan Mak * gdip_main.h, gdip_def.h: Renamed all gdip_foo_ptr types are now GpFoo *. Renamed Status to GpStatus. Reformatted all C++ style comments to C style comments. Reformatted all C function prototypes to the style used by GTK+. * gdip_main.h (GpPoint, GpPointF): Added. * gdip_defs.h (GpFillMode): Added. * graphics.c (make_ellipse): (make_polygon, make_polygon_from_integers): (make_pie): private functions (make_foo) to be reused by DrawFoo and FillFoo. (convert_fill_mode): Converts a GpFillMode to a cairo_fill_rule_t. (GdipDrawPie, GdipFillEllipse, GdipFillPolygon): Implemented. 2003-10-26 Duncan Mak * graphics.c (GdipSetRenderingOrigin, GdipGetRenderingOrigin): Implemented. 2003-10-25 Duncan Mak * graphics.c (GdipDrawBezier, GdipDrawBezierI): (GdipDrawBeziers, GdipDrawBeziersI): (GdipDrawLine, GdipDrawLineI): (GdipDrawLines, GdipDrawLinesI): implemented. (GdipFillRectangle): (GdipDrawString): Make use of gdip_get_status. * general.c (gdip_get_status): A new function for retrieving a Status from a cairo_t. 2003-10-23 Miguel de Icaza * bitmap.c (GdipCreateBitmapFromScan0): Do not allocate buffer here, expect that our caller to allocate that. Do not compute the stride here, expect our caller to do this properly. * Use the Mono coding conventions. 2003-10-15 Alexandre Pigolkine * image.c GdipDrawImageRectI changed 2003-10-14 Alexandre Pigolkine * gdip_defs.h * graphics.c * gdip_main.h DrawString function added 2003-10-12 Alexandre Pigolkine * bitmap.c * brush.c * gdip_defs.h * gdip_win32.c * gdip_win32.h * gdip_main.h * general.c * graphics.c * image.c * Makefile * pen.c * solidbrush.c Added libgdiplus-4.2/src/bitmap.c0000664000175000017500000021116212377405421012657 00000000000000/* * bitmap.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Vladimir Vukicevic (vladimir@pobox.com) * Jordi Mas (jordi@ximian.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot */ #include "gdiplus-private.h" #include "bitmap-private.h" static GpStatus gdip_bitmap_clone_data_rect (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect); /* The default indexed palettes. This code was generated by a tiny C# program. */ static const unsigned int default_Format1bppIndexed_palette[2] = { 0xFF000000, 0xFFFFFFFF }; static const unsigned int default_Format4bppIndexed_palette[16] = { 0xFF000000, 0xFF800000, 0xFF008000, 0xFF808000, 0xFF000080, 0xFF800080, 0xFF008080, 0xFF808080, 0xFFC0C0C0, 0xFFFF0000, 0xFF00FF00, 0xFFFFFF00, 0xFF0000FF, 0xFFFF00FF, 0xFF00FFFF, 0xFFFFFFFF }; static const unsigned int default_Format8bppIndexed_palette[256] = { 0xFF000000, 0xFF800000, 0xFF008000, 0xFF808000, 0xFF000080, 0xFF800080, 0xFF008080, 0xFF808080, 0xFFC0C0C0, 0xFFFF0000, 0xFF00FF00, 0xFFFFFF00, 0xFF0000FF, 0xFFFF00FF, 0xFF00FFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000033, 0xFF000066, 0xFF000099, 0xFF0000CC, 0xFF0000FF, 0xFF003300, 0xFF003333, 0xFF003366, 0xFF003399, 0xFF0033CC, 0xFF0033FF, 0xFF006600, 0xFF006633, 0xFF006666, 0xFF006699, 0xFF0066CC, 0xFF0066FF, 0xFF009900, 0xFF009933, 0xFF009966, 0xFF009999, 0xFF0099CC, 0xFF0099FF, 0xFF00CC00, 0xFF00CC33, 0xFF00CC66, 0xFF00CC99, 0xFF00CCCC, 0xFF00CCFF, 0xFF00FF00, 0xFF00FF33, 0xFF00FF66, 0xFF00FF99, 0xFF00FFCC, 0xFF00FFFF, 0xFF330000, 0xFF330033, 0xFF330066, 0xFF330099, 0xFF3300CC, 0xFF3300FF, 0xFF333300, 0xFF333333, 0xFF333366, 0xFF333399, 0xFF3333CC, 0xFF3333FF, 0xFF336600, 0xFF336633, 0xFF336666, 0xFF336699, 0xFF3366CC, 0xFF3366FF, 0xFF339900, 0xFF339933, 0xFF339966, 0xFF339999, 0xFF3399CC, 0xFF3399FF, 0xFF33CC00, 0xFF33CC33, 0xFF33CC66, 0xFF33CC99, 0xFF33CCCC, 0xFF33CCFF, 0xFF33FF00, 0xFF33FF33, 0xFF33FF66, 0xFF33FF99, 0xFF33FFCC, 0xFF33FFFF, 0xFF660000, 0xFF660033, 0xFF660066, 0xFF660099, 0xFF6600CC, 0xFF6600FF, 0xFF663300, 0xFF663333, 0xFF663366, 0xFF663399, 0xFF6633CC, 0xFF6633FF, 0xFF666600, 0xFF666633, 0xFF666666, 0xFF666699, 0xFF6666CC, 0xFF6666FF, 0xFF669900, 0xFF669933, 0xFF669966, 0xFF669999, 0xFF6699CC, 0xFF6699FF, 0xFF66CC00, 0xFF66CC33, 0xFF66CC66, 0xFF66CC99, 0xFF66CCCC, 0xFF66CCFF, 0xFF66FF00, 0xFF66FF33, 0xFF66FF66, 0xFF66FF99, 0xFF66FFCC, 0xFF66FFFF, 0xFF990000, 0xFF990033, 0xFF990066, 0xFF990099, 0xFF9900CC, 0xFF9900FF, 0xFF993300, 0xFF993333, 0xFF993366, 0xFF993399, 0xFF9933CC, 0xFF9933FF, 0xFF996600, 0xFF996633, 0xFF996666, 0xFF996699, 0xFF9966CC, 0xFF9966FF, 0xFF999900, 0xFF999933, 0xFF999966, 0xFF999999, 0xFF9999CC, 0xFF9999FF, 0xFF99CC00, 0xFF99CC33, 0xFF99CC66, 0xFF99CC99, 0xFF99CCCC, 0xFF99CCFF, 0xFF99FF00, 0xFF99FF33, 0xFF99FF66, 0xFF99FF99, 0xFF99FFCC, 0xFF99FFFF, 0xFFCC0000, 0xFFCC0033, 0xFFCC0066, 0xFFCC0099, 0xFFCC00CC, 0xFFCC00FF, 0xFFCC3300, 0xFFCC3333, 0xFFCC3366, 0xFFCC3399, 0xFFCC33CC, 0xFFCC33FF, 0xFFCC6600, 0xFFCC6633, 0xFFCC6666, 0xFFCC6699, 0xFFCC66CC, 0xFFCC66FF, 0xFFCC9900, 0xFFCC9933, 0xFFCC9966, 0xFFCC9999, 0xFFCC99CC, 0xFFCC99FF, 0xFFCCCC00, 0xFFCCCC33, 0xFFCCCC66, 0xFFCCCC99, 0xFFCCCCCC, 0xFFCCCCFF, 0xFFCCFF00, 0xFFCCFF33, 0xFFCCFF66, 0xFFCCFF99, 0xFFCCFFCC, 0xFFCCFFFF, 0xFFFF0000, 0xFFFF0033, 0xFFFF0066, 0xFFFF0099, 0xFFFF00CC, 0xFFFF00FF, 0xFFFF3300, 0xFFFF3333, 0xFFFF3366, 0xFFFF3399, 0xFFFF33CC, 0xFFFF33FF, 0xFFFF6600, 0xFFFF6633, 0xFFFF6666, 0xFFFF6699, 0xFFFF66CC, 0xFFFF66FF, 0xFFFF9900, 0xFFFF9933, 0xFFFF9966, 0xFFFF9999, 0xFFFF99CC, 0xFFFF99FF, 0xFFFFCC00, 0xFFFFCC33, 0xFFFFCC66, 0xFFFFCC99, 0xFFFFCCCC, 0xFFFFCCFF, 0xFFFFFF00, 0xFFFFFF33, 0xFFFFFF66, 0xFFFFFF99, 0xFFFFFFCC, 0xFFFFFFFF }; /* Those are the only pixel formats that we really support */ static BOOL gdip_is_a_supported_pixelformat (PixelFormat fmt) { switch (fmt) { case PixelFormat1bppIndexed: case PixelFormat4bppIndexed: case PixelFormat8bppIndexed: case PixelFormat24bppRGB: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: return TRUE; default: return FALSE; } } static BOOL gdip_is_an_alpha_pixelformat (PixelFormat format) { return ((format & PixelFormatAlpha) != 0); } /* Returns TRUE if the Bitmap contains indexed (palettized) data. */ BOOL gdip_is_an_indexed_pixelformat (PixelFormat fmt) { return ((fmt & PixelFormatIndexed) != 0); } void gdip_bitmap_init (GpBitmap *bitmap) { if (bitmap == NULL) return; memset (bitmap, 0, sizeof (GpBitmap)); bitmap->type = ImageTypeBitmap; bitmap->image_format = INVALID; } static GpStatus gdip_propertyitems_clone(PropertyItem *src, PropertyItem **dest, int count) { PropertyItem *result; int i; int j; if (dest == NULL) { return InvalidParameter; } if (src == NULL) { *dest = NULL; return Ok; } result = GdipAlloc(sizeof(PropertyItem) * count); if (result == NULL) { return OutOfMemory; } for (i = 0; i < count; i++) { result[i].id = src[i].id; result[i].length = src[i].length; result[i].type = src[i].type; if ((src[i].value != NULL) && (src[i].length > 0)) { result[i].value = GdipAlloc(src[i].length); if (result[i].value == NULL) { for (j = 0; j < i; j++) { if (result[j].value != NULL) { GdipFree(result[j].value); } } GdipFree (result); return OutOfMemory; } memcpy(result[i].value, src[i].value, src[i].length); } else { result[i].value = NULL; } } *dest = result; return Ok; } static GpStatus gdip_propertyitems_dispose(PropertyItem *property, int count) { int i; if (property == NULL) { return Ok; } for (i = 0; i < count; i++) { if (property[i].value != NULL) { GdipFree(property[i].value); } } GdipFree(property); return Ok; } static GpStatus gdip_bitmapdata_init (BitmapData *data) { if (data != NULL) { memset(data, 0, sizeof(BitmapData)); return Ok; } return InvalidParameter; } GpStatus gdip_property_get_short(int offset, void *value, unsigned short *result) { BYTE *ptr = (BYTE*)value; *result = ptr[0] + (ptr[1] << 8); return Ok; } GpStatus gdip_property_get_long(int offset, void *value, guint32 *result) { BYTE *ptr = (BYTE*)value; *result = ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24); return Ok; } GpStatus gdip_property_get_srational(int offset, void *value, unsigned short *numerator, unsigned short *denominator) { BYTE *ptr = (BYTE*)value; *numerator = ptr[0] + (ptr[1] << 8); *denominator = ptr[2] + (ptr[3] << 8); return Ok; } GpStatus gdip_property_get_rational(int offset, void *value, guint32 *numerator, guint32 *denominator) { BYTE *ptr = (BYTE*)value; *numerator = ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24); *denominator = ptr[4] + (ptr[5] << 8) + (ptr[6] << 16) + (ptr[7] << 24); return Ok; } GpStatus gdip_bitmapdata_property_add_long(BitmapData *bitmap_data, PROPID id, guint32 value) { BYTE buffer[4]; buffer[0] = value & 0xff; buffer[1] = (value & 0x0000ff00) >> 8; buffer[2] = (value & 0x00ff0000) >> 16; buffer[3] = (value & 0xff000000) >> 24; return gdip_bitmapdata_property_add (bitmap_data, id, 4, PropertyTagTypeLong, buffer); } GpStatus gdip_bitmapdata_property_add_ASCII(BitmapData *bitmap_data, PROPID id, BYTE *value) { return gdip_bitmapdata_property_add (bitmap_data, id, strlen((char *)value) + 1, PropertyTagTypeASCII, value); } GpStatus gdip_bitmapdata_property_add_byte (BitmapData *bitmap_data, PROPID id, BYTE value) { return gdip_bitmapdata_property_add (bitmap_data, id, 1, PropertyTagTypeByte, &value); } GpStatus gdip_bitmapdata_property_add_short(BitmapData *bitmap_data, PROPID id, unsigned short value) { BYTE buffer[2]; buffer[0] = value & 0xff; buffer[1] = (value & 0x0ff00) >> 8; return gdip_bitmapdata_property_add (bitmap_data, id, 2, PropertyTagTypeShort, buffer); } GpStatus gdip_bitmapdata_property_add_rational(BitmapData *bitmap_data, PROPID id, guint32 numerator, guint32 denominator) { BYTE buffer[8]; buffer[0] = numerator & 0xff; buffer[1] = (numerator & 0x0000ff00) >> 8; buffer[2] = (numerator & 0x00ff0000) >> 16; buffer[3] = (numerator & 0xff000000) >> 24; buffer[4] = denominator & 0xff; buffer[5] = (denominator & 0x0000ff00) >> 8; buffer[6] = (denominator & 0x00ff0000) >> 16; buffer[7] = (denominator & 0xff000000) >> 24; return gdip_bitmapdata_property_add (bitmap_data, id, 8, PropertyTagTypeRational, buffer); } GpStatus gdip_bitmapdata_property_add_srational(BitmapData *bitmap_data, PROPID id, unsigned short numerator, unsigned short denominator) { BYTE buffer[4]; buffer[0] = numerator & 0xff; buffer[1] = (numerator & 0x0ff00) >> 8; buffer[2] = denominator & 0xff; buffer[3] = (denominator & 0xff00) >> 8; return gdip_bitmapdata_property_add (bitmap_data, id, 8, PropertyTagTypeRational, buffer); } GpStatus gdip_bitmapdata_property_add(BitmapData *bitmap_data, PROPID id, ULONG length, WORD type, VOID *value) { int property_count; if (bitmap_data == NULL) { return InvalidParameter; } property_count = bitmap_data->property_count; if (bitmap_data->property == NULL) { bitmap_data->property = GdipAlloc(sizeof(PropertyItem)); } else { bitmap_data->property = gdip_realloc (bitmap_data->property, sizeof(PropertyItem) * (property_count + 1)); } if (bitmap_data->property == NULL) { bitmap_data->property_count = 0; return OutOfMemory; } if ((value != NULL) && (length > 0)) { bitmap_data->property[property_count].value = GdipAlloc(length); if (bitmap_data->property[property_count].value == NULL) { return OutOfMemory; } memcpy(bitmap_data->property[property_count].value, value, length); } else { bitmap_data->property[property_count].value = NULL; } bitmap_data->property[property_count].id = id; bitmap_data->property[property_count].length = length; bitmap_data->property[property_count].type = type; bitmap_data->property_count++; return Ok; } GpStatus gdip_bitmapdata_property_remove_id(BitmapData *bitmap_data, PROPID id) { int i; for (i = 0; i < bitmap_data->property_count; i++) { if (bitmap_data->property[i].id == id) { return gdip_bitmapdata_property_remove_index(bitmap_data, i); } } return PropertyNotFound; } GpStatus gdip_bitmapdata_property_remove_index(BitmapData *bitmap_data, int index) { BYTE *src; BYTE *dest; if (index >= bitmap_data->property_count) { return PropertyNotFound; } /* We don't realloc the array, more overhead than savings */ if ((index + 1) < bitmap_data->property_count) { if (bitmap_data->property[index].value != NULL) { GdipFree(bitmap_data->property[index].value); } memmove(&bitmap_data->property[index], &bitmap_data->property[index + 1], (bitmap_data->property_count - index - 1) * sizeof(PropertyItem)); } bitmap_data->property_count--; return Ok; } GpStatus gdip_bitmapdata_property_find_id(BitmapData *bitmap_data, PROPID id, int *index) { int i; if (index == NULL) { return InvalidParameter; } for (i = 0; i < bitmap_data->property_count; i++) { if (bitmap_data->property[i].id == id) { *index = i; return Ok; } } return PropertyNotFound; } GpStatus gdip_bitmapdata_clone(BitmapData *src, BitmapData **dest, int count) { GpStatus status; BitmapData *result; int i; if (dest == NULL) { return InvalidParameter; } if (src == NULL) { *dest = NULL; return Ok; } result = GdipAlloc(sizeof(BitmapData) * count); if (result == NULL) { return OutOfMemory; } for (i = 0; i < count; i++) { result[i].width = src[i].width; result[i].height = src[i].height; result[i].stride = src[i].stride; result[i].pixel_format = src[i].pixel_format; result[i].reserved = GBD_OWN_SCAN0; /* We're duplicating SCAN0, we always own it*/ result[i].dpi_horz = src[i].dpi_horz; result[i].dpi_vert = src[i].dpi_vert; result[i].image_flags = src[i].image_flags; result[i].top = src[i].top; result[i].left = src[i].left; result[i].x = src[i].x; result[i].y = src[i].y; result[i].transparent = src[i].transparent; if (src[i].scan0 != NULL) { result[i].scan0 = GdipAlloc(src[i].stride * src[i].height); if (result[i].scan0 == NULL) { GdipFree(result); return OutOfMemory; } memcpy(result[i].scan0, src[i].scan0, src[i].stride * src[i].height); } else { result[i].scan0 = NULL; } result[i].palette = gdip_palette_clone (src[i].palette); result[i].property_count = src[i].property_count; status = gdip_propertyitems_clone(src[i].property, &result[i].property, src[i].property_count); if (status != Ok) { int j; for (j = 0; j < i; j++) { if (result[j].scan0 != NULL) { GdipFree(result[j].scan0); } if (result[j].property != NULL) { gdip_propertyitems_dispose(result[j].property, result[j].property_count); } } GdipFree(result); return status; } } *dest = result; return Ok; } static GpStatus gdip_bitmapdata_dispose(BitmapData *bitmap, int count) { int index; if (bitmap == NULL) { return Ok; } for (index = 0; index < count; index++) { if ((bitmap[index].scan0 != NULL) && ((bitmap[index].reserved & GBD_OWN_SCAN0) != 0)) { GdipFree(bitmap[index].scan0); } if (bitmap[index].palette != NULL) { GdipFree(bitmap[index].palette); } gdip_propertyitems_dispose(bitmap[index].property, bitmap[index].property_count); } GdipFree(bitmap); return Ok; } /* Add a new frame for the given dimension, if it does not exist. Return pointer to frame for dimension */ FrameData * gdip_frame_add(GpBitmap *bitmap, const GUID *dimension) { int i; if (bitmap == NULL) { return NULL; } if (bitmap->frames == NULL) { bitmap->frames = GdipAlloc(sizeof(FrameData)); if (bitmap->frames == NULL) { return NULL; } bitmap->num_of_frames = 1; bitmap->frames[0].count = 0; bitmap->frames[0].bitmap = NULL; bitmap->frames[0].frame_dimension = *dimension; return bitmap->frames; } else { /* Check if this dimension already exists, if not, add it */ for (i = 0; i < bitmap->num_of_frames; i++) { if (memcmp(&bitmap->frames[i].frame_dimension, dimension, sizeof(GUID)) == 0) { return &bitmap->frames[i]; } } /* No frame for the requested dimension exists */ bitmap->num_of_frames++; bitmap->frames = gdip_realloc (bitmap->frames, sizeof(FrameData) * (bitmap->num_of_frames)); if (bitmap->frames == NULL) { return NULL; } bitmap->frames[bitmap->num_of_frames - 1].count = 0; bitmap->frames[bitmap->num_of_frames - 1].bitmap = NULL; bitmap->frames[bitmap->num_of_frames - 1].frame_dimension = *dimension; return &bitmap->frames[bitmap->num_of_frames - 1]; } } /* Add a new BitmapData structure to an existing frame, return pointer to the new structure */ BitmapData * gdip_frame_add_bitmapdata(FrameData *frame) { if (frame == NULL) { return NULL; } if (frame->bitmap == NULL) { frame->bitmap = GdipAlloc(sizeof(BitmapData)); if (frame->bitmap == NULL) { return NULL; } gdip_bitmapdata_init(frame->bitmap); frame->count++; return frame->bitmap; } frame->bitmap = gdip_realloc (frame->bitmap, sizeof(BitmapData) * (frame->count + 1)); if (frame->bitmap == NULL) { return NULL; } gdip_bitmapdata_init(&frame->bitmap[frame->count]); frame->count++; return &frame->bitmap[frame->count - 1]; } ColorPalette* gdip_palette_clone (ColorPalette *original) { if (!original) return NULL; /* ColorPalette definition already includes a (single) ARGB value */ int size = sizeof (ColorPalette) + sizeof (ARGB) * (original->Count - 1); ColorPalette *result = GdipAlloc (size); if (result) memcpy (result, original, size); return result; } GpStatus gdip_bitmap_setactive(GpBitmap *bitmap, const GUID *dimension, int index) { int i; if (bitmap == NULL) { return InvalidParameter; } /* Invalidate the cached surface */ if (bitmap->surface != NULL) { cairo_surface_destroy(bitmap->surface); bitmap->surface = NULL; } if ((bitmap->num_of_frames == 0) || (bitmap->frames == NULL)) { bitmap->active_frame = 0; bitmap->active_bitmap_no = 0; bitmap->active_bitmap = NULL; return Ok; } if (dimension == NULL) { if (bitmap->frames[0].count <= index) { return InvalidParameter; } bitmap->active_frame = 0; bitmap->active_bitmap_no = index; bitmap->active_bitmap = &bitmap->frames[0].bitmap[index]; return Ok; } for (i = 0; i < bitmap->num_of_frames; i++) { if (memcmp(&bitmap->frames[i].frame_dimension, dimension, sizeof(GUID)) == 0) { if (bitmap->frames[i].count <= index) { return InvalidParameter; } bitmap->active_frame = i; bitmap->active_bitmap_no = index; bitmap->active_bitmap = &bitmap->frames[i].bitmap[index]; return Ok; } } bitmap->active_frame = 0; bitmap->active_bitmap_no = 0; bitmap->active_bitmap = NULL; return InvalidParameter; } GpStatus gdip_bitmap_clone (GpBitmap *bitmap, GpBitmap **clonedbitmap) { GpBitmap *result; int frame; int image; GpStatus status; result = (GpBitmap *) GdipAlloc (sizeof (GpBitmap)); if (result == NULL) { return OutOfMemory; } /* Copy simple types */ result->type = bitmap->type; result->image_format = bitmap->image_format; result->num_of_frames = bitmap->num_of_frames; result->active_frame = bitmap->active_frame; result->active_bitmap_no = bitmap->active_bitmap_no; result->active_bitmap = NULL; result->cairo_format = bitmap->cairo_format; result->surface = NULL; /* Allocate and copy frames, properties and bitmap data */ if (bitmap->frames != NULL) { result->frames = GdipAlloc(sizeof (FrameData) * result->num_of_frames); for (frame = 0; frame < result->num_of_frames; frame++) { result->frames[frame].count = bitmap->frames[frame].count; result->frames[frame].frame_dimension = bitmap->frames[frame].frame_dimension; result->frames[frame].bitmap = NULL; status = gdip_bitmapdata_clone (bitmap->frames[frame].bitmap, &result->frames[frame].bitmap, bitmap->frames[frame].count); if (status != Ok) goto fail; } result->active_bitmap = &result->frames[result->active_frame].bitmap[result->active_bitmap_no]; } else { bitmap->frames = NULL; } *clonedbitmap = result; return Ok; fail: gdip_bitmap_dispose(result); return status; } GpBitmap * gdip_bitmap_new(void) { GpBitmap *result; result = (GpBitmap *) GdipAlloc (sizeof (GpBitmap)); if (result != NULL) { gdip_bitmap_init (result); } return result; } /* Create a new bitmap, and create a frame with the given dimension */ GpBitmap * gdip_bitmap_new_with_frame (const GUID *dimension, BOOL add_bitmapdata) { GpBitmap *result; FrameData *frame; if (dimension == NULL) { dimension = &gdip_image_frameDimension_page_guid; } result = gdip_bitmap_new(); if (result != NULL) { frame = gdip_frame_add(result, dimension); if ((frame != NULL) && add_bitmapdata) { BitmapData *bitmap_data; bitmap_data = gdip_frame_add_bitmapdata(frame); if (bitmap_data != NULL) { result->active_bitmap = bitmap_data; } } } return result; } GpStatus gdip_bitmap_dispose (GpBitmap *bitmap) { /* Might be called with partially filled bitmaps, so check values to be freed instead of assuming */ if (!bitmap) return Ok; if (bitmap->frames) { int frame; for (frame = 0; frame < bitmap->num_of_frames; frame++) { gdip_bitmapdata_dispose (bitmap->frames[frame].bitmap, bitmap->frames[frame].count); } GdipFree (bitmap->frames); } if (bitmap->surface) cairo_surface_destroy (bitmap->surface); GdipFree (bitmap); return Ok; } /* coverity[+alloc : arg-*1] */ GpStatus GdipCreateBitmapFromFile (GDIPCONST WCHAR* filename, GpBitmap **bitmap) { GpStatus status = GdipLoadImageFromFile (filename, (GpImage **) bitmap); if (status == OutOfMemory) status = InvalidParameter; return status; } /* coverity[+alloc : arg-*1] */ GpStatus GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap) { /* ICM isn't supported */ return GdipCreateBitmapFromFile (filename, bitmap); } /* coverity[+alloc : arg-*5] */ GpStatus GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap) { GpStatus status; FrameData *frame; GpBitmap *result; BitmapData *bitmap_data; int cairo_format; int flags = 0; if (width <= 0 || height <= 0) { return InvalidParameter; } switch (format) { case PixelFormat24bppRGB: { cairo_format = CAIRO_FORMAT_RGB24; break; } case PixelFormat32bppARGB: case PixelFormat32bppPARGB: flags = ImageFlagsHasAlpha; /* fall through */ case PixelFormat32bppRGB: cairo_format = CAIRO_FORMAT_ARGB32; break; case PixelFormat16bppRGB555: case PixelFormat16bppRGB565: /* fake them as 32bpp RGB as Cairo deprecated CAIRO_FORMAT_RGB16_565 support */ /* why 32bpp ? because that's the result of MS GDI+ when loading them, even if the bitmap is empty */ format = PixelFormat32bppRGB; stride *= 2; cairo_format = CAIRO_FORMAT_ARGB32; break; case PixelFormat8bppIndexed: case PixelFormat4bppIndexed: { cairo_format = CAIRO_FORMAT_A8; break; } case PixelFormat1bppIndexed: { cairo_format = CAIRO_FORMAT_A1; break; } default: { *bitmap = NULL; return NotImplemented; } } result = gdip_bitmap_new (); if (result == NULL) { return OutOfMemory; } result->image_format = MEMBMP; result->cairo_format = cairo_format; result->surface = NULL; result->active_frame = 0; result->active_bitmap_no = 0; result->active_bitmap = NULL; /* Create single 'page' frame, with single bitmap */ frame = gdip_frame_add(result, &gdip_image_frameDimension_page_guid); if (frame == NULL) { status = OutOfMemory; goto fail; } bitmap_data = gdip_frame_add_bitmapdata(frame); if (bitmap_data == NULL) { status = OutOfMemory; goto fail; } /* populate first bitmap in first frame */ bitmap_data->width = width; bitmap_data->height = height; bitmap_data->pixel_format = format; bitmap_data->image_flags = flags; if (stride == 0) { if (gdip_is_an_indexed_pixelformat(format)) { stride = ((gdip_get_pixel_format_depth(format) * width) + 7) / 8; } else { stride = (gdip_get_pixel_format_components (format) * gdip_get_pixel_format_depth (format) * width) / 8; } /* make sure the stride aligns the next row to a 32 bits boundary */ gdip_align_stride (stride); } bitmap_data->stride = stride; if (scan0 == NULL) { scan0 = GdipAlloc (stride * height); if (scan0 == NULL) { status = OutOfMemory; goto fail; } if ((gdip_get_pixel_format_bpp(format) < 16) || gdip_is_an_alpha_pixelformat(format)) { memset (scan0, 0, stride * height); } else { /* Since the pixel format is not an alpha pixel format (i.e., it is * either PixelFormat24bppRGB or PixelFormat32bppRGB), the image should be * initially black, not initially transparent. Thus, we need to set * the alpha channel, which the user code doesn't think exists but * Cairo is still paying attention to, to 0xFF. */ int x; int y; ARGB solid_black; ARGB *scan; /* Make sure the alpha channel is at the right end of the word. */ set_pixel_bgra (&solid_black, 0, 0, 0, 0, 0xFF); for (y=0; y < height; y++) { scan = (ARGB *)((char *)scan0 + y * stride); for (x=0; x < width; x++) { scan[x] = solid_black; } } } bitmap_data->reserved = GBD_OWN_SCAN0; } bitmap_data->scan0 = scan0; /* Make sure indexed images have a palette */ if (gdip_is_an_indexed_pixelformat (format)) { int palette_entries; int header_size; int bytes_needed; const unsigned int *default_palette; int i; palette_entries = 1 << gdip_get_pixel_format_depth(format); header_size = sizeof(ColorPalette) - sizeof(ARGB); bytes_needed = header_size + palette_entries * sizeof(ARGB); bitmap_data->palette = GdipAlloc (bytes_needed); if (bitmap_data->palette == NULL) { status = OutOfMemory; goto fail; } bitmap_data->palette->Count = palette_entries; bitmap_data->palette->Flags = COLOR_PALETTE_FLAGS_DEFAULT; switch (format) { case PixelFormat1bppIndexed: default_palette = default_Format1bppIndexed_palette; bitmap_data->palette->Flags |= COLOR_PALETTE_FLAGS_GREYSCALE; break; case PixelFormat4bppIndexed: default_palette = default_Format4bppIndexed_palette; break; case PixelFormat8bppIndexed: default_palette = default_Format8bppIndexed_palette; bitmap_data->palette->Flags |= COLOR_PALETTE_FLAGS_HALFTONE; break; default: default_palette = NULL; /* Suppress unassigned val used warning */ palette_entries = 0; /* make sure we don't try to access default_palette later */ } #if WORDS_BIGENDIAN for (i=0; i < palette_entries; i++) { set_pixel_bgra (bitmap_data->palette->Entries, (i << 2), default_palette[i], (default_palette[i] >> 8), (default_palette[i] >> 16), (default_palette[i] >> 24)); } #else memcpy (bitmap_data->palette->Entries, default_palette, palette_entries * 4); #endif } else { bitmap_data->palette = NULL; } gdip_bitmap_setactive(result, NULL, 0); *bitmap = result; return Ok; fail: gdip_bitmap_dispose(result); return status; } /* coverity[+alloc : arg-*3] */ GpStatus GdipCreateBitmapFromGraphics (int width, int height, GpGraphics *graphics, GpBitmap **bitmap) { GpBitmap *result; FrameData *frame; BitmapData *bitmap_data; int stride; stride = width * 4; gdip_align_stride (stride); result = gdip_bitmap_new (); result->image_format = MEMBMP; result->cairo_format = CAIRO_FORMAT_ARGB32; frame = gdip_frame_add(result, &gdip_image_frameDimension_page_guid); if (frame == NULL) { goto fail; } bitmap_data = gdip_frame_add_bitmapdata(frame); if (bitmap_data == NULL) { goto fail; } bitmap_data->width = width; bitmap_data->height = height; bitmap_data->stride = stride; bitmap_data->pixel_format = PixelFormat32bppARGB; bitmap_data->reserved = GBD_OWN_SCAN0; bitmap_data->scan0 = GdipAlloc(stride * height); if (bitmap_data->scan0 == NULL) { goto fail; } memset (bitmap_data->scan0, 0, stride * height); gdip_bitmap_setactive(result, NULL, 0); *bitmap = result; return Ok; fail: gdip_bitmap_dispose(result); return OutOfMemory; } GpStatus GdipCreateBitmapFromHBITMAP (HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap) { if (!bitmap || !hbm) return InvalidParameter; return GdipCloneImage ((GpImage *)hbm, (GpImage**)bitmap); } GpStatus GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, HBITMAP *hbmReturn, ARGB background) { /* * Note: the handle must survive disposing the bitmap. This means that there's no interoperable way to free this memory. * For libgdiplus you must use GdipDisposeImage on the handle, while on Windows you should call the DeleteObject function. */ GpStatus status = GdipCloneImage ((GpImage *)bitmap, (GpImage**)hbmReturn); if (status != Ok) return status; ((GpImage*)*hbmReturn)->image_format = MEMBMP; ((GpImage*)*hbmReturn)->active_bitmap->image_flags |= ImageFlagsUndocumented; /* 0x00040000 */ ((GpImage*)*hbmReturn)->active_bitmap->image_flags &= ~ImageFlagsHasAlpha; /* 0x00000002 */ return Ok; } GpStatus GdipCreateBitmapFromHICON (HICON hicon, GpBitmap** bitmap) { GpStatus status; if (!hicon || !bitmap) return InvalidParameter; status = GdipCloneImage ((GpImage *)hicon, (GpImage**)bitmap); if (status == Ok) { /* ColorPalette definition includes one ARGB member (ARGB Entries[1]). In reality there are * Count entries allocated, where Count can be 0 (and required to substract the ARGB size) */ /* coverity[buffer_alloc] */ ColorPalette *palette = (ColorPalette*)GdipAlloc (sizeof (ColorPalette) - sizeof (ARGB)); if (!palette) return OutOfMemory; palette->Flags = 0; palette->Count = 0; status = GdipSetImagePalette ((GpImage*)*bitmap, palette); (*bitmap)->image_format = MEMBMP; (*bitmap)->active_bitmap->image_flags |= ImageFlagsUndocumented;/* 0x00040000 */ (*bitmap)->active_bitmap->image_flags &= ~ImageFlagsHasAlpha; /* 0x00000002 */ GdipFree (palette); } return status; } GpStatus GdipCreateHICONFromBitmap (GpBitmap* bitmap, HICON *hbmReturn) { /* * Note: the handle must survive disposing the bitmap. This means that there's no interoperable way to free this memory. * For libgdiplus you must use GdipDisposeImage on the handle, while on Windows you should call the DestroyIcon function. */ return GdipCloneImage ((GpImage *)bitmap, (GpImage**)hbmReturn); } GpStatus GdipCreateBitmapFromResource (HINSTANCE hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap) { return(NotImplemented); } /* coverity[+alloc : arg-*6] */ GpStatus GdipCloneBitmapAreaI (int x, int y, int width, int height, PixelFormat format, GpBitmap *original, GpBitmap **bitmap) { GpBitmap *result; FrameData *frame; BitmapData *bitmap_data; Rect sr = { x, y, width, height }; Rect dr = { 0, 0, width, height }; GpStatus status; if ((original == NULL) || (bitmap == NULL) || (original->active_bitmap == NULL)) { return InvalidParameter; } if (((x + width) > original->active_bitmap->width) || ((y + height) > original->active_bitmap->height)) { return InvalidParameter; } result = gdip_bitmap_new_with_frame(NULL, TRUE); if (result == NULL) { return OutOfMemory; } result->image_format = original->image_format; status = gdip_bitmap_clone_data_rect (original->active_bitmap, &sr, result->active_bitmap, &dr); if (status != Ok) { goto fail; } result->cairo_format = original->cairo_format; *bitmap = result; return Ok; fail: gdip_bitmap_dispose (result); return status; } /* coverity[+alloc : arg-*6] */ GpStatus GdipCloneBitmapArea (float x, float y, float w, float h, PixelFormat format, GpBitmap *original, GpBitmap **bitmap) { return GdipCloneBitmapAreaI ((int) x, (int) y, (int) w, (int) h, format, original, bitmap); } static void gdip_copy_strides (void *dst, int dstStride, void *src, int srcStride, int realBytes, int height) { int i; for (i = 0; i < height; i++) { memcpy (dst, src, realBytes); dst += dstStride; src += srcStride; } } /* * Copy srcRect region in srcData to destRect region in destData. No conversion is done. Assumes * BitmapData is straight from a GpBitmap. src and dest rects must be the same width/height and * bits must be of the same PixelFormat. */ static GpStatus gdip_bitmap_clone_data_rect (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect) { int dest_components; int dest_depth; if ((srcData == NULL) || (srcRect == NULL) || (destData == NULL) || (destRect == NULL) || (srcRect->Width != destRect->Width) || (srcRect->Height != destRect->Height)) { return InvalidParameter; } if (!gdip_is_a_supported_pixelformat (srcData->pixel_format)) { return NotImplemented; } dest_components = gdip_get_pixel_format_components (destData->pixel_format); if (destData->scan0 == NULL) { dest_components = gdip_get_pixel_format_components (srcData->pixel_format); dest_depth = gdip_get_pixel_format_depth (srcData->pixel_format); destData->pixel_format = srcData->pixel_format; destData->stride = ((destRect->Width * dest_components * dest_depth) >> 3); gdip_align_stride (destData->stride); destData->scan0 = GdipAlloc (destData->stride * destRect->Height); if (destData== NULL) { return OutOfMemory; } destData->width = destRect->Width; destData->height = destRect->Height; destData->pixel_format = srcData->pixel_format; destData->reserved = GBD_OWN_SCAN0; if (srcData->palette) { destData->palette = gdip_palette_clone (srcData->palette); if (!destData->palette) { GdipFree (destData->scan0); destData->scan0 = NULL; return OutOfMemory; } } } if (!gdip_is_an_indexed_pixelformat (srcData->pixel_format)) { gdip_copy_strides (destData->scan0, destData->stride, srcData->scan0 + (srcData->stride * srcRect->Y) + (gdip_get_pixel_format_components (srcData->pixel_format) * srcRect->X), srcData->stride, destRect->Width * dest_components, destRect->Height); } else { int src_depth; int src_first_x_bit_index; int width_bits; int src_first_x_bit_offset_into_byte; src_depth = gdip_get_pixel_format_depth (srcData->pixel_format); /* first, check if the bits are aligned onto a byte boundary */ src_first_x_bit_index = srcRect->X * src_depth; width_bits = destRect->Width * src_depth; src_first_x_bit_offset_into_byte = src_first_x_bit_index & 7; if (src_first_x_bit_offset_into_byte == 0) { /* the fast path: no mid-byte bit mangling required :-) * this will always be the case for 8-bit images. * basically, the source bits are aligned to the destination * bytes, and it doesn't matter if the width isn't a multiple * of 8 bits, because the remainder is guaranteed to be * allocated by the stride, and will be ignored because the * width will indicate fewer pixels than actually end up being * copied. */ gdip_copy_strides ( destData->scan0, destData->stride, srcData->scan0 + (src_first_x_bit_index / 8) + (srcData->stride * srcRect->Y), srcData->stride, width_bits / 8, destRect->Height); } else { /* the not-so-fast path: no bits are aligned, so the entire image requires bit juggling. */ BYTE *src_scan; BYTE *src_scan0; BYTE *dest_scan; BYTE *dest_scan0; unsigned short buffer; int left_shift; int x; int y; src_scan0 = srcData->scan0; dest_scan0 = destData->scan0; left_shift = src_first_x_bit_offset_into_byte; /* move the src_scan0 up to the first byte with pixel data involved in the copy */ src_scan0 += srcRect->Y * srcData->stride; src_scan0 += (src_first_x_bit_offset_into_byte / 8); for (y=0; y < destRect->Height; y++) { src_scan = src_scan0 + y * srcData->stride; dest_scan = dest_scan0 + y * destData->stride; /* jump-start the packing function. it avoids double-sampling the source bits by * using buffer as a shift register; bits 8-15 are the current packed dest pixel, * and some of bits 0-7 are not used, to permit alignment of the pixel data. */ buffer = src_scan[0] << left_shift; for (x = 1; x < destRect->Width; x++) { buffer <<= 8; buffer |= src_scan[x] << left_shift; dest_scan[0] = (buffer >> 8); } } } } return Ok; } /* * According to GDI+ testing, * RGB[A] PixelFormats can be converted to/from any other RGB[A] pixel format, with or without alpha. * We should support all of these: * * 32bpp argb - 16bpp argb 1555 * 32bpp argb - 16bpp rgb 555 * 32bpp argb - 16bpp rgb 565 * 32bpp argb - 24bpp rgb 888 * 32bpp argb - 32bpp Pargb * 32bpp argb - 32bpp rgb * * Upconversion is allowed (e.g 8bpp indexed to 32bpp rgb), but no downconversion (32bpp to 8bpp indexed) * */ static int gdip_is_pixel_format_conversion_valid (PixelFormat src, PixelFormat dest) { if (src == dest) { return 1; } /* non-GDI supported formats can't be converted */ if (!(src & PixelFormatGDI)) { return 0; } /* We don't allow converting *to* indexed formats */ if (dest & PixelFormatIndexed) { return 0; } /* These are the RGB formats */ if ((src & PixelFormatGDI) && !(src & PixelFormatExtended)) { /* all of these should be supported, but we only report the * ones we really can do for now */ /* We can't handle converting to/from the 565/555/1555 ones */ if ((src & 0xff00) == 16 || (dest & 0xff00) == 16) { return 0; } return 1; } return 0; } #if FALSE /* PixelFormat24bppRGB is internally stored by Cairo as a four bytes. Convert it to 3-byte (RGB) */ int gdip_from_ARGB_to_RGB (BYTE *src, int width, int height, int stride, BYTE **dest, int* dest_stride) { int x; int y; BYTE *result; BYTE *pos_src; BYTE *pos_dest; int src_components = 4; /* ARGB */ int dest_components = 3; /* RGB */ int stride = ((dest_components << 3) * width) >> 3); gdip_align_stride (stride); *dest_stride = stride; result = GdipAlloc (*dest_stride * height); if (result == NULL) { return OutOfMemory; } memset (result, 0, *dest_stride * height); for (y = 0, pos_src = src, pos_dest = result; y < height; y++, pos_src += stride, pos_dest += *dest_stride) { for (x = 0; x < width; x++) { pos_dest[0 + (dest_components * x)] = pos_src[0 + (src_components * x)]; pos_dest[1 + (dest_components * x)] = pos_src[1 + (src_components * x)]; pos_dest[2 + (dest_components * x)] = pos_src[2 + (src_components * x)]; } } *dest = result; return Ok; } /* PixelFormat24bppRGB is internally stored by Cairo as a three bytes. Convert it to 4-byte (ARGB) */ int gdip_from_RGB_to_ARGB (BYTE *src, int width, int height, int stride, BYTE **dest, int* dest_stride) { int x; int y; BYTE *result; BYTE *pos_src; BYTE *pos_dest; int src_components = 3; /* RGB */ int dest_components = 4; /* ARGB */ int stride = ((dest_components << 3) * width) >> 3); gdip_align_stride (stride); *dest_stride = stride; result = GdipAlloc (*dest_stride * height); if (result == NULL) { return OutOfMemory; } memset (result, 0, *dest_stride * height); for (y = 0, pos_src = src, pos_dest = result; y < height; y++, pos_src += stride, pos_dest += *dest_stride) { for (x = 0; x < width; x++) { pos_dest[0 + (dest_components * x)] = pos_src[0 + (src_components * x)]; pos_dest[1 + (dest_components * x)] = pos_src[1 + (src_components * x)]; pos_dest[2 + (dest_components * x)] = pos_src[2 + (src_components * x)]; pos_dest[3 + (dest_components * x)] = 0xff; } } *dest = result; return Ok; } #endif GpStatus gdip_init_pixel_stream (StreamingState *state, BitmapData *data, int x, int y, int w, int h) { if ((state == NULL) || (data == NULL) || (data->scan0 == NULL)) { return InvalidParameter; } /* Ensure that the rectangle requested is legal. */ if ((x < 0) || (y < 0) || ((x + w) > data->width) || ((y + h) > data->height)) { return InvalidParameter; } /* Initialize the StreamingState structure to point at the first pixel. */ state->region.X = x; state->region.Y = y; state->region.Width = w; state->region.Height = h; state->x = x; state->y = y; state->p = -1; /* ensure that the buffer will be preloaded on the first call, for indexed formats */ /* The following computation will compute the byte pointer that _contains_ the first * pixel; this doesn't necessarily mean that the pixel is aligned to the byte. This * will be handled in gdip_pixel_stream_get_next () each time it starts a new row. */ state->scan = (BYTE*)(data->scan0) + y * data->stride; switch (data->pixel_format) { case PixelFormat1bppIndexed: state->one_pixel_mask = 0x01; state->one_pixel_shift = 1; state->pixels_per_byte = 8; state->scan += (x >> 3); /* x * 1 / 8 */ break; case PixelFormat4bppIndexed: state->one_pixel_mask = 0x0F; state->one_pixel_shift = 4; state->pixels_per_byte = 2; state->scan += (x >> 1); /* x * 4 / 8 */ break; case PixelFormat8bppIndexed: state->one_pixel_mask = 0xFF; state->one_pixel_shift = 8; state->pixels_per_byte = 1; state->scan += x; /* x * 8 / 8 */ break; case PixelFormat24bppRGB: /* GDI+ use 3 bytes for 24 bpp while Cairo use 4 bytes */ if (data->reserved & GBD_TRUE24BPP) { state->pixels_per_byte = -3; state->scan += ((x * 3) >> 3); /* x * 3 / 8 */ break; } /* else continue (don't break) */ case PixelFormat32bppRGB: default: /* indicate full RGB processing */ state->pixels_per_byte = -(gdip_get_pixel_format_bpp (data->pixel_format) >> 3); state->scan -= x * state->pixels_per_byte; break; } state->data = data; return Ok; } static BOOL gdip_pixel_stream_has_next (StreamingState *state) { if (state != NULL) { return (state->p >= 0) || ((state->y < (state->region.Y + state->region.Height)) && (state->x < (state->region.X + state->region.Width))); } else { return FALSE; } } unsigned int /* <-- can be an ARGB or a palette index */ gdip_pixel_stream_get_next (StreamingState *state) { unsigned int ret; if (state == NULL) { int bright_pink; set_pixel_bgra(&bright_pink, 0, 0xFF, 0x00, 0xFF, 0xFF); /* bright pink; hopefully this will get somebody's attention :-) */ return bright_pink; } /* Note: This function does not check whether the end of the region has been hit. This function can * potentially overrun memory buffers! gdip_pixel_stream_has_next () must be used in conjunction * with this function. */ if (state->pixels_per_byte == 1) { /* A fast path for 8-bit indexed data: pixels are byte-aligned, so no special unpacking is required. */ ret = *state->scan; state->scan++; state->x++; if (state->x >= (state->region.X + state->region.Width)) { state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x; } } else if (state->pixels_per_byte > 0) { /* We have an indexed format (the RGB formats can't fit a whole pixel into a single byte). */ if (state->p < 0) { state->buffer = *state->scan; state->scan++; state->p = 0; if (state->x == state->region.X) { /* First pixel of the row; check whether it is aligned to the byte or not. */ int index_into_byte = state->x & (state->pixels_per_byte - 1); if (index_into_byte != 0) { /* Not aligned; need to advance the buffer to the * first pixel in the stream region. */ state->buffer <<= (index_into_byte * state->one_pixel_shift); state->p = index_into_byte; } } } state->buffer <<= state->one_pixel_shift; ret = (state->buffer >> 8) & state->one_pixel_mask; state->x++; state->p++; /* Have we hit the end of the buffer? */ if (state->p >= state->pixels_per_byte) state->p = -1; if (state->x >= (state->region.X + state->region.Width)) { state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x * gdip_get_pixel_format_bpp (state->data->pixel_format) / 8; state->p = -1; } } else { /* We have an RGB format. In the current implementation, these are always stored as * CAIRO_FORMAT_ARGB. This makes this section very easy to implement. If native * support for 15- and 16-bit pixel formats needs to be added in the future, though, * then this is where it needs to be done. * * In order to simplify advancing the state->scan pointer, the state->pixels_per_byte * member is set to the number of bytes per pixel, negated. That is, for 24-bit * formats, it is set to -3, and for 32-bit formats, it is set to -4. * * Note that pixel streams do not support 48- and 64-bit data at this time. */ if (state->pixels_per_byte == -4) { #if WORDS_BIGENDIAN ret = state->scan [0] | (state->scan [1] << 8) | (state->scan [2] << 16) | (state->scan [3] << 24); #else ret = *(unsigned int *)state->scan; #endif } else { /* Special case: 24-bit data needs to have the cairo format alpha component forced * to 0xFF, or many operations will do nothing (or do strange things if the alpha * channel contains garbage). */ ret = state->scan [0] | (state->scan [1] << 8) | (state->scan [2] << 16) | 0xFF000000; } state->scan -= state->pixels_per_byte; state->x++; if (state->x >= (state->region.X + state->region.Width)) { state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x * -state->pixels_per_byte; } } return ret; } static void gdip_pixel_stream_set_next (StreamingState *state, unsigned int pixel_value) { if (state == NULL) { return; } /* Note: This function does not check whether the end of the region has been hit. This function can * potentially overrun memory buffers! gdip_pixel_stream_has_next () must be used in conjunction * with this function. */ if (state->pixels_per_byte == 1) { /* A fast path for 8-bit indexed data: pixels are byte-aligned, so no special packing is required. */ *state->scan = pixel_value; state->scan++; state->x++; if (state->x >= (state->region.X + state->region.Width)) { state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x; } } else if (state->pixels_per_byte > 0) { /* We have an indexed format (the RGB formats can't fit a whole pixel into a single byte). */ if (state->p < 0) { state->p = 0; if (state->x == state->region.X) { /* First pixel of the row; check whether it is aligned to the byte or not. */ int index_into_byte = state->x & (state->pixels_per_byte - 1); if (index_into_byte == 0) { /* It is aligned; all we need to do is clear the buffer. */ state->buffer = 0; } else { /* It is not aligned; the buffer needs to be pre-loaded with those * pixels that are to the left of the first pixel to be set. */ state->buffer = (*state->scan << (index_into_byte * state->one_pixel_shift)); state->p = index_into_byte; } } } state->buffer <<= state->one_pixel_shift; state->buffer |= ((pixel_value & state->one_pixel_mask) << 8); state->x++; state->p++; /* Have we hit the end of the buffer? */ if (state->p >= state->pixels_per_byte) { *state->scan = (state->buffer >> 8); state->scan++; state->p = -1; } if (state->x >= (state->region.X + state->region.Width)) { if (state->p >= 0) { int existing_mask = 0; while (state->p < state->pixels_per_byte) { existing_mask <<= state->one_pixel_shift; existing_mask |= state->one_pixel_mask; state->buffer <<= state->one_pixel_shift; state->p++; } *state->scan = (*state->scan & existing_mask) | (state->buffer >> 8); } state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x * gdip_get_pixel_format_bpp (state->data->pixel_format) / 8; state->p = -1; } } else { /* We have an RGB format. In the current implementation, these are always stored as * CAIRO_FORMAT_ARGB. This makes this section very easy to implement. If native * support for 15- and 16-bit pixel formats needs to be added in the future, though, * then this is where it needs to be done. * * In order to simplify advancing the state->scan pointer, the state->pixels_per_byte * member is set to the number of bytes per pixel, negated. That is, for 24-bit * formats, it is set to -3, and for 32-bit formats, it is set to -4. * * Note that pixel streams do not support 48- and 64-bit data at this time. */ if (state->pixels_per_byte == -4) { #if WORDS_BIGENDIAN state->scan [0] = (pixel_value >> 24); state->scan [1] = (pixel_value >> 16); state->scan [2] = (pixel_value >> 8); state->scan [3] = (state->data->pixel_format == PixelFormat32bppRGB) ? 0xFF : pixel_value; #else if (state->data->pixel_format == PixelFormat32bppRGB) pixel_value |= 0xFF000000; *(unsigned int *)state->scan = pixel_value; #endif } else { /* ensure we don't get one byte over our allocated buffer */ #if WORDS_BIGENDIAN state->scan [0] = (pixel_value >> 24); state->scan [1] = (pixel_value >> 16); state->scan [2] = (pixel_value >> 8); #else state->scan [2] = (pixel_value >> 16); state->scan [1] = (pixel_value >> 8); state->scan [0] = pixel_value; #endif } state->scan -= state->pixels_per_byte; state->x++; if (state->x >= (state->region.X + state->region.Width)) { state->x = state->region.X; state->y++; state->scan = (BYTE*)(state->data->scan0) + state->y * state->data->stride + state->x * -state->pixels_per_byte; } } } static BOOL /* <-- TRUE if optimisation was possible and copy done, else FALSE */ gdip_pixel_stream_copy_optimized (StreamingState *dst_state, StreamingState *src_state) { unsigned int ret; if (src_state == NULL) return FALSE; if (dst_state == NULL) return FALSE; /* in a first shot we only support copy operations for cases where source and destination storage width is exactly the same */ if (src_state->pixels_per_byte != dst_state->pixels_per_byte) return FALSE; //if (src_state->data->pixel_format == PixelFormat32bppRGB) return FALSE; /* if the target is in 32bpp format with only RGB but no alpha then we should forcefully set all alpha bits to 0xff -> optimize this later! */ if (dst_state->pixels_per_byte == -4) { if (dst_state->data->pixel_format == PixelFormat32bppRGB) return FALSE; } /* optimisation code differs for different bytes per pixel (== pixels per byte) */ if (src_state->pixels_per_byte == 1) { /* A fast path for 8-bit indexed data: pixels are byte-aligned, so no special unpacking is required. */ return FALSE; /* optimize this later */ } else if (src_state->pixels_per_byte > 0) { /* We have an indexed format (the RGB formats can't fit a whole pixel into a single byte). */ return FALSE; /* optimize this later */ } else if (src_state->pixels_per_byte == 0) { return FALSE; /* unknown format - dont know how to handle; this is a sanity check for crash prevention in the following code */ } else { /* We have an RGB format. In the current implementation, these are always stored as * CAIRO_FORMAT_ARGB. This makes this section very easy to implement. If native * support for 15- and 16-bit pixel formats needs to be added in the future, though, * then this is where it needs to be done. * * In order to simplify advancing the state->scan pointer, the state->pixels_per_byte * member is set to the number of bytes per pixel, negated. That is, for 24-bit * formats, it is set to -3, and for 32-bit formats, it is set to -4. * * Note that pixel streams do not support 48- and 64-bit data at this time. */ #if WORDS_BIGENDIAN return FALSE; /* optimize this later */ #else int bytes_per_pixel = -src_state->pixels_per_byte; int bytes_per_line = bytes_per_pixel * src_state->region.Width; int bytes_per_region = bytes_per_line * src_state->region.Height; int src_stride = src_state->data->stride; int dst_stride = dst_state->data->stride; /* calculate region base addresses (this might resemble the current ..._state->scan value, but we simply dont care) */ BYTE* src_region = (BYTE*)(src_state->data->scan0) + src_state->region.Y * src_stride + src_state->region.X * bytes_per_pixel; BYTE* dst_region = (BYTE*)(dst_state->data->scan0) + dst_state->region.Y * dst_stride + dst_state->region.X * bytes_per_pixel; /* check if thze data at both locations is in a perfectly consecutive arrangement */ if ((src_state->region.Width * bytes_per_pixel == src_stride) && (dst_state->region.Width * bytes_per_pixel == dst_stride)) { memcpy (dst_region, src_region, bytes_per_region); } else { BYTE *src = src_region; BYTE *dst = dst_region; int lines; for (lines = src_state->region.Height; lines; lines--) { memcpy (dst, src, bytes_per_line); src += src_stride; dst += dst_stride; } } /* all data got copied */ /* adjust the position index and the scan value to the end of the region */ src_state->x = src_state->region.X + src_state->region.Width; src_state->y = src_state->region.Y + src_state->region.Height; src_state->scan += src_state->region.Y * src_stride; dst_state->x = dst_state->region.X + dst_state->region.Width; dst_state->y = dst_state->region.Y + dst_state->region.Height; dst_state->scan += dst_state->region.Y * dst_stride; #endif } return TRUE; } /** * srcData - input data * srcRect - rectangle of input data to place in destData * destData - where to place output; only the PixelFormat field is needed, * which specifies the output type. * destRect - destination rectangle in output. * * assumes that: * - non-null data * - rectangles are valid * - the pixel format conversion has already been validated. */ static GpStatus gdip_bitmap_change_rect_pixel_format (BitmapData *srcData, Rect *srcRect, BitmapData *destData, Rect *destRect) { PixelFormat srcFormat; PixelFormat destFormat; StreamingState srcStream; StreamingState destStream; Rect effectiveDestRect; GpStatus status; srcFormat = srcData->pixel_format; destFormat = destData->pixel_format; if (!gdip_is_pixel_format_conversion_valid (srcFormat, destFormat)) return InvalidParameter; if (!destData->scan0) return InvalidParameter; /* Check that the destRect lies fully within the destData buffer. */ if ((destRect->X + destRect->Width > destData->width) || (destRect->Y + destRect->Height > destData->height)) return InvalidParameter; effectiveDestRect = *destRect; if (effectiveDestRect.Width > srcRect->Width) { effectiveDestRect.Width = srcRect->Width; } if (effectiveDestRect.Height > srcRect->Height) { effectiveDestRect.Height = srcRect->Height; } /* Fire up the pixel streams. */ status = gdip_init_pixel_stream (&srcStream, srcData, srcRect->X, srcRect->Y, srcRect->Width, srcRect->Height); if (status != Ok) { return status; } status = gdip_init_pixel_stream (&destStream, destData, effectiveDestRect.X, effectiveDestRect.Y, effectiveDestRect.Width, effectiveDestRect.Height); if (status != Ok) { return status; } /* Move the data; special path going from indexed to not-indexed */ if ((srcFormat & PixelFormatIndexed) && !(destFormat & PixelFormatIndexed)) { int pixel; while (gdip_pixel_stream_has_next (&srcStream)) { pixel = gdip_pixel_stream_get_next (&srcStream); /* Look up the pixel in the palette and get the ARGB value */ pixel = srcData->palette->Entries[pixel]; #if G_BYTE_ORDER != G_LITTLE_ENDIAN pixel = GUINT32_FROM_LE (pixel); #endif gdip_pixel_stream_set_next (&destStream, pixel); } } else { if (!gdip_pixel_stream_copy_optimized (&destStream, &srcStream)) { while (gdip_pixel_stream_has_next (&srcStream)) { gdip_pixel_stream_set_next (&destStream, gdip_pixel_stream_get_next (&srcStream)); } } } return Ok; } #if FALSE static BOOL gdip_is_a_32bit_pixelformat (PixelFormat format) { switch (format) { case PixelFormat32bppRGB: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: /* all of these use CAIRO_FORMAT_ARGB, which is 4 bytes wide */ return TRUE; default: return FALSE; } } BOOL gdip_can_window_without_copy (BitmapData *data, Rect *rect, int format) { int bpp = gdip_get_pixel_format_bpp (format); if (format != data->pixel_format) { /* can't possibly reinterpret bits from one indexed pixel * format as being of another indexed pixel format... */ if (gdip_is_an_indexed_pixelformat (format) || gdip_is_an_indexed_pixelformat (data->pixel_format)) { return FALSE; } /* ...but we can probably handle 24-bit<->32-bit and * 32-bit alpha<->32-bit opaque without copying data, * since these are all stored as CAIRO_FORMAT_ARGB * internally. */ if (!gdip_is_a_32bit_pixelformat (format) || !gdip_is_a_32bit_pixelformat (data->pixel_format)) { return FALSE; } } /* okay, so the pixel formats are compatible. now, make sure * the rectangle lies on byte boundaries; if it doesn't, then * pixels will have to be shuffled. =/ */ /* 8bpp and above are guaranteed to be byte-aligned */ if (bpp >= 8) { return TRUE; } else { int left_bit_offset = rect->X * bpp; int width_bit_count = rect->Width * bpp; /* check whether the values are byte-aligned */ return ((left_bit_offset & 7) | (width_bit_count & 7)) == 0; } } void gdip_make_alpha_opaque (BitmapData *data) { BYTE *scan0; int y; int x; int o; int f; /* sanity check; make sure we aren't mangling any image data */ if ((data->pixel_format != PixelFormat32bppARGB) && (data->pixel_format != PixelFormat32bppRGB)) { return; } scan0 = (BYTE*)data->scan0; f = data->stride - 4 * data->width; for (y = 0, o = 0; y < data->height; y++, o += f) { for (x = 0; x < data->width; x++, o += 4) { scan0[o + 3] = 0xff; /* set alpha to fully-opaque */ } } } #endif GpStatus GdipBitmapLockBits (GpBitmap *bitmap, GDIPCONST Rect *srcRect, UINT flags, PixelFormat format, BitmapData *locked_data) { int dest_pixel_format_bpp; int dest_stride; int dest_size; BYTE *dest_scan0; Rect destRect; GpStatus status; BitmapData *root_data; if (!bitmap || !srcRect || !locked_data) return InvalidParameter; root_data = bitmap->active_bitmap; /* Is this bitmap already locked? */ if (root_data->reserved & GBD_LOCKED) return Win32Error; /* Make sure the srcRect makes sense */ if ((srcRect->X < 0) || (srcRect->Y < 0) || (srcRect->Width < 0) || (srcRect->Height < 0)) return InvalidParameter; if (((srcRect->X + srcRect->Width) > root_data->width) || ((srcRect->Y + srcRect->Height) > root_data->height)) return InvalidParameter; /* if the current and specified format are different, that the bitmap is indexed and that we ask for write then... */ if ((root_data->pixel_format != format) && gdip_is_an_indexed_pixelformat (root_data->pixel_format) && ((flags & ImageLockModeWrite) != 0)) { return InvalidParameter; } if (!gdip_is_a_supported_pixelformat (format)) return NotImplemented; destRect.X = 0; destRect.Y = 0; destRect.Width = srcRect->Width; destRect.Height = srcRect->Height; /* Common stuff */ if ((flags & ImageLockModeWrite) != 0) { locked_data->reserved |= GBD_WRITE_OK; locked_data->image_flags &= ~ImageFlagsReadOnly; } else { locked_data->reserved &= ~GBD_WRITE_OK; locked_data->image_flags |= ImageFlagsReadOnly; } if ((format & PixelFormatAlpha) != 0) { locked_data->image_flags |= ImageFlagsHasAlpha; } locked_data->reserved |= GBD_LOCKED; locked_data->reserved |= GBD_OWN_SCAN0; root_data->reserved |= GBD_LOCKED; switch (format) { case PixelFormat24bppRGB: /* workaround a hack we have (because Cairo use 32bits in this case) */ dest_pixel_format_bpp = 24; locked_data->reserved |= GBD_TRUE24BPP; break; default: dest_pixel_format_bpp = gdip_get_pixel_format_bpp (format); break; } dest_stride = (srcRect->Width * dest_pixel_format_bpp + 7) >> 3; gdip_align_stride (dest_stride); dest_size = srcRect->Height * dest_stride; if ((flags & ImageLockModeUserInputBuf) == 0) { locked_data->scan0 = GdipAlloc(dest_size); if (locked_data->scan0 == NULL) { return OutOfMemory; } } else { /* User is supposed to have provided the buffer */ if (locked_data->scan0 == NULL) { return InvalidParameter; } locked_data->reserved &= ~GBD_OWN_SCAN0; } locked_data->width = srcRect->Width; locked_data->height = srcRect->Height; locked_data->stride = dest_stride; locked_data->pixel_format = format; locked_data->x = srcRect->X; locked_data->y = srcRect->Y; locked_data->palette = NULL; /* If the user wants the original data to be readable, then convert the bits. */ status = Ok; if ((flags & ImageLockModeRead) != 0) { status = gdip_bitmap_change_rect_pixel_format (root_data, (GpRect*)srcRect, locked_data, &destRect); if ((status != Ok) && ((flags & ImageLockModeUserInputBuf) == 0)) { GdipFree (locked_data->scan0); locked_data->scan0 = NULL; } } return status; } GpStatus GdipBitmapUnlockBits (GpBitmap *bitmap, BitmapData *locked_data) { GpStatus status; BitmapData *root_data;; if ((bitmap == NULL) || (locked_data == NULL)) { return InvalidParameter; } root_data = bitmap->active_bitmap; /* It is not safe to assume that the correct BitmapData has been passed in. * Sanity check: Make sure the locked data is in fact locked.*/ if (!(root_data->reserved & GBD_LOCKED) || !(locked_data->reserved & GBD_LOCKED)) { return Win32Error; } /* Sanity check: Make sure the locked data's size is consistent with having * been returned from LockBits (). */ if ((locked_data->width > root_data->width) || (locked_data->height > root_data->height)) { return InvalidParameter; } /* We need to copy the locked data back to the root data's Scan0 if the image was writeable */ if ((locked_data->reserved & GBD_WRITE_OK) != 0) { Rect srcRect = { 0, 0, locked_data->width, locked_data->height }; Rect destRect = { locked_data->x, locked_data->y, locked_data->width, locked_data->height }; status = gdip_bitmap_change_rect_pixel_format (locked_data, &srcRect, root_data, &destRect); } else { status = Ok; } if ((locked_data->reserved & GBD_OWN_SCAN0) != 0) { GdipFree(locked_data->scan0); locked_data->scan0 = NULL; locked_data->reserved &= ~GBD_OWN_SCAN0; } if (locked_data->palette) { GdipFree(locked_data->palette); locked_data->palette = NULL; } locked_data->reserved &= ~GBD_LOCKED; root_data->reserved &= ~GBD_LOCKED; return status; } GpStatus GdipBitmapSetPixel (GpBitmap *bitmap, int x, int y, ARGB color) { BitmapData *data; BYTE *v; if ((bitmap == NULL) || (bitmap->active_bitmap == NULL)) { return InvalidParameter; } data = bitmap->active_bitmap; if ((x < 0) || (x > data->width) || (y < 0) || (y > data->height) || (data->reserved & GBD_LOCKED)) { return InvalidParameter; } if (gdip_is_an_indexed_pixelformat (data->pixel_format)) return InvalidParameter; v = (BYTE*)(data->scan0) + y * data->stride; switch (data->pixel_format) { case PixelFormat24bppRGB: case PixelFormat32bppRGB: color |= 0xFF000000; /* force the alpha for Cairo */ /* fall through */ case PixelFormat32bppARGB: case PixelFormat32bppPARGB: { ARGB *scan = (ARGB *)v; scan[x] = color; break; } case PixelFormat16bppGrayScale: return InvalidParameter; default: return NotImplemented; } return Ok; } GpStatus GdipBitmapGetPixel (GpBitmap *bitmap, int x, int y, ARGB *color) { BitmapData *data; if ((bitmap == NULL) || (bitmap->active_bitmap == NULL) || (color == NULL)) { return InvalidParameter; } data = bitmap->active_bitmap; if ((x < 0) || (x >= data->width) || (y < 0) || (y >= data->height) || (data->reserved & GBD_LOCKED)) { return InvalidParameter; } if (gdip_is_an_indexed_pixelformat (data->pixel_format)) { StreamingState pixel_stream; GpStatus status; unsigned int palette_index; if (data->palette == NULL) { return InvalidParameter; } status = gdip_init_pixel_stream (&pixel_stream, data, x, y, 1, 1); if (status != Ok) { return status; } palette_index = gdip_pixel_stream_get_next (&pixel_stream); if (palette_index >= data->palette->Count) { return InvalidParameter; } *color = data->palette->Entries[palette_index]; } else { BYTE *v = ((BYTE*)data->scan0) + y * data->stride; switch (data->pixel_format) { case PixelFormat16bppGrayScale: return InvalidParameter; case PixelFormat24bppRGB: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: { ARGB *scan = (ARGB *)v; *color = scan[x]; break; } default: return NotImplemented; } } return Ok; } GpStatus GdipBitmapSetResolution (GpBitmap *bitmap, float xdpi, float ydpi) { if (!bitmap || !bitmap->active_bitmap || isnan(xdpi) || isnan(xdpi) || (xdpi <= 0.0f) || (ydpi <= 0.0f)) return InvalidParameter; bitmap->active_bitmap->dpi_horz = xdpi; bitmap->active_bitmap->dpi_vert = ydpi; bitmap->active_bitmap->image_flags |= ImageFlagsHasRealDPI; return Ok; } cairo_surface_t * gdip_bitmap_ensure_surface (GpBitmap *bitmap) { cairo_format_t format; BitmapData *data = bitmap->active_bitmap; if (bitmap->surface || !data || !data->scan0) return bitmap->surface; switch (data->pixel_format) { case PixelFormat24bppRGB: format = CAIRO_FORMAT_RGB24; break; case PixelFormat32bppARGB: /* premultiplication is required */ case PixelFormat32bppRGB: /* no alpha */ case PixelFormat32bppPARGB: /* alpha already premultiplied */ format = CAIRO_FORMAT_ARGB32; break; default: g_warning ("gdip_bitmap_ensure_surface: Unable to create a surface for raw bitmap data of format 0x%08x", data->pixel_format); return NULL; } bitmap->surface = cairo_image_surface_create_for_data ((BYTE*)data->scan0, format, data->width, data->height, data->stride); return bitmap->surface; } BOOL gdip_bitmap_format_needs_premultiplication (GpBitmap *bitmap) { return (bitmap->active_bitmap->pixel_format == PixelFormat32bppARGB); } BYTE* gdip_bitmap_get_premultiplied_scan0 (GpBitmap *bitmap) { BitmapData *data = bitmap->active_bitmap; BYTE* premul = (BYTE*) GdipAlloc (data->height * data->stride); if (!premul) return NULL; BYTE *source = (BYTE*)data->scan0; BYTE *target = premul; int y, x; for (y = 0; y < data->height; y++) { ARGB *sp = (ARGB*) source; ARGB *tp = (ARGB*) target; for (x = 0; x < data->width; x++) { BYTE r, g, b, a; get_pixel_bgra (*sp, b, g, r, a); if (a < 0xff) { b = pre_multiplied_table [b][a]; g = pre_multiplied_table [g][a]; r = pre_multiplied_table [r][a]; set_pixel_bgra (tp, 0, b, g, r, a); } else { *tp = *sp; } sp++; tp++; } source += data->stride; target += data->stride; } return premul; } GpBitmap * gdip_convert_indexed_to_rgb (GpBitmap *indexed_bmp) { BitmapData *data; ColorPalette *palette; int rgb_stride; int rgb_bytes; int force_alpha; int one_pixel_mask; int one_pixel_shift; int pixels_per_byte; ARGB *rgb_scan0; int p; int x; int y; GpBitmap *ret; GpStatus status; BYTE *indexed_scan; ARGB *rgb_scan; int pixels_this_byte; unsigned short sample; int index; int transparent; int format; data = indexed_bmp->active_bitmap; if (data == NULL) { return NULL; } palette = data->palette; if (palette == NULL || !gdip_is_an_indexed_pixelformat (data->pixel_format)) { return NULL; } switch (data->pixel_format) { case PixelFormat1bppIndexed: one_pixel_mask = 0x01; one_pixel_shift = 1; pixels_per_byte = 8; break; case PixelFormat4bppIndexed: one_pixel_mask = 0x0F; one_pixel_shift = 4; pixels_per_byte = 2; break; case PixelFormat8bppIndexed: one_pixel_mask = 0xFF; one_pixel_shift = 8; pixels_per_byte = 1; break; default: /* something is wrong!! */ return NULL; } if ((palette->Flags & PaletteFlagsHasAlpha) == 0) { format = PixelFormat32bppRGB; set_pixel_bgra (&force_alpha, 0, 0, 0, 0, 0xFF); /* full alpha bits set */ } else { format = PixelFormat32bppARGB; force_alpha = 0; } rgb_stride = data->width * sizeof (ARGB); /* ensure 32bits alignment */ gdip_align_stride (rgb_stride); rgb_bytes = data->height * rgb_stride; /* allocate the RGB frame */ rgb_scan0 = GdipAlloc (rgb_bytes); if (rgb_scan0 == NULL) { /* out of memory?? */ return NULL; } /* convert the indexed pixels into RGB values and store them into the RGB frame */ for (y=0; y < data->height; y++) { indexed_scan = (BYTE*)(data->scan0) + y * data->stride; rgb_scan = rgb_scan0 + (y * data->width); /* Speed up the 8bpp case */ if (pixels_per_byte == 1) { for (x = 0; x < data->width; x++) { index = *indexed_scan++; rgb_scan [x] = palette->Entries [index] | force_alpha; } continue; } /* For 4bpp and 1bpp */ for (x=0; x < data->width; x += pixels_per_byte) { pixels_this_byte = pixels_per_byte; sample = *indexed_scan; indexed_scan++; if (x + pixels_this_byte >= data->width) { pixels_this_byte = data->width - x; } for (p=0; p < pixels_this_byte; p++) { sample <<= one_pixel_shift; index = (sample >> 8) & one_pixel_mask; rgb_scan[x + p] = palette->Entries[index] | force_alpha; } } } /* try to get a GpBitmap out of it :-) */ status = GdipCreateBitmapFromScan0 (data->width, data->height, rgb_stride, format, (BYTE*)rgb_scan0, &ret); if (status == Ok) { ret->active_bitmap->reserved = GBD_OWN_SCAN0; return ret; } if (ret != NULL) { gdip_bitmap_dispose(ret); } if (rgb_scan0 != NULL) { GdipFree (rgb_scan0); } return NULL; } ColorPalette* gdip_create_greyscale_palette (int num_colors) { ColorPalette *palette; int i; if ((num_colors < 0) || (num_colors > 256)) return NULL; /* ColorPalette definition already include 1 ARGB member */ palette = GdipAlloc (sizeof(ColorPalette) + (num_colors - 1) * sizeof(ARGB)); if (!palette) return NULL; palette->Count = num_colors; palette->Flags = 0; /* not every codec sets the ImageFlagsColorSpaceGRAY flag*/ /* always force alpha to opaque */ if (num_colors == 256) { for (i = 0; i < 256; i++) set_pixel_bgra (&palette->Entries[i], 0, i, i, i, 0xFF); } else { for (i = 0; i < num_colors; i++) { int intensity = i * 255 / (num_colors - 1); set_pixel_bgra (&palette->Entries[i], 0, intensity, intensity, intensity, 0xFF); } } return palette; } libgdiplus-4.2/src/fontfamily-private.h0000664000175000017500000000355212377405421015232 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __FONTFAMILY_PRIVATE_H__ #define __FONTFAMILY_PRIVATE_H__ #include "gdiplus-private.h" struct _FontFamily { FcPattern* pattern; BOOL allocated; short height; short linespacing; short celldescent; short cellascent; }; #include "fontfamily.h" #endif libgdiplus-4.2/src/jpegcodec.c0000664000175000017500000006252512377405421013335 00000000000000/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t -*- * * jpegcodec.c : Contains function definitions for encoding decoding jpeg images * * Copyright (C) 2003-2004,2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * */ #if HAVE_CONFIG_H #include #endif #include "gdiplus-private.h" GUID gdip_jpg_image_format_guid = {0xb96b3caeU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; extern GUID GdipEncoderQuality; #ifdef HAVE_LIBJPEG #include /* pkgsrc */ #undef HAVE_STDLIB_H #include #include "dstream.h" #ifdef HAVE_LIBEXIF #include #include #include #endif #include "jpegcodec.h" /* Codecinfo related data*/ static ImageCodecInfo jpeg_codec; static const WCHAR jpeg_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'J', 'P', 'E', 'G', 0}; /* Built-in JPEG */ static const WCHAR jpeg_extension[] = {'*', '.', 'J', 'P','G', ';','*', '.', 'J','P', 'E', 'G', ';', '*', '.', 'J', 'P', 'E', ';', '*', '.', 'J', 'F','I','F', 0}; /* JPG;*.JPEG;*.JPE;*.JFIF */ static const WCHAR jpeg_mimetype[] = {'i', 'm', 'a','g', 'e','/', 'j', 'p', 'e', 'g', 0}; /* image/png */ static const WCHAR jpeg_format[] = {'J', 'P', 'E', 'G', 0}; /* JPEG */ static const BYTE jpeg_sig_pattern[] = { 0xFF, 0xD8 }; static const BYTE jpeg_sig_mask[] = { 0xFF, 0xFF }; ImageCodecInfo * gdip_getcodecinfo_jpeg () { jpeg_codec.Clsid = (CLSID) { 0x557cf401, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; jpeg_codec.FormatID = gdip_jpg_image_format_guid; jpeg_codec.CodecName = (const WCHAR*) jpeg_codecname; jpeg_codec.DllName = NULL; jpeg_codec.FormatDescription = (const WCHAR*) jpeg_format; jpeg_codec.FilenameExtension = (const WCHAR*) jpeg_extension; jpeg_codec.MimeType = (const WCHAR*) jpeg_mimetype; jpeg_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; jpeg_codec.Version = 1; jpeg_codec.SigCount = 1; jpeg_codec.SigSize = 2; jpeg_codec.SigPattern = jpeg_sig_pattern; jpeg_codec.SigMask = jpeg_sig_mask; return &jpeg_codec; } #if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp) #define sigjmp_buf jmp_buf #define sigsetjmp(jb, x) setjmp(jb) #define siglongjmp longjmp #endif #define JPEG_BUFFER_SIZE 65536 struct gdip_stdio_jpeg_source_mgr { struct jpeg_source_mgr parent; FILE *infp; JOCTET *buf; }; typedef struct gdip_stdio_jpeg_source_mgr *gdip_stdio_jpeg_source_mgr_ptr; struct gdip_stream_jpeg_source_mgr { struct jpeg_source_mgr parent; dstream_t *loader; JOCTET *buf; }; typedef struct gdip_stream_jpeg_source_mgr *gdip_stream_jpeg_source_mgr_ptr; struct gdip_stream_jpeg_dest_mgr { struct jpeg_destination_mgr parent; PutBytesDelegate putBytesFunc; JOCTET *buf; }; typedef struct gdip_stream_jpeg_dest_mgr *gdip_stream_jpeg_dest_mgr_ptr; struct gdip_jpeg_error_mgr { struct jpeg_error_mgr parent; sigjmp_buf setjmp_buffer; GError **error; }; typedef struct gdip_jpeg_error_mgr *gdip_jpeg_error_mgr_ptr; static void _gdip_jpeg_error_exit (j_common_ptr cinfo) { gdip_jpeg_error_mgr_ptr err = (gdip_jpeg_error_mgr_ptr) cinfo->err; char buffer[JMSG_LENGTH_MAX]; (* cinfo->err->format_message) (cinfo, buffer); /* There is some very bizzare stuff happening with error * reporting. These are supposed to be fatal errors, * but libjpeg goes through a bunch of these calls and then * -finishes uncompressing the image-. I have no idea * what's going on here. * -- FIXME */ g_warning ("jpeg error: %d %s\n", err->parent.msg_code, buffer); siglongjmp (err->setjmp_buffer, 1); } static void _gdip_jpeg_output_message (j_common_ptr cinfo) { /* shh. */ } static void _gdip_source_dummy_init (j_decompress_ptr cinfo) { /* nothing */ } static BOOL _gdip_source_stdio_fill_input_buffer (j_decompress_ptr cinfo) { gdip_stdio_jpeg_source_mgr_ptr src = (gdip_stdio_jpeg_source_mgr_ptr) cinfo->src; size_t nb; nb = fread (src->buf, 1, JPEG_BUFFER_SIZE, src->infp); if (nb <= 0) { /* this is a hack learned from gdk-pixbuf */ /* insert fake EOI marker, to try to salvage image * in case of malformed/incomplete input */ src->buf[0] = (JOCTET) 0xFF; src->buf[1] = (JOCTET) JPEG_EOI; nb = 2; } src->parent.next_input_byte = src->buf; src->parent.bytes_in_buffer = nb; return TRUE; } static void _gdip_source_stdio_skip_input_data (j_decompress_ptr cinfo, long skipbytes) { gdip_stdio_jpeg_source_mgr_ptr src = (gdip_stdio_jpeg_source_mgr_ptr) cinfo->src; if (skipbytes > 0) { if (skipbytes > (long) src->parent.bytes_in_buffer) { skipbytes -= (long) src->parent.bytes_in_buffer; fseek (src->infp, skipbytes, SEEK_CUR); (void) _gdip_source_stdio_fill_input_buffer (cinfo); } else { src->parent.next_input_byte += (size_t) skipbytes; src->parent.bytes_in_buffer -= (size_t) skipbytes; } } } static BOOL _gdip_source_stream_fill_input_buffer (j_decompress_ptr cinfo) { gdip_stream_jpeg_source_mgr_ptr src = (gdip_stream_jpeg_source_mgr_ptr) cinfo->src; dstream_t *loader = src->loader; size_t nb; nb = dstream_read (loader, src->buf, JPEG_BUFFER_SIZE, 0); if (nb <= 0) { /* this is a hack learned from gdk-pixbuf */ /* insert fake EOI marker, to try to salvage image * in case of malformed/incomplete input */ src->buf[0] = (JOCTET) 0xFF; src->buf[1] = (JOCTET) JPEG_EOI; nb = 2; } src->parent.next_input_byte = src->buf; src->parent.bytes_in_buffer = nb; return TRUE; } static void _gdip_source_stream_skip_input_data (j_decompress_ptr cinfo, long skipbytes) { gdip_stream_jpeg_source_mgr_ptr src = (gdip_stream_jpeg_source_mgr_ptr) cinfo->src; dstream_t *loader = src->loader; if (skipbytes > 0) { if (skipbytes > (long) src->parent.bytes_in_buffer) { skipbytes -= (long) src->parent.bytes_in_buffer; dstream_skip (loader, skipbytes); (void) _gdip_source_stream_fill_input_buffer (cinfo); } else { src->parent.next_input_byte += (size_t) skipbytes; src->parent.bytes_in_buffer -= (size_t) skipbytes; } } } static void _gdip_source_dummy_term (j_decompress_ptr cinfo) { /* nothing */ } static void _gdip_dest_stream_init (j_compress_ptr cinfo) { gdip_stream_jpeg_dest_mgr_ptr dest = (gdip_stream_jpeg_dest_mgr_ptr) cinfo->dest; dest->parent.next_output_byte = dest->buf; dest->parent.free_in_buffer = JPEG_BUFFER_SIZE; } static BOOL _gdip_dest_stream_empty_output_buffer (j_compress_ptr cinfo) { gdip_stream_jpeg_dest_mgr_ptr dest = (gdip_stream_jpeg_dest_mgr_ptr) cinfo->dest; dest->putBytesFunc (dest->buf, JPEG_BUFFER_SIZE); dest->parent.next_output_byte = dest->buf; dest->parent.free_in_buffer = JPEG_BUFFER_SIZE; return TRUE; } static void _gdip_dest_stream_term (j_compress_ptr cinfo) { gdip_stream_jpeg_dest_mgr_ptr dest = (gdip_stream_jpeg_dest_mgr_ptr) cinfo->dest; dest->putBytesFunc (dest->buf, JPEG_BUFFER_SIZE - dest->parent.free_in_buffer); } static GpStatus gdip_load_jpeg_image_internal (struct jpeg_source_mgr *src, GpImage **image) { struct jpeg_decompress_struct cinfo; struct gdip_jpeg_error_mgr jerr; GpBitmap *result; BYTE *destbuf; BYTE *destptr; BYTE *lines[4] = {NULL, NULL, NULL, NULL}; GpStatus status; int stride; unsigned long long int size; destbuf = NULL; result = NULL; cinfo.err = jpeg_std_error ((struct jpeg_error_mgr *) &jerr); jerr.parent.error_exit = _gdip_jpeg_error_exit; jerr.parent.output_message = _gdip_jpeg_output_message; if (sigsetjmp (jerr.setjmp_buffer, 1)) { /* Error occured during decompression */ status = OutOfMemory; goto error; } jpeg_create_decompress (&cinfo); cinfo.src = src; jpeg_read_header (&cinfo, TRUE); cinfo.do_fancy_upsampling = FALSE; cinfo.do_block_smoothing = FALSE; result = gdip_bitmap_new_with_frame (NULL, TRUE); result->type = ImageTypeBitmap; result->active_bitmap->width = cinfo.image_width; result->active_bitmap->height = cinfo.image_height; result->active_bitmap->image_flags = ImageFlagsReadOnly | ImageFlagsHasRealPixelSize | ImageFlagsPartiallyScalable | ImageFlagsHasRealDPI; if (cinfo.density_unit == 1) { /* dpi */ result->active_bitmap->dpi_horz = cinfo.X_density; result->active_bitmap->dpi_vert = cinfo.Y_density; } else if (cinfo.density_unit == 2) { /* dots/cm */ result->active_bitmap->dpi_horz = cinfo.X_density * 2.54; result->active_bitmap->dpi_vert = cinfo.Y_density * 2.54; } else { /* unknown density */ result->active_bitmap->dpi_horz = 0; result->active_bitmap->dpi_vert = 0; } if (cinfo.num_components == 1) { result->cairo_format = CAIRO_FORMAT_A8; result->active_bitmap->pixel_format = PixelFormat8bppIndexed; size = 1; } else if (cinfo.num_components == 3) { /* libjpeg gives us RGB for many formats and * we convert to RGB format when needed. JPEG * does not support alpha (transparency). */ result->cairo_format = CAIRO_FORMAT_ARGB32; result->active_bitmap->pixel_format = PixelFormat24bppRGB; size = 4; } else if (cinfo.num_components == 4) { result->cairo_format = CAIRO_FORMAT_ARGB32; result->active_bitmap->pixel_format = PixelFormat32bppRGB; size = 4; } else goto error; switch (cinfo.jpeg_color_space) { case JCS_GRAYSCALE: result->active_bitmap->image_flags |= ImageFlagsColorSpaceGRAY; if (cinfo.num_components == 1) result->active_bitmap->palette = gdip_create_greyscale_palette (256); break; case JCS_RGB: result->active_bitmap->image_flags |= ImageFlagsColorSpaceRGB; break; case JCS_YCbCr: result->active_bitmap->image_flags |= ImageFlagsColorSpaceYCBCR; break; case JCS_YCCK: result->active_bitmap->image_flags |= ImageFlagsColorSpaceYCCK; break; case JCS_CMYK: result->active_bitmap->image_flags |= ImageFlagsColorSpaceCMYK; break; default: break; } size *= cinfo.image_width; /* stride is a (signed) _int_ and once multiplied by 4 it should hold a value that can be allocated by GdipAlloc * this effectively limits 'width' to 536870911 pixels */ if (size > G_MAXINT32) goto error; stride = result->active_bitmap->stride = size; /* Request cairo-compat output */ /* libjpeg can do only following conversions, * YCbCr => GRAYSCALE, YCbCr => RGB * GRAYSCALE => RGB, YCCK => CMYK. * Therefore, we convert YCbCr, GRAYSCALE to RGB and * YCCK to CMYK using the libjpeg. We convert CMYK * to RGB ourself. */ switch (cinfo.jpeg_color_space) { case JCS_GRAYSCALE: /* special case for indexed 256 greyscale images (bug #81552) */ if (cinfo.num_components == 1) { cinfo.out_color_space = JCS_GRAYSCALE; cinfo.out_color_components = 1; break; } /* else treat as RGB */ case JCS_RGB: case JCS_YCbCr: cinfo.out_color_space = JCS_RGB; cinfo.out_color_components = 3; break; case JCS_YCCK: case JCS_CMYK: cinfo.out_color_space = JCS_CMYK; cinfo.out_color_components = 4; break; default: /* Unsupported JPEG color space */ status = InvalidParameter; goto error; } jpeg_start_decompress (&cinfo); /* ensure total 'size' does not overflow an integer and fits inside our 2GB limit */ size *= cinfo.output_height; if (size > G_MAXINT32) { status = OutOfMemory; goto error; } destbuf = GdipAlloc (size); if (destbuf == NULL) { status = OutOfMemory; goto error; } destptr = destbuf; while (cinfo.output_scanline < cinfo.output_height) { int i; int nlines; for (i = 0; i < cinfo.rec_outbuf_height; i++) { lines[i] = destptr; destptr += stride; } nlines = jpeg_read_scanlines (&cinfo, lines, cinfo.rec_outbuf_height); /* If the out colorspace is not RBG, we need to convert it to RBG. */ if (cinfo.out_color_space == JCS_CMYK) { int i, j; for (i = 0; i < cinfo.rec_outbuf_height; i++) { BYTE *lineptr = lines [i]; for (j = 0; j < cinfo.output_width; j++) { JOCTET c, m, y, k; JOCTET r, g, b; c = lineptr [0]; m = lineptr [1]; y = lineptr [2]; k = lineptr [3]; /* Adobe photoshop seems to have a bug and inverts the CMYK data. * We might need to remove this check, if Adobe decides to fix it. */ if (cinfo.saw_Adobe_marker) { b = (k * c) / 255; g = (k * m) / 255; r = (k * y) / 255; } else { b = (255 - k) * (255 - c) / 255; g = (255 - k) * (255 - m) / 255; r = (255 - k) * (255 - y) / 255; } set_pixel_bgra(lineptr, 0, b, g, r, 0xff); lineptr += 4; } } } else if (cinfo.out_color_components == 1) { /* no decoding required, we already have all we need */ } else { int width = result->active_bitmap->width; for (i = 0; i < nlines; i++) { int j; BYTE *inptr, *outptr; inptr = lines[i] + (width * 3); outptr = lines[i] + stride; /* this loop can't work for the last two lines as it will overwrite values it requires */ for (j = 0; j < width - 2; j++) { /* Note the swapping of R and B, to get ARGB from what * looks like BGR data. */ inptr -= 3; outptr -= 4; set_pixel_bgra(outptr, 0, inptr[2], inptr[1], inptr[0], 0xff); } /* keep last 2 lines in temporary variables */ if (width > 1) { BYTE b2, g2, r2, b1, g1, r1; inptr -= 3; b2 = inptr[2]; g2 = inptr[1]; r2 = inptr[0]; inptr -= 3; b1 = inptr[2]; g1 = inptr[1]; r1 = inptr[0]; outptr -= 4; set_pixel_bgra(outptr, 0, b2, g2, r2, 0xff); outptr -= 4; set_pixel_bgra(outptr, 0, b1, g1, r1, 0xff); } else if (width > 0) { /* in case the jpeg has a single line */ BYTE b, g, r; inptr -= 3; b = inptr[2]; g = inptr[1]; r = inptr[0]; outptr -= 4; set_pixel_bgra(outptr, 0, b, g, r, 0xff); } } } } jpeg_finish_decompress (&cinfo); jpeg_destroy_decompress (&cinfo); result->active_bitmap->scan0 = destbuf; result->active_bitmap->reserved = GBD_OWN_SCAN0; result->surface = cairo_image_surface_create_for_data ((BYTE*)destbuf, result->cairo_format, result->active_bitmap->width, result->active_bitmap->height, stride); *image = result; return Ok; error: /* coverity[dead_error_line] */ if (destbuf != NULL) { GdipFree (destbuf); } if (result != NULL) { gdip_bitmap_dispose (result); } *image = NULL; return status; } #ifdef HAVE_LIBEXIF static void add_properties_from_entry (ExifEntry *entry, void *user_data) { BitmapData *bitmap_data = (BitmapData *) user_data; ULONG length; gdip_bitmapdata_property_add (bitmap_data, entry->tag, entry->size, entry->format, entry->data); } static void add_properties_from_content (ExifContent *content, void *user_data) { exif_content_foreach_entry (content, add_properties_from_entry, user_data); } static void load_exif_data (ExifData *exif_data, GpImage *image) { int n; BitmapData *bitmap; if (exif_data == NULL) return; bitmap = image->active_bitmap; exif_data_foreach_content (exif_data, add_properties_from_content, bitmap); /* thumbnail */ if (exif_data->size != 0) { gdip_bitmapdata_property_add (bitmap, PropertyTagThumbnailData, exif_data->size, PropertyTagTypeByte, exif_data->data); } exif_data_unref (exif_data); } #endif GpStatus gdip_load_jpeg_image_from_file (FILE *fp, const char *filename, GpImage **image) { GpStatus st; #ifdef HAVE_LIBEXIF ExifData *exif_data; #endif gdip_stdio_jpeg_source_mgr_ptr src; src = (gdip_stdio_jpeg_source_mgr_ptr) GdipAlloc (sizeof (struct gdip_stdio_jpeg_source_mgr)); if (src == NULL) { return OutOfMemory; } src->buf = GdipAlloc (JPEG_BUFFER_SIZE * sizeof(JOCTET)); if (src->buf == NULL) { GdipFree(src); return OutOfMemory; } src->parent.init_source = _gdip_source_dummy_init; src->parent.fill_input_buffer = _gdip_source_stdio_fill_input_buffer; src->parent.skip_input_data = _gdip_source_stdio_skip_input_data; src->parent.resync_to_restart = jpeg_resync_to_restart; src->parent.term_source = _gdip_source_dummy_term; src->parent.bytes_in_buffer = 0; src->parent.next_input_byte = NULL; src->infp = fp; st = gdip_load_jpeg_image_internal ((struct jpeg_source_mgr *) src, image); GdipFree (src->buf); GdipFree (src); #ifdef HAVE_LIBEXIF if (st == Ok) { load_exif_data (exif_data_new_from_file (filename), *image); } #endif return st; } GpStatus gdip_load_jpeg_image_from_stream_delegate (dstream_t *loader, GpImage **image) { GpStatus st; #ifdef HAVE_LIBEXIF unsigned int length; BYTE *ptr; #endif gdip_stream_jpeg_source_mgr_ptr src; src = (gdip_stream_jpeg_source_mgr_ptr) GdipAlloc (sizeof (struct gdip_stream_jpeg_source_mgr)); src->buf = GdipAlloc (JPEG_BUFFER_SIZE * sizeof(JOCTET)); src->parent.init_source = _gdip_source_dummy_init; src->parent.fill_input_buffer = _gdip_source_stream_fill_input_buffer; src->parent.skip_input_data = _gdip_source_stream_skip_input_data; src->parent.resync_to_restart = jpeg_resync_to_restart; src->parent.term_source = _gdip_source_dummy_init; src->parent.bytes_in_buffer = 0; src->parent.next_input_byte = NULL; src->loader = loader; #ifdef HAVE_LIBEXIF dstream_keep_exif_buffer (loader); #endif st = gdip_load_jpeg_image_internal ((struct jpeg_source_mgr *) src, image); GdipFree (src->buf); GdipFree (src); #ifdef HAVE_LIBEXIF if (st == Ok){ dstream_get_exif_buffer (loader, &ptr, &length); load_exif_data (exif_data_new_from_data (ptr, length), *image); } #endif return st; } static GpStatus gdip_save_jpeg_image_internal (FILE *fp, PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { gdip_stream_jpeg_dest_mgr_ptr dest = NULL; struct jpeg_compress_struct cinfo; struct gdip_jpeg_error_mgr jerr; const EncoderParameter *param; GpBitmap *bitmap = (GpBitmap *) image; JOCTET *scanline = NULL; int need_argb_conversion = 0; GpStatus status; /* Verify that we can support this pixel format */ switch (image->active_bitmap->pixel_format) { case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: case PixelFormat24bppRGB: break; case PixelFormat1bppIndexed: case PixelFormat4bppIndexed: case PixelFormat8bppIndexed: image = gdip_convert_indexed_to_rgb (image); if (image == NULL) { return OutOfMemory; } /* We recurse, makes flow and cleanup more straightforward */ status = gdip_save_jpeg_image_internal(fp, putBytesFunc, image, params); return status; default: status = InvalidParameter; goto error; } cinfo.err = jpeg_std_error ((struct jpeg_error_mgr *) &jerr); jerr.parent.error_exit = _gdip_jpeg_error_exit; jerr.parent.output_message = _gdip_jpeg_output_message; if (sigsetjmp (jerr.setjmp_buffer, 1)) { status = GenericError; goto error; } jpeg_create_compress (&cinfo); if (fp != NULL) { jpeg_stdio_dest (&cinfo, fp); } else { dest = GdipAlloc (sizeof (struct gdip_stream_jpeg_dest_mgr)); dest->parent.init_destination = _gdip_dest_stream_init; dest->parent.empty_output_buffer = _gdip_dest_stream_empty_output_buffer; dest->parent.term_destination = _gdip_dest_stream_term; dest->putBytesFunc = putBytesFunc; dest->buf = GdipAlloc (JPEG_BUFFER_SIZE); cinfo.dest = (struct jpeg_destination_mgr *) dest; } cinfo.image_width = image->active_bitmap->width; cinfo.image_height = image->active_bitmap->height; if (gdip_get_pixel_format_components (image->active_bitmap->pixel_format) == 3) { cinfo.in_color_space = JCS_RGB; cinfo.input_components = 3; if (image->active_bitmap->pixel_format == PixelFormat24bppRGB) { need_argb_conversion = 1; } else { need_argb_conversion = 0; } } else if (gdip_get_pixel_format_components (image->active_bitmap->pixel_format) == 4) { cinfo.in_color_space = JCS_RGB; cinfo.input_components = 3; need_argb_conversion = 1; } else if (gdip_get_pixel_format_components (image->active_bitmap->pixel_format) == 1) { cinfo.in_color_space = JCS_RGB; cinfo.input_components = 1; need_argb_conversion = 1; /* do this conversion */ } jpeg_set_defaults (&cinfo); if (gdip_get_pixel_format_components (image->active_bitmap->pixel_format) == 1) { jpeg_set_colorspace (&cinfo, JCS_GRAYSCALE); } /* Handle encoding parameters */ if (params) { param = gdip_find_encoder_parameter (params, &GdipEncoderQuality); if (param != NULL) { int quality; if (param->Type == EncoderParameterValueTypeLong) { quality = * (int *) param->Value; } else if (param->Type == EncoderParameterValueTypeLongRange) { const int *pval = (int *) param->Value; quality = (pval[0] + pval[1]) / 2; } else if (param->Type == EncoderParameterValueTypeByte) { quality = *(BYTE*)param->Value; } else if (param->Type == EncoderParameterValueTypeShort) { quality = *(short *)param->Value; } else { /* Should we report an error here? */ quality = 80; } jpeg_set_quality (&cinfo, quality, 0); } } jpeg_start_compress (&cinfo, TRUE); if (need_argb_conversion) { BYTE *inptr, *outptr; int i, j; scanline = GdipAlloc (image->active_bitmap->stride); for (i = 0; i < image->active_bitmap->height; i++) { inptr = image->active_bitmap->scan0 + (i * image->active_bitmap->stride); outptr = scanline; for (j = 0; j < image->active_bitmap->width; j++) { #ifdef WORDS_BIGENDIAN *outptr++ = inptr[1]; /* R */ *outptr++ = inptr[2]; /* G */ *outptr++ = inptr[3]; /* B */ #else *outptr++ = inptr[2]; /* R */ *outptr++ = inptr[1]; /* G */ *outptr++ = inptr[0]; /* B */ #endif inptr += 4; /* skip RGB+A */ } jpeg_write_scanlines (&cinfo, &scanline, 1); } GdipFree (scanline); scanline = NULL; } else { int i; for (i = 0; i < image->active_bitmap->height; i++) { scanline = image->active_bitmap->scan0 + (i * image->active_bitmap->stride); jpeg_write_scanlines (&cinfo, &scanline, 1); } } jpeg_finish_compress (&cinfo); jpeg_destroy_compress (&cinfo); if (dest != NULL) { if (dest->buf != NULL) { GdipFree (dest->buf); } GdipFree (dest); } return Ok; error: jpeg_destroy_compress (&cinfo); /* coverity[dead_error_line] */ if (dest != NULL) { if (dest->buf != NULL) { GdipFree (dest->buf); } GdipFree (dest); } if (scanline != NULL && need_argb_conversion) { GdipFree (scanline); } return GenericError; return status; } GpStatus gdip_save_jpeg_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) { return gdip_save_jpeg_image_internal (fp, NULL, image, params); } GpStatus gdip_save_jpeg_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return gdip_save_jpeg_image_internal (NULL, putBytesFunc, image, params); } #else /* No libjpeg */ #include "image.h" #include "dstream.h" ImageCodecInfo * gdip_getcodecinfo_jpeg () { return NULL; } GpStatus gdip_load_jpeg_image_from_file (FILE *fp, const char *filename, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_save_jpeg_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } GpStatus gdip_load_jpeg_image_from_stream_delegate (dstream_t *loader, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_save_jpeg_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } #endif /* * MS Jpeg supports: * Quality (LongRange) * Transformation (Long) * LuminanceTable (Short) * ChrominanceTable (Short) * For now, we're only going to export Quality. */ UINT gdip_get_encoder_parameter_list_size_jpeg () { /* We'll need: * 4 - count * + sizeof(EncoderParameter) * 1 - number of param structs * + sizeof(int) * 2 - param data (the two quality values) * and make sure the whole thing is 4-byte aligned (so we can index from the end) */ UINT sz = 4 + sizeof(EncoderParameter) * 1 + sizeof(int) * 2; return (sz + 3) & ~3; } GpStatus gdip_fill_encoder_parameter_list_jpeg (EncoderParameters *eps, UINT size) { BYTE *ucptr = (BYTE*) eps; int *iptr; if (!eps || (size < gdip_get_encoder_parameter_list_size_jpeg ()) || ((size & 3) != 0)) return InvalidParameter; eps->Count = 1; /* Steal the last 8 bytes from the data space to hold our range values */ iptr = (int *) (ucptr + size - 8); iptr[0] = 0; iptr[1] = 100; eps->Parameter[0].Guid = GdipEncoderQuality; eps->Parameter[0].NumberOfValues = 1; eps->Parameter[0].Type = EncoderParameterValueTypeLongRange; eps->Parameter[0].Value = iptr; return Ok; } libgdiplus-4.2/src/text-pango.c0000664000175000017500000003153512377405421013475 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "gdiplus-private.h" #ifdef USE_PANGO_RENDERING #include "text-pango-private.h" #include "graphics-private.h" #include "graphics-cairo-private.h" #include "brush-private.h" #include "font-private.h" /* * NOTE: all parameter's validations are done inside text.c */ static PangoAttrList* gdip_get_layout_attributes (PangoLayout *layout) { PangoAttrList *list = pango_layout_get_attributes (layout); if (!list) list = pango_attr_list_new (); else pango_attr_list_ref (list); return list; } static void gdip_process_accelerators (gchar *text, int length, PangoAttrList *list) { int i; for (i = 0; i < length; i++) { if (*(text + i) == GDIP_WINDOWS_ACCELERATOR) { /* don't show the prefix character */ *(text + i) = GDIP_PANGOHACK_ACCELERATOR; /* if the next character is an accelerator then skip over it (&& == &) */ if ((i < length - 1) && (*(text + i + 1) == GDIP_WINDOWS_ACCELERATOR)) { i++; } else if (list) { /* add an attribute on the next character */ PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW); attr->start_index = i + 1; attr->end_index = i + 2; pango_attr_list_insert (list, attr); } } } } PangoLayout* gdip_pango_setup_layout (cairo_t *ct, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, RectF *box, GDIPCONST GpStringFormat *format) { GpStringFormat *fmt; PangoLayout *layout; PangoContext *context; PangoMatrix matrix = PANGO_MATRIX_INIT; PangoRectangle logical; PangoAttrList *list = NULL; gchar *text = ucs2_to_utf8 (stringUnicode, length); if (!text) return NULL; //g_warning ("layout >%s< (%d) [x %g, y %g, w %g, h %g] [font %s, %g points]", text, length, rc->X, rc->Y, rc->Width, rc->Height, font->face, font->emSize); /* a NULL format is valid, it means get the generic default values (and free them later) */ if (!format) { GpStatus status = GdipStringFormatGetGenericDefault ((GpStringFormat **)&fmt); if (status != Ok) { GdipFree (text); return NULL; } } else { fmt = (GpStringFormat *)format; } /* unless specified we don't consider the trailing spaces, unless there is just one space (#80680) */ if ((fmt->formatFlags & StringFormatFlagsMeasureTrailingSpaces) == 0) { while ((length > 0) && (isspace (*(text + length - 1)))) length--; if (length == 0) length = 1; } layout = pango_cairo_create_layout (ct); /* context is owned by Pango (i.e. not referenced counted) do not free */ context = pango_layout_get_context (layout); pango_layout_set_font_description (layout, gdip_get_pango_font_description ((GpFont*) font)); if ((rc->Width <= 0.0) || (fmt->formatFlags & StringFormatFlagsNoWrap)) { pango_layout_set_width (layout, -1); } else { /* minus one to deal with our AA offset */ int width = rc->Width - 1; /* TODO incomplete (missing height adjustment) */ if ((fmt->formatFlags & StringFormatFlagsNoFitBlackBox) == 0) width -= 2; pango_layout_set_width (layout, width * PANGO_SCALE); } if (fmt->formatFlags & StringFormatFlagsDirectionRightToLeft) { /* with GDI+ the API not the renderer makes the direction decision */ pango_layout_set_auto_dir (layout, FALSE); pango_context_set_base_dir (context, PANGO_DIRECTION_RTL); pango_layout_context_changed (layout); /* horizontal alignment */ switch (fmt->alignment) { case StringAlignmentNear: pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT); break; case StringAlignmentCenter: pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); break; case StringAlignmentFar: pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT); break; } } else { /* horizontal alignment */ switch (fmt->alignment) { case StringAlignmentNear: pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT); break; case StringAlignmentCenter: pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); break; case StringAlignmentFar: pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT); break; } } #ifdef PANGO_VERSION_CHECK #if PANGO_VERSION_CHECK(1,16,0) if (fmt->formatFlags & StringFormatFlagsDirectionVertical) { /* only since Pango 1.16 */ pango_context_set_base_gravity (context, PANGO_GRAVITY_EAST); pango_context_set_gravity_hint (context, PANGO_GRAVITY_HINT_STRONG); pango_layout_context_changed (layout); } #endif #endif /* TODO - StringFormatFlagsDisplayFormatControl scan and replace them ??? */ /* TODO - StringFormatFlagsLineLimit */ if ((rc->Width != 0) && (rc->Height != 0) && ((fmt->formatFlags & StringFormatFlagsNoClip) == 0)) { //g_warning ("\tclip [%g %g %g %g]", rc->X, rc->Y, rc->Width, rc->Height); /* We do not call cairo_reset_clip because we want to take previous clipping into account */ cairo_rectangle (ct, rc->X, rc->Y, rc->Width + 0.5, rc->Height + 0.5); cairo_clip (ct); } switch (fmt->trimming) { case StringTrimmingNone: pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_NONE); break; case StringTrimmingCharacter: pango_layout_set_wrap (layout, PANGO_WRAP_CHAR); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_NONE); break; case StringTrimmingWord: pango_layout_set_wrap (layout, PANGO_WRAP_WORD); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_NONE); break; case StringTrimmingEllipsisCharacter: pango_layout_set_wrap (layout, PANGO_WRAP_CHAR); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); break; case StringTrimmingEllipsisWord: pango_layout_set_wrap (layout, PANGO_WRAP_WORD); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); break; case StringTrimmingEllipsisPath: pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_MIDDLE); break; } /* some stuff can only be done by manipulating the attributes (but we can avoid this most of the time) */ if ((fmt->formatFlags & StringFormatFlagsNoFontFallback) || (font->style & (FontStyleUnderline | FontStyleStrikeout))) { list = gdip_get_layout_attributes (layout); /* StringFormatFlagsNoFontFallback */ if (fmt->formatFlags & StringFormatFlagsNoFontFallback) { PangoAttribute *attr = pango_attr_fallback_new (FALSE); attr->start_index = 0; attr->end_index = length; pango_attr_list_insert (list, attr); } if (font->style & FontStyleUnderline) { PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE); attr->start_index = 0; attr->end_index = length; pango_attr_list_insert (list, attr); } if (font->style & FontStyleStrikeout) { PangoAttribute *attr = pango_attr_strikethrough_new (TRUE); attr->start_index = 0; attr->end_index = length; pango_attr_list_insert (list, attr); } } switch (fmt->hotkeyPrefix) { case HotkeyPrefixHide: /* we need to remove any accelerator from the string */ gdip_process_accelerators (text, length, NULL); break; case HotkeyPrefixShow: /* optimization: is seems that we never see the hotkey when using an underline font */ if (font->style & FontStyleUnderline) { /* so don't bother drawing it (and simply add the '&' character) */ gdip_process_accelerators (text, length, NULL); } else { /* find accelerator and add attribute to the next character (unless it's the prefix too) */ if (!list) list = gdip_get_layout_attributes (layout); gdip_process_accelerators (text, length, list); } break; default: break; } if (list) { pango_layout_set_attributes (layout, list); pango_attr_list_unref (list); } pango_layout_set_text (layout, text, length); GdipFree (text); pango_layout_get_pixel_extents (layout, NULL, &logical); //g_warning ("\tlogical\t[x %d, y %d, w %d, h %d]", logical.x, logical.y, logical.width, logical.height); box->X = rc->X; box->Y = rc->Y; box->Height = logical.height; /* add an extra pixel for our AA hack + 2 more if we don't draw on the box itself */ box->Width = logical.width + (fmt->formatFlags & StringFormatFlagsNoFitBlackBox) ? 1 : 3; //g_warning ("\tbox\t[x %g, y %g, w %g, h %g]", box->X, box->Y, box->Width, box->Height); /* vertical alignment*/ switch (fmt->lineAlignment) { case StringAlignmentNear: break; case StringAlignmentCenter: box->Y += (rc->Height - logical.height) / 2; break; case StringAlignmentFar: box->Y += (rc->Height - logical.height); break; } //g_warning ("va-box\t[x %g, y %g, w %g, h %g]", box->X, box->Y, box->Width, box->Height); pango_cairo_update_layout (ct, layout); return layout; } GpStatus pango_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) { PangoLayout *layout; RectF box; cairo_save (graphics->ct); layout = gdip_pango_setup_layout (graphics->ct, stringUnicode, length, font, rc, &box, format); if (!layout) { cairo_restore (graphics->ct); return OutOfMemory; } /* Setup cairo */ if (brush) { gdip_brush_setup (graphics, brush); } else { cairo_set_source_rgb (graphics->ct, 0., 0., 0.); } gdip_cairo_move_to (graphics, box.X, box.Y, FALSE, TRUE); pango_cairo_show_layout (graphics->ct, layout); g_object_unref (layout); cairo_restore (graphics->ct); return Ok; } GpStatus pango_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, int *codepointsFitted, int *linesFilled) { PangoLayout *layout; cairo_save (graphics->ct); layout = gdip_pango_setup_layout (graphics->ct, stringUnicode, length, font, rc, boundingBox, format); if (!layout) { cairo_restore (graphics->ct); return OutOfMemory; } if (codepointsFitted) { // TODO - dummy (total) value returned *codepointsFitted = length; } if (linesFilled) { *linesFilled = pango_layout_get_line_count (layout); //g_warning ("linesFilled %d", *linesFilled); } //else g_warning ("linesFilled %d", pango_layout_get_line_count (layout)); g_object_unref (layout); cairo_restore (graphics->ct); return Ok; } GpStatus pango_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layoutRect, GDIPCONST GpStringFormat *format, int regionCount, GpRegion **regions) { PangoLayout *layout; GpStatus status = Ok; int i, j; GpRectF boundingBox; cairo_save (graphics->ct); layout = gdip_pango_setup_layout (graphics->ct, stringUnicode, length, font, layoutRect, &boundingBox, format); if (!layout) { cairo_restore (graphics->ct); return OutOfMemory; } /* Create a region for every char range */ for (i = 0; i < format->charRangeCount; i++) { int start, end; CharacterRange range = format->charRanges [i]; GdipSetEmpty (regions [i]); if (range.Length > 0) start = range.First; else start = range.First + range.Length; end = start + range.Length; /* sanity check on charRange. negative lengths are allowed */ if (range.First < 0) { status = InvalidParameter; goto cleanup; } if ((start < 0) || (end > length)) { status = InvalidParameter; goto cleanup; } /* calculate the regions */ for (j = start; j < end; j++) { PangoRectangle box; GpRectF charRect; pango_layout_index_to_pos (layout, j, &box); charRect.X = (float)box.x / PANGO_SCALE; charRect.Y = (float)box.y / PANGO_SCALE; charRect.Width = (float)box.width / PANGO_SCALE; charRect.Height = (float)box.height / PANGO_SCALE; //g_warning ("[%d] [%d : %d-%d] %c [x %g y %g w %g h %g]", i, j, start, end, (char)stringUnicode[j], charRect.X, charRect.Y, charRect.Width, charRect.Height); status = GdipCombineRegionRect (regions [i], &charRect, CombineModeUnion); if (status != Ok) break; } if (status != Ok) break; } cleanup: cairo_restore (graphics->ct); return status; } #endif libgdiplus-4.2/src/graphics-private.h0000664000175000017500000001416512377405421014664 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __GRAPHICS_PRIVATE_H__ #define __GRAPHICS_PRIVATE_H__ #include "gdiplus-private.h" #include "imageattributes-private.h" #include "pen-private.h" #include "region-private.h" #include "metafile.h" #if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1,6,0) #define CAIRO_AA_OFFSET_X 1 #define CAIRO_AA_OFFSET_Y 0.5 #else #define CAIRO_AA_OFFSET_X 0.5 #define CAIRO_AA_OFFSET_Y 0.5 #endif #define CURVE_MIN_TERMS 1 #define CURVE_MAX_TERMS 7 #define DEFAULT_TEXT_CONTRAST 4 /* Recursion depth of the flattening algorithm */ #define FLATTEN_RECURSION_LIMIT 10 /* not 100% identical to MS GDI+ which varies a little from int and float, but still around 0x40000000 */ #define GDIP_MAX_COORD 1073741824 #define gdip_is_overflow(a) (((a) < -GDIP_MAX_COORD) || ((a) > GDIP_MAX_COORD)) typedef enum { CURVE_OPEN, CURVE_CLOSE } _CurveType; typedef enum { gtUndefined, gtX11Drawable, gtMemoryBitmap, gtOSXDrawable, gtPostScript } GraphicsType; typedef enum { GraphicsBackEndInvalid = -1, GraphicsBackEndCairo = 0, GraphicsBackEndMetafile = 1 } GraphicsBackEnd; typedef struct { cairo_matrix_t matrix; cairo_matrix_t previous_matrix; GpRegion* clip; cairo_matrix_t clip_matrix; CompositingMode composite_mode; CompositingQuality composite_quality; InterpolationMode interpolation; GpUnit page_unit; float scale; SmoothingMode draw_mode; TextRenderingHint text_mode; PixelOffsetMode pixel_mode; int org_x; int org_y; int text_contrast; } GpState; typedef struct _Graphics { GraphicsBackEnd backend; /* cairo-specific stuff */ cairo_t *ct; GpMatrix *copy_of_ctm; cairo_matrix_t previous_matrix; Display *display; Drawable drawable; void *image; int type; GpPen* last_pen; /* caching pen and brush to avoid unnecessary sets */ GpBrush* last_brush; float aa_offset_x; float aa_offset_y; /* metafile-specific stuff */ EmfType emf_type; GpMetafile *metafile; cairo_surface_t *metasurface; /* bogus surface to satisfy some API calls */ /* common-stuff */ GpRegion* clip; GpMatrix* clip_matrix; GpRect bounds; GpUnit page_unit; float scale; InterpolationMode interpolation; SmoothingMode draw_mode; TextRenderingHint text_mode; GpState* saved_status; int saved_status_pos; CompositingMode composite_mode; CompositingQuality composite_quality; PixelOffsetMode pixel_mode; int render_origin_x; int render_origin_y; float dpi_x; float dpi_y; int text_contrast; #ifdef CAIRO_HAS_QUARTZ_SURFACE void *cg_context; #endif } Graphics; float gdip_unit_conversion (Unit from, Unit to, float dpi, GraphicsType type, float nSrc) GDIP_INTERNAL; void gdip_set_cairo_clipping (GpGraphics *graphics) GDIP_INTERNAL; GpGraphics* gdip_graphics_new (cairo_surface_t *surface) GDIP_INTERNAL; GpGraphics* gdip_metafile_graphics_new (GpMetafile *metafile) GDIP_INTERNAL; BOOL gdip_is_scaled (GpGraphics *graphics) GDIP_INTERNAL; /* prototypes for cairo wrappers to deal with coordonates limits, unit conversion and antialiasing) */ void gdip_cairo_rectangle (GpGraphics *graphics, double x, double y, double width, double height, BOOL antialiasing) GDIP_INTERNAL; void gdip_cairo_move_to (GpGraphics *graphics, double x, double y, BOOL convert_units, BOOL antialiasing) GDIP_INTERNAL; void gdip_cairo_line_to (GpGraphics *graphics, double x, double y, BOOL convert_units, BOOL antialiasing) GDIP_INTERNAL; void gdip_cairo_curve_to (GpGraphics *graphics, double x1, double y1, double x2, double y2, double x3, double y3, BOOL convert_units, BOOL antialiasing) GDIP_INTERNAL; #ifdef CAIRO_HAS_QUARTZ_SURFACE // For the Quartz backend to function we need a few structures and function declarations. // Unfortunately including the headers causes conflicts with internal types. This must // be kept in sync with any changes that might happen (albeit unlikely) to apples structures struct CGPoint { float x; float y; }; typedef struct CGPoint CGPoint; struct CGSize { float width; float height; }; typedef struct CGSize CGSize; struct CGRect { CGPoint origin; CGSize size; }; typedef struct CGRect CGRect; void *CGBitmapContextCreateImage (void *context); void CGContextDrawImage (void *context, CGRect rect, void *image); void CGImageRelease (void *image); void *cairo_quartz_surface_get_cg_context(cairo_surface_t *surface); cairo_surface_t *cairo_quartz_surface_create (int format, int width, int height); cairo_surface_t *cairo_quartz_surface_create_for_cg_context (void *ctx, int width, int height); #endif /* include public API */ #include "image.h" #include "graphics.h" #endif libgdiplus-4.2/src/pathgradientbrush-private.h0000664000175000017500000000463312377405421016601 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __PATHGRADIENTBRUSH_PRIVATE_H__ #define __PATHGRADIENTBRUSH_PRIVATE_H__ #include "gdiplus-private.h" #include "brush-private.h" #include "matrix-private.h" /* _N: normalize to 0.0 .. 1.0 */ #define ARGB_ALPHA_N(argb) ((double)((argb >> 24) & 0xff) / 255.0) #define ARGB_RED_N(argb) ((double)((argb >> 16) & 0xff) / 255.0) #define ARGB_GREEN_N(argb) ((double)((argb >> 8) & 0xff) / 255.0) #define ARGB_BLUE_N(argb) ((double)((argb) & 0xff) / 255.0) struct _PathGradient { GpBrush base; GpPath *boundary; ARGB *boundaryColors; int boundaryColorsCount; GpPointF center; ARGB centerColor; GpPointF focusScales; GpRectF rectangle; Blend *blend; InterpolationColors *presetColors; GpWrapMode wrapMode; cairo_matrix_t transform; cairo_pattern_t *pattern; }; #include "pathgradientbrush.h" #endif libgdiplus-4.2/src/gdipstructs.h0000664000175000017500000000502412377405421013761 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __GDIPSTRUCTS_H__ #define __GDIPSTRUCTS_H__ #include "win32structs.h" #define GDIPCONST const /* public structures defined by GDI+ (i.e. you can safely access their members) */ typedef struct { int First; int Length; } CharacterRange; typedef struct { ARGB Argb; } Color; typedef struct { Color oldColor; Color newColor; } ColorMap; typedef struct { float m[5][5]; } ColorMatrix; typedef struct { UINT Flags; UINT Count; ARGB Entries[1]; } ColorPalette; typedef struct { int X, Y; } Point, GpPoint; typedef struct { float X, Y; } PointF, GpPointF; typedef struct { int Count; PointF *Points; BYTE *Types; } PathData, GpPathData; typedef struct { PROPID id; ULONG length; WORD type; VOID* value; } PropertyItem; typedef struct { int X, Y, Width, Height; } Rect, GpRect; typedef struct { float X, Y, Width, Height; } RectF, GpRectF; /* Callbacks */ typedef BOOL (*ImageAbort) (void *); typedef ImageAbort DrawImageAbort; typedef ImageAbort GetThumbnailImageAbort; #endif libgdiplus-4.2/src/text.c0000664000175000017500000001072212377405421012366 00000000000000/* * text.c * * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #include "gdiplus-private.h" #ifdef USE_PANGO_RENDERING #include "text-pango-private.h" #else #include "text-cairo-private.h" #endif #include "text-metafile-private.h" /* * Text API - validate and delegate */ GpStatus GdipDrawString (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GpBrush *brush) { GDIPCONST WCHAR *ptr = NULL; if (length == 0) { return Ok; } else if (length == -1) { ptr = string; length = 0; while (*ptr != 0) { length++; ptr++; } } if (!graphics || !string || !font || !layoutRect) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return text_DrawString (graphics, string, length, font, layoutRect, stringFormat, brush); case GraphicsBackEndMetafile: return metafile_DrawString (graphics, string, length, font, layoutRect, stringFormat, brush); default: return GenericError; } } GpStatus GdipMeasureString (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, int *codepointsFitted, int *linesFilled) { GDIPCONST WCHAR *ptr = NULL; if (length == 0) { if (boundingBox) { if (layoutRect) { boundingBox->X = layoutRect->X; boundingBox->Y = layoutRect->Y; } else { boundingBox->X = 0; boundingBox->Y = 0; } boundingBox->Width = 0; boundingBox->Height = 0; } if (linesFilled) { *linesFilled = 0; } if (codepointsFitted) { *codepointsFitted = 0; } return Ok; } else if (length == -1) { ptr = string; length = 0; while (*ptr != 0) { length++; ptr++; } } if (!graphics || !string || !font || !layoutRect) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: /* a metafile-based graphics returns the correct measures but doesn't record anything */ case GraphicsBackEndMetafile: return text_MeasureString (graphics, string, length, font, layoutRect, stringFormat, boundingBox, codepointsFitted, linesFilled); default: return GenericError; } } GpStatus GdipMeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, int regionCount, GpRegion **regions) { /* note: a NULL format is invalid */ if (!graphics || !string || (length == 0) || !font || !layoutRect || !stringFormat || !regions) return InvalidParameter; /* No char range or bounding rect is set for measurements */ if (stringFormat->charRangeCount == 0) { *regions = NULL; return Ok; } /* if non-zero (previous check) format->charRangeCount must match regionCount */ if (regionCount != stringFormat->charRangeCount) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: /* a metafile-based graphics returns the correct measures but doesn't record anything */ case GraphicsBackEndMetafile: return text_MeasureCharacterRanges (graphics, string, length, font, layoutRect, stringFormat, regionCount, regions); default: return GenericError; } } libgdiplus-4.2/src/gdi32.h0000664000175000017500000000252612377405421012322 00000000000000// Authors: // Francis Fisher (frankie@terrorise.me.uk) // // (C) Francis Fisher 2013 // // 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 AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "graphics-private.h" #ifndef __GDI32_H__ #define __GDI32_H__ BitBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop); #endif libgdiplus-4.2/src/region-bitmap.h0000664000175000017500000000616212377405421014147 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __REGION_BITMAP_H__ #define __REGION_BITMAP_H__ #include "gdiplus-private.h" #include "bitmap-private.h" /* * REGION_MAX_BITMAP_SIZE defines the size limit of the region bitmap we keep * in memory. The current value is 2 megabits which should be enough for any * on-screen region. Before changing this value remember that a "real", but * temporary, ARGB32 bitmap (32 times bigger, i.e. 8MB) may be allocated when * converting the path into the region bitmap. */ #define REGION_MAX_BITMAP_SIZE (2 * 1024 * 1024 >> 3) #define SHAPE_SIZE(shape) (((shape)->Width * (shape)->Height) >> 3) typedef struct { int X; int Y; int Width; int Height; unsigned char *Mask; BOOL reduced; } GpRegionBitmap; void gdip_region_bitmap_ensure (GpRegion *region) GDIP_INTERNAL; GpRegionBitmap* gdip_region_bitmap_from_path (GpPath *path) GDIP_INTERNAL; GpRegionBitmap* gdip_region_bitmap_clone (GpRegionBitmap *bitmap) GDIP_INTERNAL; void gdip_region_bitmap_free (GpRegionBitmap *bitmap) GDIP_INTERNAL; void gdip_region_bitmap_invalidate (GpRegion *region) GDIP_INTERNAL; BOOL gdip_region_bitmap_compare (GpRegionBitmap *shape1, GpRegionBitmap *shape2) GDIP_INTERNAL; BOOL gdip_region_bitmap_is_point_visible (GpRegionBitmap *bitmap, int x, int y) GDIP_INTERNAL; BOOL gdip_region_bitmap_is_rect_visible (GpRegionBitmap *bitmap, GpRect *rect) GDIP_INTERNAL; int gdip_region_bitmap_get_scans (GpRegionBitmap *bitmap, GpRectF *rect, int count) GDIP_INTERNAL; void gdip_region_bitmap_get_smallest_rect (GpRegionBitmap *bitmap, GpRect *rect) GDIP_INTERNAL; void gdip_region_bitmap_shrink (GpRegionBitmap *bitmap, BOOL always_shrink) GDIP_INTERNAL; void gdip_region_bitmap_apply_alpha (GpBitmap *bitmap, GpRegionBitmap *alpha) GDIP_INTERNAL; GpRegionBitmap* gdip_region_bitmap_combine (GpRegionBitmap *bitmap1, GpRegionBitmap* bitmap2, CombineMode combineMode) GDIP_INTERNAL; #endif libgdiplus-4.2/src/fontcollection-private.h0000664000175000017500000000351012377405421016076 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __FONTCOLLECTION_PRIVATE_H__ #define __FONTCOLLECTION_PRIVATE_H__ #include "gdiplus-private.h" struct _FontCollection { FcFontSet* fontset; FcConfig* config; /* Only for private collections */ }; #include "fontcollection.h" #endif libgdiplus-4.2/src/lineargradientbrush.c0000664000175000017500000010326512377405421015443 00000000000000/* * lineargradientbrush.c * * Copyright (C) 2003-2004,2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: * Ravindra (rkumar@novell.com) * */ #include "lineargradientbrush-private.h" #include "graphics-private.h" #include "matrix-private.h" static GpStatus gdip_linear_gradient_setup (GpGraphics *graphics, GpBrush *brush); static GpStatus gdip_linear_gradient_clone_brush (GpBrush *brush, GpBrush **clonedBrush); static GpStatus gdip_linear_gradient_destroy (GpBrush *brush); /* * we have a single copy of vtable for * all instances of lineargradient brush. */ static BrushClass vtable = { BrushTypeLinearGradient, gdip_linear_gradient_setup, gdip_linear_gradient_clone_brush, gdip_linear_gradient_destroy }; static void gdip_linear_gradient_init (GpLineGradient *linear) { gdip_brush_init (&linear->base, &vtable); linear->wrapMode = WrapModeTile; cairo_matrix_init_identity (&linear->matrix); linear->rectangle.X = linear->rectangle.Y = linear->rectangle.Width = linear->rectangle.Height = 0.0f; linear->gammaCorrection = FALSE; linear->angle = 0.0; linear->isAngleScalable = FALSE; linear->presetColors = (InterpolationColors *) GdipAlloc (sizeof (InterpolationColors)); linear->presetColors->count = 0; linear->blend = (Blend *) GdipAlloc (sizeof (Blend)); linear->blend->count = 1; linear->blend->factors = (float *) GdipAlloc (sizeof (float)); linear->blend->positions = (float *) GdipAlloc (sizeof (float)); linear->blend->factors [0] = 1.0; linear->blend->positions[0] = 0.0; linear->pattern = NULL; } static GpLineGradient* gdip_linear_gradient_new (void) { GpLineGradient *result = (GpLineGradient *) GdipAlloc (sizeof (GpLineGradient)); if (result) gdip_linear_gradient_init (result); return result; } GpStatus gdip_linear_gradient_clone_brush (GpBrush *brush, GpBrush **clonedBrush) { GpLineGradient *linear; GpLineGradient *newbrush; if (!brush || !clonedBrush) return InvalidParameter; newbrush = (GpLineGradient *) GdipAlloc (sizeof (GpLineGradient)); if (!newbrush) return OutOfMemory; linear = (GpLineGradient *) brush; newbrush->base = linear->base; newbrush->wrapMode = linear->wrapMode; gdip_cairo_matrix_copy (&newbrush->matrix, &linear->matrix); memcpy (&newbrush->rectangle, &linear->rectangle, sizeof (GpRectF)); newbrush->gammaCorrection = linear->gammaCorrection; newbrush->angle = linear->angle; newbrush->isAngleScalable = linear->isAngleScalable; /* cloned brush needs to have its own pattern */ newbrush->base.changed = TRUE; newbrush->pattern = NULL; newbrush->lineColors [0] = linear->lineColors [0]; newbrush->lineColors [1] = linear->lineColors [1]; newbrush->points [0].X = linear->points [0].X; newbrush->points [0].Y = linear->points [0].Y; newbrush->points [1].X = linear->points [1].X; newbrush->points [1].Y = linear->points [1].Y; newbrush->presetColors = (InterpolationColors *) GdipAlloc (sizeof (InterpolationColors)); if (newbrush->presetColors == NULL) goto NO_PRESET; newbrush->presetColors->count = linear->presetColors->count; if (linear->presetColors->count > 0) { newbrush->presetColors->colors = (ARGB *) GdipAlloc (linear->presetColors->count * sizeof (ARGB)); if (newbrush->presetColors->colors == NULL) goto NO_PRESET_COLORS; memcpy (newbrush->presetColors->colors, linear->presetColors->colors, linear->presetColors->count * sizeof (ARGB)); newbrush->presetColors->positions = (float *) GdipAlloc (linear->presetColors->count * sizeof (float)); if (newbrush->presetColors->positions == NULL) goto NO_PRESET_POSITIONS; memcpy (newbrush->presetColors->positions, linear->presetColors->positions, linear->presetColors->count * sizeof (float)); } else { memcpy (newbrush->presetColors, linear->presetColors, sizeof (InterpolationColors)); } newbrush->blend = (Blend *) GdipAlloc (sizeof (Blend)); if (newbrush->blend == NULL) goto NO_BLEND; newbrush->blend->count = linear->blend->count; if (linear->blend->count > 0) { newbrush->blend->factors = (float *) GdipAlloc (linear->blend->count * sizeof (float)); if (newbrush->blend->factors == NULL) goto NO_BLEND_FACTORS; memcpy (newbrush->blend->factors, linear->blend->factors, linear->blend->count * sizeof (ARGB)); newbrush->blend->positions = (float *) GdipAlloc (linear->blend->count * sizeof (float)); if (newbrush->blend->positions == NULL) goto NO_BLEND_POSITIONS; memcpy (newbrush->blend->positions, linear->blend->positions, linear->blend->count * sizeof (float)); } else { memcpy (newbrush->blend, linear->blend, sizeof (Blend)); } goto SUCCESS; NO_BLEND_POSITIONS: GdipFree (newbrush->blend->factors); NO_BLEND_FACTORS: GdipFree (newbrush->blend); NO_BLEND: NO_PRESET_POSITIONS: GdipFree (newbrush->presetColors->colors); NO_PRESET_COLORS: GdipFree (newbrush->presetColors); NO_PRESET: GdipFree (newbrush); *clonedBrush = NULL; return OutOfMemory; SUCCESS: *clonedBrush = (GpBrush *) newbrush; return Ok; } GpStatus gdip_linear_gradient_destroy (GpBrush *brush) { /* a. the NULL check for brush is done by the caller, GdipDeleteBrush */ /* b. brush itself is freed by the caller */ GpLineGradient *linear = (GpLineGradient *) brush; if (linear->blend) { if (linear->blend->count > 0) { GdipFree (linear->blend->factors); GdipFree (linear->blend->positions); } GdipFree (linear->blend); linear->blend = NULL; } if (linear->presetColors) { if (linear->presetColors->count > 0) { GdipFree (linear->presetColors->colors); GdipFree (linear->presetColors->positions); } GdipFree (linear->presetColors); linear->presetColors = NULL; } if (linear->pattern) { cairo_pattern_destroy (linear->pattern); linear->pattern = NULL; } return Ok; } static void add_color_stops_from_blend (cairo_pattern_t *pattern, Blend *blend, ARGB *colors) { int index; double sr, sg, sb, sa; double er, eg, eb, ea; double offset, factor; sa = (colors[0] >> 24) & 0xFF; sr = (colors[0] >> 16) & 0xFF; sg = (colors[0] >> 8) & 0xFF; sb = colors[0] & 0xFF; ea = (colors[1] >> 24) & 0xFF; er = (colors[1] >> 16) & 0xFF; eg = (colors[1] >> 8) & 0xFF; eb = colors[1] & 0xFF; for (index = 0; index < blend->count; index++) { factor = blend->factors [index]; offset = blend->positions [index]; cairo_pattern_add_color_stop_rgba (pattern, offset, ((sr * (1 - factor)) + (er * factor)) / 255, ((sg * (1 - factor)) + (eg * factor)) / 255, ((sb * (1 - factor)) + (eb * factor)) / 255, ((sa * (1 - factor)) + (ea * factor)) / 255); } } static void add_color_stops_from_interpolation_colors (cairo_pattern_t *pattern, InterpolationColors *presetColors) { int index; double r, g, b, a; double offset; ARGB color; /* MS accecpts positions above 1.0 also. Cairo assumes the values above 1.0 as 1.0 * and values below 0 are assumed as 0. So we get different results if any of the * offset values is out of [0.0, 1.0]. */ for (index = 0; index < presetColors->count; index++) { color = presetColors->colors [index]; a = (color >> 24) & 0xFF; r = (color >> 16) & 0xFF; g = (color >> 8) & 0xFF; b = color & 0xFF; offset = presetColors->positions [index]; cairo_pattern_add_color_stop_rgba (pattern, offset, r / 255, g / 255, b / 255, a / 255); } } static void add_color_stops (cairo_pattern_t *pattern, ARGB *colors) { double r, g, b, a; a = (colors[0] >> 24) & 0xFF; r = (colors[0] >> 16) & 0xFF; g = (colors[0] >> 8) & 0xFF; b = colors[0] & 0xFF; /* set start color */ cairo_pattern_add_color_stop_rgba (pattern, 0.0, r / 255, g / 255, b / 255, a / 255); a = (colors[1] >> 24) & 0xFF; r = (colors[1] >> 16) & 0xFF; g = (colors[1] >> 8) & 0xFF; b = colors[1] & 0xFF; /* set end color */ cairo_pattern_add_color_stop_rgba (pattern, 1.0, r / 255, g / 255, b / 255, a / 255); } static GpStatus create_tile_linear (GpGraphics *graphics, cairo_t *ct, GpLineGradient *linear) { GpStatus status; cairo_pattern_t *pat; cairo_matrix_t matrix; GpRectF *rect; if (!graphics || !ct || !linear) return InvalidParameter; rect = &linear->rectangle; gdip_cairo_matrix_copy (&matrix, &linear->matrix); status = GdipInvertMatrix (&matrix); if (status != Ok) return status; pat = cairo_pattern_create_linear (linear->points [0].X, linear->points [0].Y, linear->points [1].X, linear->points [1].Y); status = gdip_get_pattern_status (pat); if (status != Ok) return status; cairo_pattern_set_matrix (pat, &matrix); if (linear->blend->count > 1) add_color_stops_from_blend (pat, linear->blend, linear->lineColors); else if (linear->presetColors->count > 1) add_color_stops_from_interpolation_colors (pat, linear->presetColors); else add_color_stops (pat, linear->lineColors); linear->pattern = pat; return Ok; } GpStatus gdip_linear_gradient_setup (GpGraphics *graphics, GpBrush *brush) { cairo_t *ct; GpLineGradient *linear; GpMatrix *product = NULL; GpStatus status = Ok; if (!graphics || !brush) return InvalidParameter; ct = graphics->ct; if (!ct) return InvalidParameter; linear = (GpLineGradient *) brush; /* We create the new pattern for brush, if the brush is changed * or if pattern has not been created yet. */ if (linear->base.changed || !linear->pattern) { /* destroy the existing pattern */ if (linear->pattern) { cairo_pattern_destroy (linear->pattern); linear->pattern = NULL; } if (linear->wrapMode == WrapModeClamp) return InvalidParameter; status = create_tile_linear (graphics, ct, linear); if ((status == Ok) && linear->pattern) { switch (linear->wrapMode) { case WrapModeTile: case WrapModeTileFlipY: cairo_pattern_set_extend (linear->pattern, CAIRO_EXTEND_REPEAT); break; case WrapModeTileFlipX: case WrapModeTileFlipXY: cairo_pattern_set_extend (linear->pattern, CAIRO_EXTEND_REFLECT); break; default : return InvalidParameter; // we will never get here but I hate warnings! } cairo_set_source (ct, linear->pattern); return gdip_get_status (cairo_status (ct)); } } if ((status == Ok) && linear->pattern) { cairo_set_source (ct, linear->pattern); return gdip_get_status (cairo_status (ct)); } return status; } static void gdip_linear_gradient_setup_initial_matrix (GpLineGradient *linear) { float cosAngle, sinAngle, absCosAngle, absSinAngle; float transX, transY, wRatio, hRatio, slope, rectRight, rectBottom; GpPointF pts[3]; GpRectF *rectf = &linear->rectangle; cosAngle = cos (linear->angle); sinAngle = sin (linear->angle); absCosAngle = fabs (cosAngle); absSinAngle = fabs (sinAngle); cairo_matrix_init_identity (&linear->matrix); transX = rectf->X + (rectf->Width / 2.0f); transY = rectf->Y + (rectf->Height / 2.0f); wRatio = (absCosAngle * rectf->Width + absSinAngle * rectf->Height) / rectf->Width; hRatio = (absSinAngle * rectf->Width + absCosAngle * rectf->Height) / rectf->Height; cairo_matrix_translate (&linear->matrix, transX, transY); cairo_matrix_rotate (&linear->matrix, linear->angle); cairo_matrix_scale (&linear->matrix, wRatio, hRatio); cairo_matrix_translate (&linear->matrix, -transX, -transY); if (linear->isAngleScalable && !gdip_near_zero (cosAngle) && !gdip_near_zero (sinAngle)) { rectRight = rectf->X + rectf->Width; rectBottom = rectf->Y + rectf->Height; pts[0].X = rectf->X; pts[0].Y = rectf->Y; pts[1].X = rectRight; pts[1].Y = rectf->Y; pts[2].X = rectf->X; pts[2].Y = rectBottom; GdipTransformMatrixPoints (&linear->matrix, pts, 3); if (sinAngle > 0 && cosAngle > 0) { slope = -1.0f / ((rectf->Width / rectf->Height) * tan (linear->angle)); pts[0].Y = (slope * (pts[0].X - rectf->X)) + rectf->Y; pts[1].X = ((pts[1].Y - rectBottom) / slope) + rectRight; pts[2].X = ((pts[2].Y - rectf->Y) / slope) + rectf->X; } else if (sinAngle > 0 && cosAngle < 0) { slope = -1.0f / ((rectf->Width / rectf->Height) * tan (linear->angle - PI / 2)); pts[0].X = ((pts[0].Y - rectBottom) / slope) + rectRight; pts[1].Y = (slope * (pts[1].X - rectRight)) + rectBottom; pts[2].Y = (slope * (pts[2].X - rectf->X)) + rectf->Y; } else if (sinAngle < 0 && cosAngle < 0) { slope = -1.0f / (((rectf->Width / rectf->Height) * tan (linear->angle))); pts[0].Y = (slope * (pts[0].X - rectRight)) + rectBottom; pts[1].X = ((pts[1].Y - rectf->Y) / slope) + rectf->X; pts[2].X = ((pts[2].Y - rectBottom) / slope) + rectRight; } else { slope = -1.0f / ((rectf->Width / rectf->Height) * tan (linear->angle - 3 * PI / 2)); pts[0].X = ((pts[0].Y - rectf->Y) / slope) + rectf->X; pts[1].Y = (slope * (pts[1].X - rectf->X)) + rectf->Y; pts[2].Y = (slope * (pts[2].X - rectRight)) + rectBottom; } gdip_matrix_init_from_rect_3points (&linear->matrix, rectf, (GpPointF*)&pts); } } // coverity[+alloc : arg-*5] GpStatus GdipCreateLineBrushI (GDIPCONST GpPoint *point1, GDIPCONST GpPoint *point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient) { GpPointF p1, p2; if (!point1 || !point2 || !lineGradient) return InvalidParameter; p1.X = point1->X; p1.Y = point1->Y; p2.X = point2->X; p2.Y = point2->Y; return GdipCreateLineBrush (&p1, &p2, color1, color2, wrapMode, lineGradient); } // coverity[+alloc : arg-*5] GpStatus GdipCreateLineBrush (GDIPCONST GpPointF *point1, GDIPCONST GpPointF *point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient) { GpLineGradient *linear; BOOL xFlipped = FALSE; BOOL yFlipped = FALSE; if (!point1 || !point2 || !lineGradient) return InvalidParameter; linear = gdip_linear_gradient_new (); if (!linear) return OutOfMemory; linear->wrapMode = wrapMode; linear->lineColors [0] = color1; linear->lineColors [1] = color2; linear->isAngleScalable = FALSE; linear->rectangle.Width = point2->X - point1->X; linear->rectangle.Height = point2->Y - point1->Y; linear->rectangle.X = linear->rectangle.Width < 0 ? point2->X : point1->X; linear->rectangle.Y = linear->rectangle.Height < 0 ? point2->Y : point1->Y; if (linear->rectangle.Width < 0) { linear->rectangle.Width = -linear->rectangle.Width; xFlipped = TRUE; } if (linear->rectangle.Height < 0) { linear->rectangle.Height = -linear->rectangle.Height; yFlipped = TRUE; } if (linear->rectangle.Height == 0) { linear->rectangle.Height = linear->rectangle.Width; linear->rectangle.Y = linear->rectangle.Y - (linear->rectangle.Height / 2.0f); linear->angle = xFlipped ? 180 : 0; } else if (linear->rectangle.Width == 0) { linear->rectangle.Width = linear->rectangle.Height; linear->rectangle.X = linear->rectangle.X - (linear->rectangle.Width / 2.0f); linear->angle = yFlipped ? 270 : 90; } else { float slope = linear->rectangle.Height / linear->rectangle.Width; float newAngleRad = atan (slope); float newAngle = (newAngleRad / (DEGTORAD)); if (xFlipped) newAngle = 180 - newAngle; if (yFlipped) newAngle = 360 - newAngle; linear->angle = newAngle; } linear->points [0].X = linear->rectangle.X; linear->points [0].Y = linear->rectangle.Y; linear->points [1].X = linear->rectangle.X + linear->rectangle.Width; linear->points [1].Y = linear->rectangle.Y; linear->angle = linear->angle * DEGTORAD; gdip_linear_gradient_setup_initial_matrix (linear); *lineGradient = linear; return Ok; } static float get_angle_from_linear_gradient_mode (LinearGradientMode mode) { switch (mode) { case LinearGradientModeVertical: return 90.0; case LinearGradientModeForwardDiagonal: return 45.0; case LinearGradientModeBackwardDiagonal: return 135.0; case LinearGradientModeHorizontal: default: return 0; } } // coverity[+alloc : arg-*5] GpStatus GdipCreateLineBrushFromRectI (GDIPCONST GpRect *rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient) { GpRectF rectf; if (!rect || !lineGradient) return InvalidParameter; rectf.X = rect->X; rectf.Y = rect->Y; rectf.Width = rect->Width; rectf.Height = rect->Height; /* FIXME: Check whether angle has to be scalable or not in case of lineargradient mode. */ return GdipCreateLineBrushFromRectWithAngle (&rectf, color1, color2, get_angle_from_linear_gradient_mode (mode), FALSE, wrapMode, lineGradient); } // coverity[+alloc : arg-*5] GpStatus GdipCreateLineBrushFromRect (GDIPCONST GpRectF *rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient) { /* FIXME: Check whether angle has to be scalable or not in case of lineargradient mode. */ return GdipCreateLineBrushFromRectWithAngle (rect, color1, color2, get_angle_from_linear_gradient_mode (mode), FALSE, wrapMode, lineGradient); } // coverity[+alloc : arg-*6] GpStatus GdipCreateLineBrushFromRectWithAngleI (GDIPCONST GpRect *rect, ARGB color1, ARGB color2, float angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient) { GpRectF rectf; if (!rect || !lineGradient) return InvalidParameter; rectf.X = rect->X; rectf.Y = rect->Y; rectf.Width = rect->Width; rectf.Height = rect->Height; return GdipCreateLineBrushFromRectWithAngle (&rectf, color1, color2, angle, isAngleScalable, wrapMode, lineGradient); } // coverity[+alloc : arg-*6] GpStatus GdipCreateLineBrushFromRectWithAngle (GDIPCONST GpRectF *rect, ARGB color1, ARGB color2, float angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient) { GpLineGradient *linear; if (!rect || !lineGradient || rect->Width == 0.0 || rect->Height == 0.0) return InvalidParameter; linear = gdip_linear_gradient_new (); linear->wrapMode = wrapMode; linear->lineColors [0] = color1; linear->lineColors [1] = color2; linear->angle = fmod (angle, 360) * DEGTORAD; linear->isAngleScalable = isAngleScalable; linear->points [0].X = rect->X; linear->points [0].Y = rect->Y; linear->points [1].X = rect->X + rect->Width + 1; linear->points [1].Y = rect->Y; memcpy (&linear->rectangle, rect, sizeof (GpRectF)); gdip_linear_gradient_setup_initial_matrix (linear); *lineGradient = linear; return Ok; } GpStatus GdipGetLineBlendCount (GpLineGradient *brush, int *count) { if (!brush || !count) return InvalidParameter; /* If count is less than 1, we are not in a proper state * to return blend property. By default, we have one blend * set. Therefore, count of 1 is acceptible. */ if (brush->blend->count < 1) return WrongState; *count = brush->blend->count; return Ok; } GpStatus GdipSetLineBlend (GpLineGradient *brush, GDIPCONST float *blend, GDIPCONST float *positions, int count) { float *blendFactors; float *blendPositions; int index; if (!brush || !blend || !positions || (count < 2)) return InvalidParameter; if (brush->blend->count != count) { blendFactors = (float *) GdipAlloc (count * sizeof (float)); if (!blendFactors) return OutOfMemory; blendPositions = (float *) GdipAlloc (count * sizeof (float)); if (!blendPositions) { GdipFree (blendFactors); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blendFactors; brush->blend->positions = blendPositions; } for (index = 0; index < count; index++) { brush->blend->factors [index] = blend [index]; brush->blend->positions [index] = positions [index]; } brush->blend->count = count; /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 0) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 0; } brush->base.changed = TRUE; return Ok; } GpStatus GdipGetLineBlend (GpLineGradient *brush, float *blend, float *positions, int count) { if (!brush || !blend || !positions || (brush->blend->count != count)) return InvalidParameter; /* If count is less than 1, we are not in a proper state * to return blend property. By default, we have one blend * set. Therefore, count of 1 is acceptible. */ if (brush->blend->count < 1) return WrongState; memcpy (blend, brush->blend->factors, count * sizeof (float)); memcpy (positions, brush->blend->positions, count * sizeof (float)); return Ok; } GpStatus GdipSetLineGammaCorrection (GpLineGradient *brush, BOOL useGammaCorrection) { if (!brush) return InvalidParameter; brush->gammaCorrection = useGammaCorrection; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetLineGammaCorrection (GpLineGradient *brush, BOOL *useGammaCorrection) { if (!brush || !useGammaCorrection) return InvalidParameter; *useGammaCorrection = brush->gammaCorrection; return Ok; } GpStatus GdipGetLinePresetBlendCount (GpLineGradient *brush, int *count) { if (!brush || !count) return InvalidParameter; /* If count is less than 2, we are not in a proper state * to return presetblend property. */ if (brush->presetColors->count < 2) return WrongState; *count = brush->presetColors->count; return Ok; } GpStatus GdipSetLinePresetBlend (GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST float *positions, int count) { ARGB *blendColors; float *blendPositions; int index; if (!brush || !blend || !positions || (count < 2)) return InvalidParameter; if (brush->presetColors->count != count) { blendColors = (ARGB *) GdipAlloc (count * sizeof (ARGB)); if (!blendColors) return OutOfMemory; blendPositions = (float *) GdipAlloc (count * sizeof (float)); if (!blendPositions) { GdipFree (blendColors); return OutOfMemory; } /* free the existing values */ if (brush->presetColors->count != 0) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); } brush->presetColors->colors = blendColors; brush->presetColors->positions = blendPositions; } for (index = 0; index < count; index++) { brush->presetColors->colors [index] = blend [index]; brush->presetColors->positions [index] = positions [index]; } brush->presetColors->count = count; /* we clear the blend when setting preset colors */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); brush->blend->count = 0; } brush->base.changed = TRUE; return Ok; } GpStatus GdipGetLinePresetBlend (GpLineGradient *brush, ARGB *blend, float *positions, int count) { if (!brush || !blend || !positions || (brush->presetColors->count != count)) return InvalidParameter; /* If count is less than 2, we are not in a proper state * to return presetblend property. */ if (brush->presetColors->count < 2) return WrongState; memcpy (blend, brush->presetColors->colors, count * sizeof (ARGB)); memcpy (positions, brush->presetColors->positions, count * sizeof (float)); return Ok; } GpStatus GdipSetLineColors (GpLineGradient *brush, ARGB color1, ARGB color2) { if (!brush) return InvalidParameter; brush->lineColors[0] = color1; brush->lineColors[1] = color2; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetLineColors (GpLineGradient *brush, ARGB *colors) { if (!brush || !colors) return InvalidParameter; colors [0] = brush->lineColors[0]; colors [1] = brush->lineColors[1]; return Ok; } GpStatus GdipGetLineRectI (GpLineGradient *brush, GpRect *rect) { if (!brush || !rect) return InvalidParameter; rect->X = (int) brush->rectangle.X; rect->Y = (int) brush->rectangle.Y; rect->Width = (int) brush->rectangle.Width; rect->Height = (int) brush->rectangle.Height; return Ok; } GpStatus GdipGetLineRect (GpLineGradient *brush, GpRectF *rect) { if (!brush || !rect) return InvalidParameter; memcpy (rect, &brush->rectangle, sizeof (GpRectF)); return Ok; } GpStatus GdipGetLineTransform (GpLineGradient *brush, GpMatrix *matrix) { if (!brush || !matrix) return InvalidParameter; gdip_cairo_matrix_copy (matrix, &brush->matrix); return Ok; } GpStatus GdipSetLineTransform (GpLineGradient *brush, GDIPCONST GpMatrix *matrix) { GpStatus status; BOOL invertible; if (!brush || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; gdip_cairo_matrix_copy (&brush->matrix, matrix); brush->base.changed = TRUE; return Ok; } GpStatus GdipGetLineWrapMode (GpLineGradient *brush, GpWrapMode *wrapMode) { if (!brush || !wrapMode) return InvalidParameter; *wrapMode = brush->wrapMode; return Ok; } GpStatus GdipSetLineWrapMode (GpLineGradient *brush, GpWrapMode wrapMode) { if (!brush || (wrapMode == WrapModeClamp)) return InvalidParameter; brush->wrapMode = wrapMode; brush->base.changed = TRUE; return Ok; } GpStatus GdipSetLineLinearBlend (GpLineGradient *brush, float focus, float scale) { float *blends; float *positions; int count = 3; if (!brush) return InvalidParameter; if (focus == 0 || focus == 1) { count = 2; } if (brush->blend->count != count) { blends = (float *) GdipAlloc (count * sizeof (float)); if (!blends) return OutOfMemory; positions = (float *) GdipAlloc (count * sizeof (float)); if (!positions) { GdipFree (blends); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blends; brush->blend->positions = positions; } /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 0) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 0; } /* set the blend colors */ if (focus == 0) { brush->blend->positions [0] = focus; brush->blend->factors [0] = scale; brush->blend->positions [1] = 1; brush->blend->factors [1] = 0; } else if (focus == 1) { brush->blend->positions [0] = 0; brush->blend->factors [0] = 0; brush->blend->positions [1] = focus; brush->blend->factors [1] = scale; } else { brush->blend->positions [0] = 0; brush->blend->factors [0] = 0; brush->blend->positions [1] = focus; brush->blend->factors [1] = scale; brush->blend->positions [2] = 1; brush->blend->factors [2] = 0; } brush->blend->count = count; brush->base.changed = TRUE; return Ok; } GpStatus GdipSetLineSigmaBlend (GpLineGradient *brush, float focus, float scale) { float *blends; float *positions; float pos = 0.0; int count = 511; /* total no of samples */ int index; float sigma; float mean; float fall_off_len = 2.0; /* curve fall off length in terms of SIGMA */ float delta; /* distance between two samples */ /* we get a curve not starting from 0 and not ending at 1. * so we subtract the starting value and divide by the curve * height to make it fit in the 0 to scale range */ float curve_bottom; float curve_top; float curve_height; if (!brush) return InvalidParameter; if (focus == 0 || focus == 1) { count = 256; } if (brush->blend->count != count) { blends = (float *) GdipAlloc (count * sizeof (float)); if (!blends) return OutOfMemory; positions = (float *) GdipAlloc (count * sizeof (float)); if (!positions) { GdipFree (blends); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blends; brush->blend->positions = positions; } /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 0) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 0; } /* Set the blend colors. We use integral of the Normal Distribution, * i.e. Cumulative Distribution Function (CFD). * * Normal distribution: * * y (x) = (1 / sqrt (2 * PI * sq (sigma))) * exp (-sq (x - mu)/ (2 * sq (sigma))) * * where, y = height of normal curve, * sigma = standard deviation * mu = mean * OR * y (x) = peak * exp ( - z * z / 2) * where, z = (x - mu) / sigma * * In this curve, peak would occur at mean i.e. for x = mu. This results in * a peak value of peak = (1 / sqrt (2 * PI * sq (sigma))). * * Cumulative distribution function: * Ref: http://mathworld.wolfram.com/NormalDistribution.html * * D (x) = (1 / 2) [1 + erf (z)] * where, z = (x - mu) / (sigma * sqrt (2)) * */ if (focus == 0) { /* right part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = 1.0 / fall_off_len; mean = 0.5; delta = 1.0 / 255.0; curve_bottom = 0.5 * (1.0 - gdip_erf (1.0, sigma, mean)); curve_top = 0.5 * (1.0 - gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; /* set the start */ brush->blend->positions [0] = focus; brush->blend->factors [0] = scale; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 - gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = 1.0; brush->blend->factors [count - 1] = 0.0; } else if (focus == 1) { /* left part of the curve with a complete rise in fall_off_len * SIGMAs */ sigma = 1.0 / fall_off_len; mean = 0.5; delta = 1.0 / 255.0; curve_bottom = 0.5 * (1.0 + gdip_erf (0.0, sigma, mean)); curve_top = 0.5 * (1.0 + gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; /* set the start */ brush->blend->positions [0] = 0.0; brush->blend->factors [0] = 0.0; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 + gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = focus; brush->blend->factors [count - 1] = scale; } else { /* left part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = focus / (2 * fall_off_len); mean = focus / 2.0; delta = focus / 255.0; /* set the start */ brush->blend->positions [0] = 0.0; brush->blend->factors [0] = 0.0; curve_bottom = 0.5 * (1.0 + gdip_erf (0.0, sigma, mean)); curve_top = 0.5 * (1.0 + gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 + gdip_erf (pos, sigma, mean)) - curve_bottom); } brush->blend->positions [index] = focus; brush->blend->factors [index] = scale; /* right part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = (1.0 - focus) / (2 * fall_off_len); mean = (1.0 + focus) / 2.0; delta = (1.0 - focus) / 255.0; curve_bottom = 0.5 * (1.0 - gdip_erf (1.0, sigma, mean)); curve_top = 0.5 * (1.0 - gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; index ++; pos = focus + delta; for (; index < 510; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 - gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = 1.0; brush->blend->factors [count - 1] = 0.0; } brush->blend->count = count; brush->base.changed = TRUE; return Ok; } GpStatus GdipMultiplyLineTransform (GpLineGradient *brush, GpMatrix *matrix, GpMatrixOrder order) { GpStatus status; BOOL invertible; if (!brush || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; /* note: error handling is different from GdipMultiplyMatrix */ if (order == MatrixOrderAppend) cairo_matrix_multiply (&brush->matrix, &brush->matrix, matrix); else cairo_matrix_multiply (&brush->matrix, matrix, &brush->matrix); brush->base.changed = TRUE; return Ok; } GpStatus GdipResetLineTransform (GpLineGradient *brush) { if (!brush) return InvalidParameter; cairo_matrix_init_identity (&brush->matrix); brush->base.changed = TRUE; return Ok; } GpStatus GdipRotateLineTransform (GpLineGradient *brush, float angle, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipRotateMatrix (&brush->matrix, angle, order)) == Ok) brush->base.changed = TRUE; return status; } GpStatus GdipScaleLineTransform (GpLineGradient *brush, float sx, float sy, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipScaleMatrix (&brush->matrix, sx, sy, order)) == Ok) brush->base.changed = TRUE; return status; } GpStatus GdipTranslateLineTransform (GpLineGradient *brush, float dx, float dy, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipTranslateMatrix (&brush->matrix, dx, dy, order)) == Ok) brush->base.changed = TRUE; return status; } libgdiplus-4.2/src/pen.h0000664000175000017500000001075012377405421012172 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __PEN_H__ #define __PEN_H__ GpStatus GdipCreatePen1 (ARGB argb, REAL width, GpUnit unit, GpPen **pen); GpStatus GdipCreatePen2 (GpBrush *brush, REAL width, GpUnit unit, GpPen **pen); GpStatus GdipClonePen (GpPen *pen, GpPen **clonedpen); GpStatus GdipDeletePen (GpPen *pen); GpStatus GdipSetPenWidth (GpPen *pen, REAL width); GpStatus GdipGetPenWidth (GpPen *pen, REAL *width); GpStatus GdipSetPenBrushFill (GpPen *pen, GpBrush *brush); GpStatus GdipGetPenBrushFill (GpPen *pen, GpBrush **brush); GpStatus GdipGetPenFillType (GpPen *pen, GpPenType *penType); GpStatus GdipSetPenColor (GpPen *pen, ARGB color); GpStatus GdipGetPenColor (GpPen *pen, ARGB *color); GpStatus GdipSetPenDashStyle (GpPen *pen, GpDashStyle dashStyle); GpStatus GdipGetPenDashStyle (GpPen *pen, GpDashStyle *dashStyle); GpStatus GdipSetPenDashOffset (GpPen *pen, REAL offset); GpStatus GdipGetPenDashOffset (GpPen *pen, REAL *offset); GpStatus GdipGetPenDashCount (GpPen *pen, INT *count); GpStatus GdipSetPenDashArray (GpPen *pen, GDIPCONST REAL *dash, INT count); GpStatus GdipGetPenDashArray (GpPen *pen, REAL *dash, INT count); GpStatus GdipSetPenCompoundArray (GpPen *pen, GDIPCONST REAL *dash, INT count); GpStatus GdipGetPenCompoundArray (GpPen *pen, REAL *dash, INT count); GpStatus GdipGetPenCompoundCount (GpPen *pen, INT *count); GpStatus GdipSetPenMode (GpPen *pen, GpPenAlignment penMode); GpStatus GdipGetPenMode (GpPen *pen, GpPenAlignment *penMode); GpStatus GdipSetPenMiterLimit (GpPen *pen, REAL miterLimit); GpStatus GdipGetPenMiterLimit (GpPen *pen, REAL *miterLimit); GpStatus GdipSetPenLineCap197819 (GpPen *pen, GpLineCap startCap, GpLineCap endCap, GpDashCap dashCap); GpStatus GdipSetPenStartCap (GpPen *pen, GpLineCap startCap); GpStatus GdipGetPenStartCap (GpPen *pen, GpLineCap *startCap); GpStatus GdipSetPenEndCap (GpPen *pen, GpLineCap endCap); GpStatus GdipGetPenEndCap (GpPen *pen, GpLineCap *endCap); GpStatus GdipSetPenDashCap197819 (GpPen *pen, GpDashCap dashCap); GpStatus GdipGetPenDashCap197819 (GpPen *pen, GpDashCap *dashCap); GpStatus GdipSetPenLineJoin (GpPen *pen, GpLineJoin lineJoin); GpStatus GdipGetPenLineJoin (GpPen *pen, GpLineJoin *lineJoin); GpStatus GdipSetPenCustomStartCap (GpPen *pen, GpCustomLineCap *customCap); GpStatus GdipGetPenCustomStartCap (GpPen *pen, GpCustomLineCap **customCap); GpStatus GdipSetPenCustomEndCap (GpPen *pen, GpCustomLineCap *customCap); GpStatus GdipGetPenCustomEndCap (GpPen *pen, GpCustomLineCap **customCap); GpStatus GdipSetPenTransform (GpPen *pen, GpMatrix *matrix); GpStatus GdipGetPenTransform (GpPen *pen, GpMatrix *matrix); GpStatus GdipResetPenTransform (GpPen *pen); GpStatus GdipMultiplyPenTransform (GpPen *pen, GpMatrix *matrix, GpMatrixOrder order); GpStatus GdipTranslatePenTransform (GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order); GpStatus GdipScalePenTransform (GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order); GpStatus GdipRotatePenTransform (GpPen *pen, REAL angle, GpMatrixOrder order); /* missing API GdipGetPenUnit GdipSetPenUnit */ #endif libgdiplus-4.2/src/codecs.h0000664000175000017500000000476212377405421012656 00000000000000/* * codecs.h * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __CODECS_H__ #define __CODECS_H__ #include "win32structs.h" #include "gdipenums.h" typedef struct { GUID Guid; ULONG NumberOfValues; ULONG Type; VOID* Value; } EncoderParameter; typedef struct { UINT Count; EncoderParameter Parameter[1]; } EncoderParameters; typedef struct { CLSID Clsid; GUID FormatID; const WCHAR* CodecName; const WCHAR* DllName; const WCHAR* FormatDescription; const WCHAR* FilenameExtension; const WCHAR* MimeType; DWORD Flags; DWORD Version; DWORD SigCount; DWORD SigSize; const BYTE* SigPattern; const BYTE* SigMask; } ImageCodecInfo; GpStatus GdipGetImageDecodersSize (UINT *numDecoders, UINT *size); GpStatus GdipGetImageDecoders (UINT numDecoders, UINT size, ImageCodecInfo *decoders); GpStatus GdipGetImageEncodersSize (UINT *numEncoders, UINT *size); GpStatus GdipGetImageEncoders (UINT numEncoders, UINT size, ImageCodecInfo *encoders); #endif libgdiplus-4.2/src/image-private.h0000664000175000017500000000423112377405421014137 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __IMAGE_PRIVATE_H__ #define __IMAGE_PRIVATE_H__ #include "gdiplus-private.h" #include "codecs-private.h" typedef enum { BMP, TIF, GIF, PNG, JPEG, EXIF, WMF, EMF, ICON, MEMBMP, INVALID } ImageFormat; int gdip_get_pixel_format_depth (PixelFormat pixfmt) GDIP_INTERNAL; int gdip_get_pixel_format_components (PixelFormat pixfmt) GDIP_INTERNAL; int gdip_get_pixel_format_bpp (PixelFormat pixfmt) GDIP_INTERNAL; BOOL gdip_is_an_indexed_pixelformat (PixelFormat pixfmt) GDIP_INTERNAL; void gdip_image_init (GpImage *image) GDIP_INTERNAL; #include "image.h" #endif libgdiplus-4.2/src/graphics-cairo-private.h0000664000175000017500000001614512377405421015757 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __GRAPHICS_CAIRO_PRIVATE_H__ #define __GRAPHICS_CAIRO_PRIVATE_H__ #include "gdiplus-private.h" #include "brush-private.h" #include "matrix-private.h" /* constant for make_ellipse */ #define C1 0.552285 /* * Cairo use doubles almost everywhere so we can define most int-based functions to the float based one */ #define cairo_DrawLineI cairo_DrawLine #define cairo_DrawPieI cairo_DrawPie #define cairo_FillPieI cairo_FillPie #define cairo_DrawRectangleI cairo_DrawRectangle #define cairo_FillRectangleI cairo_FillRectangle /* * Handling of pens with a width greater than 1 is not identical between GDI+ and Cairo * * On cairo >= 1.12 pen adjustment is not required or tons of tests senstive to this break. */ #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) #define gdip_cairo_pen_width_needs_adjustment(pen) (0) #else #define gdip_cairo_pen_width_needs_adjustment(pen) (((int)(pen->width) & 1) == 0) #endif cairo_fill_rule_t gdip_convert_fill_mode (FillMode fill_mode) GDIP_INTERNAL; GpStatus gdip_plot_path (GpGraphics *graphics, GpPath *path, BOOL antialiasing) GDIP_INTERNAL; GpStatus cairo_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus cairo_DrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus cairo_DrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) GDIP_INTERNAL; GpStatus cairo_DrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) GDIP_INTERNAL; GpStatus cairo_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus cairo_DrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus cairo_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension) GDIP_INTERNAL; GpStatus cairo_DrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension) GDIP_INTERNAL; GpStatus cairo_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension) GDIP_INTERNAL; GpStatus cairo_FillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension) GDIP_INTERNAL; GpStatus cairo_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension) GDIP_INTERNAL; GpStatus cairo_DrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension) GDIP_INTERNAL; GpStatus cairo_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus cairo_DrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus cairo_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus cairo_FillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus cairo_DrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) GDIP_INTERNAL; GpStatus cairo_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus cairo_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus cairo_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus cairo_FillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus cairo_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; GpStatus cairo_DrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL; GpStatus cairo_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; GpStatus cairo_FillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL; GpStatus cairo_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) GDIP_INTERNAL; GpStatus cairo_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) GDIP_INTERNAL; GpStatus cairo_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus cairo_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus cairo_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus cairo_DrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus cairo_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode) GDIP_INTERNAL; GpStatus cairo_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode) GDIP_INTERNAL; GpStatus cairo_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) GDIP_INTERNAL; GpStatus cairo_GraphicsClear (GpGraphics *graphics, ARGB color) GDIP_INTERNAL; GpStatus cairo_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) GDIP_INTERNAL; GpStatus cairo_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) GDIP_INTERNAL; GpStatus cairo_SetGraphicsClip (GpGraphics *graphics) GDIP_INTERNAL; GpStatus cairo_ResetClip (GpGraphics *graphics) GDIP_INTERNAL; GpStatus cairo_ResetWorldTransform (GpGraphics *graphics) GDIP_INTERNAL; GpStatus cairo_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) GDIP_INTERNAL; #endif libgdiplus-4.2/src/fontcollection.h0000664000175000017500000000437312377405421014436 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __FONTCOLLECTION_H__ #define __FONTCOLLECTION_H__ /* FontCollection public API (only!) */ GpStatus GdipDeletePrivateFontCollection (GpFontCollection** fontCollection); GpStatus GdipGetFontCollectionFamilyCount (GpFontCollection* fontCollection, INT* numFound); GpStatus GdipGetFontCollectionFamilyList (GpFontCollection* fontCollection, INT numSought, GpFontFamily* gpfamilies[], INT* numFound); GpStatus GdipNewInstalledFontCollection (GpFontCollection** fontCollection); GpStatus GdipNewPrivateFontCollection (GpFontCollection** fontCollection); GpStatus GdipPrivateAddFontFile (GpFontCollection* fontCollection, GDIPCONST WCHAR* filename); GpStatus GdipPrivateAddMemoryFont (GpFontCollection *fontCollection, GDIPCONST void *memory, INT length); #endif libgdiplus-4.2/src/lineargradientbrush.h0000664000175000017500000001100112377405421015432 00000000000000/* * lineargradientbrush.h * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * Copyright (C) 2004, 2007 Novell, Inc. http://www.novell.com */ #ifndef __LINEAR_GRADIENT_H__ #define __LINEAR_GRADIENT_H__ #include "brush-private.h" typedef enum { LinearGradientModeHorizontal = 0, /* angle = 0 deg */ LinearGradientModeVertical = 1, /* angle = 90 deg */ LinearGradientModeForwardDiagonal = 2, /* angle = 45 deg */ LinearGradientModeBackwardDiagonal = 3 /* angle = 135 deg */ } LinearGradientMode; GpStatus GdipCreateLineBrushI (GDIPCONST GpPoint *point1, GDIPCONST GpPoint *point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipCreateLineBrush (GDIPCONST GpPointF *point1, GDIPCONST GpPointF *point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipCreateLineBrushFromRectI (GDIPCONST GpRect *rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipCreateLineBrushFromRect (GDIPCONST GpRectF *rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipCreateLineBrushFromRectWithAngleI (GDIPCONST GpRect *rect, ARGB color1, ARGB color2, float angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipCreateLineBrushFromRectWithAngle (GDIPCONST GpRectF *rect, ARGB color1, ARGB color2, float angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient); GpStatus GdipGetLineBlendCount (GpLineGradient *brush, int *count); GpStatus GdipSetLineBlend (GpLineGradient *brush, GDIPCONST float *blend, GDIPCONST float *positions, int count); GpStatus GdipGetLineBlend (GpLineGradient *brush, float *blend, float *positions, int count); GpStatus GdipSetLineGammaCorrection (GpLineGradient *brush, BOOL useGammaCorrection); GpStatus GdipGetLineGammaCorrection (GpLineGradient *brush, BOOL *useGammaCorrection); GpStatus GdipGetLinePresetBlendCount (GpLineGradient *brush, int *count); GpStatus GdipSetLinePresetBlend (GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST float *positions, int count); GpStatus GdipGetLinePresetBlend (GpLineGradient *brush, ARGB *blend, float *positions, int count); GpStatus GdipSetLineColors (GpLineGradient *brush, ARGB color1, ARGB color2); GpStatus GdipGetLineColors (GpLineGradient *brush, ARGB *colors); GpStatus GdipGetLineRectI (GpLineGradient *brush, GpRect *rect); GpStatus GdipGetLineRect (GpLineGradient * brush, GpRectF *rect); GpStatus GdipSetLineTransform (GpLineGradient *brush, GDIPCONST GpMatrix *matrix); GpStatus GdipGetLineTransform (GpLineGradient *brush, GpMatrix *matrix); GpStatus GdipSetLineWrapMode (GpLineGradient *brush, GpWrapMode wrapMode); GpStatus GdipGetLineWrapMode (GpLineGradient *brush, GpWrapMode *wrapMode); GpStatus GdipSetLineLinearBlend (GpLineGradient *brush, float focus, float scale); GpStatus GdipSetLineSigmaBlend (GpLineGradient *brush, float focus, float scale); GpStatus GdipMultiplyLineTransform (GpLineGradient *brush, GpMatrix *matrix, GpMatrixOrder order); GpStatus GdipResetLineTransform (GpLineGradient *brush); GpStatus GdipRotateLineTransform (GpLineGradient *brush, float angle, GpMatrixOrder order); GpStatus GdipScaleLineTransform (GpLineGradient *brush, float sx, float sy, GpMatrixOrder order); GpStatus GdipTranslateLineTransform (GpLineGradient *brush, float dx, float dy, GpMatrixOrder order); #endif libgdiplus-4.2/src/brush.h0000664000175000017500000000275712377405421012543 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Ravindra (rkumar@novell.com) * * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef __BRUSH_H__ #define __BRUSH_H__ typedef struct _InterpolationColors { ARGB* colors; float *positions; int count; } InterpolationColors; GpStatus GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush); GpStatus GdipDeleteBrush (GpBrush *brush); GpStatus GdipGetBrushType (GpBrush *brush, GpBrushType *type); #endif libgdiplus-4.2/src/graphics-path-private.h0000664000175000017500000000401112377405421015603 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __GRAPHICS_PATH_PRIVATE_H__ #define __GRAPHICS_PATH_PRIVATE_H__ #include "gdiplus-private.h" #include "graphics-private.h" #include "stringformat-private.h" typedef struct _Path { FillMode fill_mode; int count; GByteArray *types; GArray *points; BOOL start_new_fig; /* Flag to keep track if we need to start a new figure */ } Path; BOOL gdip_path_has_curve (GpPath *path) GDIP_INTERNAL; #include "graphics-path.h" #endif libgdiplus-4.2/src/metafile-private.h0000664000175000017500000001756512377405421014661 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __METAFILE_PRIVATE_H__ #define __METAFILE_PRIVATE_H__ #include "gdiplus-private.h" #include "codecs-private.h" #include "bitmap-private.h" #include "matrix-private.h" #include "bmpcodec.h" #include "emfcodec.h" #include "wmfcodec.h" /* * http://wvware.sourceforge.net/caolan/ora-wmf.html */ #define ALDUS_PLACEABLE_METAFILE_KEY 0x9AC6CDD7 #define WMF_TYPE_AND_HEADERSIZE_KEY 0x00090001 #define EMF_EMR_HEADER_KEY 0x1 /* this has to do with 25.4mm in an inch (but why is it multiplied by 100 ?) */ #define METAFILE_DIMENSION_FACTOR 2540 #define MM_PER_INCH 25.4f /* match System.Drawing.Imaging.MetafileType */ #define METAFILETYPE_INVALID 0 #define METAFILETYPE_WMF 1 #define METAFILETYPE_WMFPLACEABLE 2 #define METAFILETYPE_EMF 3 #define METAFILETYPE_EMFPLUSONLY 4 #define METAFILETYPE_EMFPLUSDUAL 5 /* object types */ #define METAOBJECT_TYPE_EMPTY 0 #define METAOBJECT_TYPE_PEN 1 #define METAOBJECT_TYPE_BRUSH 2 #define GDIP_EMFPLUS_RECORD_BASE 16384 #define gdip_get_metaheader(image) (&((GpMetafile*)image)->metafile_header) #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define GETDW(x) (*(DWORD*)(data + (x))) #else #define GETDW(x) (GUINT32_FROM_LE(*(DWORD*)(data + (x)))) #endif typedef struct { void *ptr; int type; } MetaObject; struct _Metafile { GpImage base; MetafileHeader metafile_header; BOOL delete; BYTE *data; int length; BOOL recording; /* recording into memory (data), file (fp) or user stream (stream) */ FILE *fp; void *stream; }; typedef struct { GpMetafile *metafile; int x, y, width, height; int objects_count; MetaObject *objects; MetaObject created; GpGraphics *graphics; GpMatrix initial; GpMatrix matrix; DWORD bk_mode; DWORD bk_color; float miter_limit; int selected_pen; int selected_brush; int selected_font; int selected_palette; int map_mode; FillMode fill_mode; int current_x, current_y; /* path related data */ BOOL use_path; GpPath *path; int path_x, path_y; /* stock objects */ GpPen *stock_pen_white; GpPen *stock_pen_black; GpPen *stock_pen_null; GpSolidFill *stock_brush_white; GpSolidFill *stock_brush_ltgray; GpSolidFill *stock_brush_gray; GpSolidFill *stock_brush_dkgray; GpSolidFill *stock_brush_black; GpSolidFill *stock_brush_null; /* bitmap representation */ BYTE *scan0; } MetafilePlayContext; typedef struct { int num; GpPointF *points; } PointFList; GpStatus gdip_get_metafile_from (void *pointer, GpMetafile **metafile, ImageSource source) GDIP_INTERNAL; GpStatus gdip_metafile_clone (GpMetafile *metafile, GpMetafile **clonedmetafile) GDIP_INTERNAL; GpStatus gdip_metafile_dispose (GpMetafile *metafile) GDIP_INTERNAL; GpStatus gdip_metafile_stop_recording (GpMetafile *metafile) GDIP_INTERNAL; GpStatus gdip_metafile_play_emf (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_play_wmf (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_play_emfplus_block (MetafilePlayContext *context, BYTE* data, int length) GDIP_INTERNAL; MetafilePlayContext* gdip_metafile_play_setup (GpMetafile *metafile, GpGraphics *graphics, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus gdip_metafile_play (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_play_cleanup (MetafilePlayContext *context) GDIP_INTERNAL; GpPen* gdip_metafile_GetSelectedPen (MetafilePlayContext *context) GDIP_INTERNAL; GpBrush* gdip_metafile_GetSelectedBrush (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus GdiComment (MetafilePlayContext *context, BYTE* data, DWORD size) GDIP_INTERNAL; GpStatus gdip_metafile_SaveDC (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_SetBkMode (MetafilePlayContext *context, DWORD bkMode) GDIP_INTERNAL; GpStatus gdip_metafile_SetMapMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL; GpStatus gdip_metafile_SetROP2 (MetafilePlayContext *context, DWORD rop) GDIP_INTERNAL; GpStatus gdip_metafile_SetRelabs (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL; GpStatus gdip_metafile_SetPolyFillMode (MetafilePlayContext *context, DWORD mode) GDIP_INTERNAL; GpStatus gdip_metafile_SetStretchBltMode (MetafilePlayContext *context, int iStretchMode) GDIP_INTERNAL; GpStatus gdip_metafile_RestoreDC (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_SelectObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL; GpStatus gdip_metafile_ModifyWorldTransform (MetafilePlayContext *context, XFORM *lpXform, DWORD iMode) GDIP_INTERNAL; GpStatus gdip_metafile_SetTextAlign (MetafilePlayContext *context, DWORD textalign) GDIP_INTERNAL; GpStatus gdip_metafile_DeleteObject (MetafilePlayContext *context, DWORD slot) GDIP_INTERNAL; GpStatus gdip_metafile_SetBkColor (MetafilePlayContext *context, DWORD color) GDIP_INTERNAL; GpStatus gdip_metafile_SetWindowOrg (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL; GpStatus gdip_metafile_SetWindowExt (MetafilePlayContext *context, int height, int width) GDIP_INTERNAL; GpStatus gdip_metafile_LineTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL; GpStatus gdip_metafile_MoveTo (MetafilePlayContext *context, int x, int y) GDIP_INTERNAL; GpStatus gdip_metafile_SetMiterLimit (MetafilePlayContext *context, float eNewLimit, float *peOldLimit) GDIP_INTERNAL; GpStatus gdip_metafile_CreatePenIndirect (MetafilePlayContext *context, DWORD style, DWORD width, DWORD color) GDIP_INTERNAL; GpStatus gdip_metafile_ExtCreatePen (MetafilePlayContext *context, DWORD dwPenStyle, DWORD dwWidth, CONST LOGBRUSH *lplb, DWORD dwStyleCount, CONST DWORD *lpStyle) GDIP_INTERNAL; GpStatus gdip_metafile_CreateBrushIndirect (MetafilePlayContext *context, DWORD style, DWORD color, DWORD hatch) GDIP_INTERNAL; GpStatus gdip_metafile_Arc (MetafilePlayContext *context, int left, int top, int right, int bottom, int xstart, int ystart, int xend, int yend) GDIP_INTERNAL; GpStatus gdip_metafile_StretchDIBits (MetafilePlayContext *context, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, CONST void *lpBits, CONST BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop) GDIP_INTERNAL; GpStatus gdip_metafile_PolyBezier (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL; GpStatus gdip_metafile_Polygon (MetafilePlayContext *context, GpPointF *points, int count) GDIP_INTERNAL; GpStatus gdip_metafile_BeginPath (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_EndPath (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_CloseFigure (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_FillPath (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_StrokePath (MetafilePlayContext *context) GDIP_INTERNAL; GpStatus gdip_metafile_StrokeAndFillPath (MetafilePlayContext *context) GDIP_INTERNAL; #include "metafile.h" #endif libgdiplus-4.2/src/text.h0000664000175000017500000000415612377405421012377 00000000000000/* * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #ifndef __TEXT_H__ #define __TEXT_H__ /* Text public API (only!) */ GpStatus GdipDrawString (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GpBrush *brush); GpStatus GdipMeasureString (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, int *codepointsFitted, int *linesFilled); GpStatus GdipMeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *string, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, int regionCount, GpRegion **regions); /* missing API GdipDrawDriverString GdipMeasureDriverString */ #endif libgdiplus-4.2/src/brush-private.h0000664000175000017500000000437112377405421014205 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __BRUSH_PRIVATE_H__ #define __BRUSH_PRIVATE_H__ #include "gdiplus-private.h" typedef struct { float *factors; float *positions; int count; } Blend; typedef struct _BrushClass { /* Brush virtual functions */ GpBrushType type; GpStatus (*setup) (GpGraphics *graphics, GpBrush *brush); GpStatus (*clone_brush) (GpBrush *brush, GpBrush **clonedBrush); GpStatus (*destroy) (GpBrush *brush); } BrushClass; typedef struct _Brush { BrushClass *vtable; BOOL changed; } Brush; void gdip_brush_init (GpBrush *brush, BrushClass* vtable) GDIP_INTERNAL; GpStatus gdip_brush_setup (GpGraphics *graphics, GpBrush *brush) GDIP_INTERNAL; #include "brush.h" #endif libgdiplus-4.2/src/stringformat.h0000664000175000017500000000741712377405421014135 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __STRINGFORMAT_H__ #define __STRINGFORMAT_H__ /* StringFormat public API (only!) */ GpStatus GdipCreateStringFormat (INT formatAttributes, LANGID language, GpStringFormat **format); GpStatus GdipStringFormatGetGenericDefault (GpStringFormat **format); GpStatus GdipStringFormatGetGenericTypographic (GpStringFormat **format); GpStatus GdipCloneStringFormat (GDIPCONST GpStringFormat* format, GpStringFormat** newFormat); GpStatus GdipDeleteStringFormat (GpStringFormat *format); GpStatus GdipGetStringFormatAlign (GDIPCONST GpStringFormat *format, StringAlignment *align); GpStatus GdipSetStringFormatAlign (GpStringFormat *format, StringAlignment align); GpStatus GdipGetStringFormatDigitSubstitution (GDIPCONST GpStringFormat *format, LANGID *language, StringDigitSubstitute *substitute); GpStatus GdipSetStringFormatDigitSubstitution (GpStringFormat *format, LANGID language, StringDigitSubstitute substitute); GpStatus GdipGetStringFormatFlags (GDIPCONST GpStringFormat *format, INT *flags); GpStatus GdipSetStringFormatFlags (GpStringFormat *format, INT flags); GpStatus GdipGetStringFormatHotkeyPrefix (GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); GpStatus GdipSetStringFormatHotkeyPrefix (GpStringFormat *format, INT hotkeyPrefix); GpStatus GdipGetStringFormatLineAlign (GDIPCONST GpStringFormat *format, StringAlignment *align); GpStatus GdipSetStringFormatLineAlign (GpStringFormat *format, StringAlignment align); GpStatus GdipGetStringFormatMeasurableCharacterRangeCount (GDIPCONST GpStringFormat *format, INT *count); GpStatus GdipSetStringFormatMeasurableCharacterRanges (GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges); GpStatus GdipGetStringFormatTabStopCount (GDIPCONST GpStringFormat *format, INT *count); GpStatus GdipGetStringFormatTabStops (GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); GpStatus GdipSetStringFormatTabStops (GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); GpStatus GdipGetStringFormatTrimming (GDIPCONST GpStringFormat *format, StringTrimming *trimming); GpStatus GdipSetStringFormatTrimming (GpStringFormat *format, StringTrimming trimming); #endif libgdiplus-4.2/src/text-metafile-private.h0000664000175000017500000000307512377405421015632 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __TEXT_METAFILE_PRIVATE_H__ #define __TEXT_METAFILE_PRIVATE_H__ #include "gdiplus-private.h" GpStatus metafile_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; #endif libgdiplus-4.2/src/region.h0000664000175000017500000000675612377405421012706 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __REGION_H__ #define __REGION_H__ GpStatus GdipCreateRegion (GpRegion **region); GpStatus GdipCreateRegionRect (GDIPCONST GpRectF *rect, GpRegion **region); GpStatus GdipCreateRegionRectI (GDIPCONST GpRect *rect, GpRegion **region); GpStatus GdipCreateRegionPath (GpPath *path, GpRegion **region); GpStatus GdipCreateRegionRgnData (GDIPCONST BYTE *regionData, INT size, GpRegion **region); GpStatus GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); GpStatus GdipDeleteRegion(GpRegion *region); GpStatus GdipSetInfinite(GpRegion *region); GpStatus GdipSetEmpty(GpRegion *region); GpStatus GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode combineMode); GpStatus GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, CombineMode combineMode); GpStatus GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); GpStatus GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, CombineMode combineMode); GpStatus GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect); GpStatus GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); GpStatus GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisibleRegionPoint(GpRegion *region, float x, float y, GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisibleRegionPointI(GpRegion *region, int x, int y, GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisibleRegionRect(GpRegion *region, float x, float y, float width, float height, GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisibleRegionRectI(GpRegion *region, int x, int y, int width, int height, GpGraphics *graphics, BOOL *result); GpStatus GdipGetRegionScansCount(GpRegion *region, int* count, GpMatrix* matrix); GpStatus GdipGetRegionScans(GpRegion *region, GpRectF* rects, int* count, GpMatrix* matrix); GpStatus GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics, BOOL *result); GpStatus GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); GpStatus GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT *sizeFilled); GpStatus GdipTranslateRegion(GpRegion *region, float dx, float dy); GpStatus GdipTranslateRegionI(GpRegion *region, int dx, int dy); GpStatus GdipTransformRegion(GpRegion *region, GpMatrix *matrix); #endif libgdiplus-4.2/src/adjustablearrowcap.h0000664000175000017500000000470712377405421015272 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __ADJUSTABLEARROWCAP_H__ #define __ADJUSTABLEARROWCAP_H__ /* AdjustableArrowCap public API (only!) */ GpStatus GdipCreateAdjustableArrowCap (REAL height, REAL width, BOOL isFilled, GpAdjustableArrowCap **arrowCap); GpStatus GdipGetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, REAL *height); GpStatus GdipSetAdjustableArrowCapHeight (GpAdjustableArrowCap *arrowCap, REAL height); GpStatus GdipGetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, REAL *width); GpStatus GdipSetAdjustableArrowCapWidth (GpAdjustableArrowCap *arrowCap, REAL width); GpStatus GdipGetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, REAL *middleInset); GpStatus GdipSetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *arrowCap, REAL middleInset); GpStatus GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL isFilled); GpStatus GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *arrowCap, BOOL *isFilled); #endif libgdiplus-4.2/src/texturebrush.h0000664000175000017500000000335612377405421014160 00000000000000/* * texturebrush.h * * Author: * Ravindra (rkumar@novell.com) * * Copyright (C) 2004,2006-2007 Novell, Inc. http://www.novell.com */ /* * NOTE: This header file contains ONLY public definitions and MUST match the GDI+ definitions. */ #ifndef __TEXTUREBRUSH_H__ #define __TEXTUREBRUSH_H__ GpStatus GdipCreateTexture (GpImage *image, GpWrapMode wrapMode, GpTexture **texture); GpStatus GdipCreateTexture2 (GpImage *image, GpWrapMode wrapMode, float x, float y, float width, float height, GpTexture **texture); GpStatus GdipCreateTexture2I (GpImage *image, GpWrapMode wrapMode, int x, int y, int width, int height, GpTexture **texture); GpStatus GdipCreateTextureIA (GpImage *image, GpImageAttributes *imageAttributes, float x, float y, float width, float height, GpTexture **texture); GpStatus GdipCreateTextureIAI (GpImage *image, GpImageAttributes *imageAttributes, int x, int y, int width, int height, GpTexture **texture); GpStatus GdipGetTextureTransform (GpTexture *texture, GpMatrix *matrix); GpStatus GdipSetTextureTransform (GpTexture *texture, GDIPCONST GpMatrix *matrix); GpStatus GdipResetTextureTransform (GpTexture *texture); GpStatus GdipMultiplyTextureTransform (GpTexture *texture, GpMatrix *matrix, GpMatrixOrder order); GpStatus GdipTranslateTextureTransform (GpTexture *texture, float dx, float dy, GpMatrixOrder order); GpStatus GdipScaleTextureTransform (GpTexture *texture, float sx, float sy, GpMatrixOrder order); GpStatus GdipRotateTextureTransform (GpTexture *texture, float angle, GpMatrixOrder order); GpStatus GdipSetTextureWrapMode (GpTexture *texture, GpWrapMode wrapMode); GpStatus GdipGetTextureWrapMode (GpTexture *texture, GpWrapMode *wrapMode); GpStatus GdipGetTextureImage (GpTexture *texture, GpImage **image); #endif libgdiplus-4.2/src/pathgradientbrush.c0000664000175000017500000010006412377405421015117 00000000000000/* * pathgradientbrush.c * * Copyright (C) 2003-2004,2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Vladimir Vukicevic (vladimir@pobox.com) * Ravindra (rkumar@novell.com) * */ #include "pathgradientbrush-private.h" #include "graphics-private.h" #include "graphics-path-private.h" #include "matrix-private.h" static GpStatus gdip_pgrad_setup (GpGraphics *graphics, GpBrush *brush); static GpStatus gdip_pgrad_clone_brush (GpBrush *brush, GpBrush **clonedBrush); static GpStatus gdip_pgrad_destroy (GpBrush *brush); static BrushClass pathgradient_vtable = { BrushTypePathGradient, gdip_pgrad_setup, gdip_pgrad_clone_brush, gdip_pgrad_destroy }; static void gdip_pathgradient_init (GpPathGradient *pg) { gdip_brush_init (&pg->base, &pathgradient_vtable); pg->boundary = NULL; pg->boundaryColors = (ARGB *) GdipAlloc (sizeof (ARGB)); *(pg->boundaryColors) = MAKE_ARGB_ARGB(255,255,255,255); /* default boundary color is white */ pg->boundaryColorsCount = 1; /* one default boundary color */ pg->focusScales.X = 0.0f; pg->focusScales.Y = 0.0f; pg->wrapMode = WrapModeClamp; cairo_matrix_init_identity (&pg->transform); pg->presetColors = (InterpolationColors *) GdipAlloc (sizeof (InterpolationColors)); pg->presetColors->count = 1; pg->presetColors->colors = (ARGB *) GdipAlloc (sizeof (ARGB)); pg->presetColors->positions = (float *) GdipAlloc (sizeof (float)); pg->presetColors->colors [0] = MAKE_ARGB_ARGB(0,0,0,0); pg->presetColors->positions[0] = 0.0; pg->blend = (Blend *) GdipAlloc (sizeof (Blend)); pg->blend->count = 1; pg->blend->factors = (float *) GdipAlloc (sizeof (float)); pg->blend->positions = (float *) GdipAlloc (sizeof (float)); pg->blend->factors [0] = 1.0; pg->blend->positions[0] = 0.0; pg->rectangle.X = 0.0; pg->rectangle.Y = 0.0; pg->rectangle.Width = 0.0; pg->rectangle.Height = 0.0; pg->pattern = NULL; } static GpPathGradient* gdip_pathgradient_new (void) { GpPathGradient *result = (GpPathGradient *) GdipAlloc (sizeof (GpPathGradient)); if (result) gdip_pathgradient_init (result); return result; } GpStatus gdip_pgrad_clone_brush (GpBrush *brush, GpBrush **clonedBrush) { GpPathGradient *pgbrush; GpPathGradient *newbrush; if (!brush || !clonedBrush) return InvalidParameter; newbrush = (GpPathGradient *) GdipAlloc (sizeof (GpPathGradient)); if (!newbrush) return OutOfMemory; pgbrush = (GpPathGradient *) brush; newbrush->base = pgbrush->base; if (pgbrush->boundary) { GdipClonePath (pgbrush->boundary, &newbrush->boundary); } else { newbrush->boundary = NULL; } newbrush->boundaryColors = GdipAlloc (sizeof(ARGB) * pgbrush->boundaryColorsCount); if (!newbrush->boundaryColors) goto NO_BOUNDARY_COLORS; memcpy (newbrush->boundaryColors, pgbrush->boundaryColors, sizeof(ARGB) * pgbrush->boundaryColorsCount); newbrush->boundaryColorsCount = pgbrush->boundaryColorsCount; newbrush->focusScales = pgbrush->focusScales; newbrush->center = pgbrush->center; newbrush->centerColor = pgbrush->centerColor; newbrush->wrapMode = pgbrush->wrapMode; gdip_cairo_matrix_copy (&newbrush->transform, &pgbrush->transform); newbrush->rectangle.X = pgbrush->rectangle.X; newbrush->rectangle.Y = pgbrush->rectangle.Y; newbrush->rectangle.Width = pgbrush->rectangle.Width; newbrush->rectangle.Height = pgbrush->rectangle.Height; newbrush->presetColors = (InterpolationColors *) GdipAlloc (sizeof (InterpolationColors)); if (newbrush->presetColors == NULL) goto NO_PRESET; newbrush->presetColors->count = pgbrush->presetColors->count; if (pgbrush->presetColors->count > 0) { newbrush->presetColors->colors = (ARGB *) GdipAlloc (pgbrush->presetColors->count * sizeof (ARGB)); if (newbrush->presetColors->colors == NULL) goto NO_PRESET_COLORS; memcpy (newbrush->presetColors->colors, pgbrush->presetColors->colors, pgbrush->presetColors->count * sizeof (ARGB)); newbrush->presetColors->positions = (float *) GdipAlloc (pgbrush->presetColors->count * sizeof (float)); if (newbrush->presetColors->positions == NULL) goto NO_PRESET_POSITIONS; memcpy (newbrush->presetColors->positions, pgbrush->presetColors->positions, pgbrush->presetColors->count * sizeof (float)); } else { memcpy (newbrush->presetColors, pgbrush->presetColors, sizeof (InterpolationColors)); } newbrush->blend = (Blend *) GdipAlloc (sizeof (Blend)); if (newbrush->blend == NULL) goto NO_BLEND; newbrush->blend->count = pgbrush->blend->count; if (pgbrush->blend->count > 0) { newbrush->blend->factors = (float *) GdipAlloc (pgbrush->blend->count * sizeof (float)); if (newbrush->blend->factors == NULL) goto NO_BLEND_FACTORS; memcpy (newbrush->blend->factors, pgbrush->blend->factors, pgbrush->blend->count * sizeof (ARGB)); newbrush->blend->positions = (float *) GdipAlloc (pgbrush->blend->count * sizeof (float)); if (newbrush->blend->positions == NULL) goto NO_BLEND_POSITIONS; memcpy (newbrush->blend->positions, pgbrush->blend->positions, pgbrush->blend->count * sizeof (float)); } else { memcpy (newbrush->blend, pgbrush->blend, sizeof (Blend)); } goto SUCCESS; NO_BLEND_POSITIONS: GdipFree (newbrush->blend->factors); NO_BLEND_FACTORS: GdipFree (newbrush->blend); NO_BLEND: NO_PRESET_POSITIONS: GdipFree (newbrush->presetColors->colors); NO_PRESET_COLORS: GdipFree (newbrush->presetColors); NO_PRESET: GdipFree (newbrush->boundaryColors); NO_BOUNDARY_COLORS: GdipFree (newbrush); return OutOfMemory; SUCCESS: /* Let the clone to create its own pattern */ newbrush->base.changed = TRUE; newbrush->pattern = NULL; *clonedBrush = (GpBrush *) newbrush; return Ok; } GpStatus gdip_pgrad_destroy (GpBrush *brush) { /* a. the NULL check for brush is done by the caller, GdipDeleteBrush */ /* b. brush itself is freed by the caller */ GpPathGradient *pgbrush = (GpPathGradient *) brush; if (pgbrush->boundary) { GdipDeletePath (pgbrush->boundary); pgbrush->boundary = NULL; } if (pgbrush->boundaryColors) { GdipFree (pgbrush->boundaryColors); pgbrush->boundaryColors = NULL; } if (pgbrush->pattern) { cairo_pattern_destroy (pgbrush->pattern); pgbrush->pattern = NULL; } if (pgbrush->blend) { if (pgbrush->blend->count > 0) { GdipFree (pgbrush->blend->factors); GdipFree (pgbrush->blend->positions); } GdipFree (pgbrush->blend); pgbrush->blend = NULL; } if (pgbrush->presetColors) { if (pgbrush->presetColors->count > 0) { GdipFree (pgbrush->presetColors->colors); GdipFree (pgbrush->presetColors->positions); } GdipFree (pgbrush->presetColors); pgbrush->presetColors = NULL; } return Ok; } static void add_color_stops_from_blend (cairo_pattern_t *pattern, Blend *blend, ARGB color1, ARGB color2) { int index; double sr, sg, sb, sa; double er, eg, eb, ea; double offset, factor; sa = (color1 >> 24) & 0xFF; sr = (color1 >> 16) & 0xFF; sg = (color1 >> 8) & 0xFF; sb = color1 & 0xFF; ea = (color2 >> 24) & 0xFF; er = (color2 >> 16) & 0xFF; eg = (color2 >> 8) & 0xFF; eb = color2 & 0xFF; for (index = 0; index < blend->count; index++) { factor = blend->factors [index]; offset = blend->positions [index]; cairo_pattern_add_color_stop_rgba (pattern, offset, ((sr * (1 - factor)) + (er * factor)) / 255, ((sg * (1 - factor)) + (eg * factor)) / 255, ((sb * (1 - factor)) + (eb * factor)) / 255, ((sa * (1 - factor)) + (ea * factor)) / 255); } } static void add_color_stops_from_interpolation_colors (cairo_pattern_t *pattern, InterpolationColors *presetColors) { int index; double r, g, b, a; double offset; ARGB color; /* MS accecpts positions above 1.0 also. Cairo assumes the values above 1.0 as 1.0 * and values below 0 are assumed as 0. So we get different results if any of the * offset values is out of [0.0, 1.0]. */ for (index = 0; index < presetColors->count; index++) { color = presetColors->colors [index]; a = (color >> 24) & 0xFF; r = (color >> 16) & 0xFF; g = (color >> 8) & 0xFF; b = color & 0xFF; offset = presetColors->positions [index]; cairo_pattern_add_color_stop_rgba (pattern, offset, r / 255, g / 255, b / 255, a / 255); } } GpStatus gdip_pgrad_setup (GpGraphics *graphics, GpBrush *brush) { GpPathGradient *pgbrush; GpStatus status; if (!graphics || !brush) return InvalidParameter; pgbrush = (GpPathGradient *) brush; if (pgbrush->boundary == NULL) return Ok; /* do nothing */ /* We create the new pattern for brush, if the brush is changed * or if pattern has not been created yet. */ if (pgbrush->base.changed || !pgbrush->pattern) { cairo_pattern_t *pat; float r = MIN (pgbrush->rectangle.Width / 2, pgbrush->rectangle.Height / 2); int i; /* destroy the existing pattern */ if (pgbrush->pattern) { cairo_pattern_destroy (pgbrush->pattern); pgbrush->pattern = NULL; } /* FIXME: To fully implement this function we need cairo to support path gradients. * Right now we have radial gradient which can be used, in some cases, to get the right effect. */ pat = cairo_pattern_create_radial (pgbrush->center.X, pgbrush->center.Y, 0.0f, pgbrush->center.X, pgbrush->center.Y, r); status = gdip_get_pattern_status (pat); if (status != Ok) return status; cairo_pattern_set_matrix (pat, &pgbrush->transform); if ((pgbrush->blend->count > 1) && (pgbrush->boundaryColorsCount > 0)) { /* FIXME: blending done using the a radial shape (not the path shape) */ add_color_stops_from_blend (pat, pgbrush->blend, pgbrush->boundaryColors[0], pgbrush->centerColor); } else if (pgbrush->presetColors->count > 1) { /* FIXME: copied from lineargradiantbrush, most probably not right */ add_color_stops_from_interpolation_colors (pat, pgbrush->presetColors); } else { cairo_pattern_add_color_stop_rgba (pat, 0.0f, ARGB_RED_N (pgbrush->centerColor), ARGB_GREEN_N (pgbrush->centerColor), ARGB_BLUE_N (pgbrush->centerColor), ARGB_ALPHA_N (pgbrush->centerColor)); /* if a single other boundary color is present, then we can do the a real radial */ if (pgbrush->boundaryColorsCount == 1) { ARGB c = pgbrush->boundaryColors[0]; cairo_pattern_add_color_stop_rgba (pat, 1.0f, ARGB_RED_N (c), ARGB_GREEN_N (c), ARGB_BLUE_N (c), ARGB_ALPHA_N (c)); } else { /* FIXME: otherwise we (solid-)fill with the centerColor */ } } pgbrush->pattern = pat; } cairo_set_source (graphics->ct, pgbrush->pattern); return gdip_get_status (cairo_status (graphics->ct)); } static GpPointF gdip_get_center (GDIPCONST GpPointF *points, int count) { /* Center is the mean of all the points. */ int i; GpPointF center = {0.0, 0.0}; for (i = 0; i < count; i++) { center.X += points[i].X; center.Y += points[i].Y; } center.X /= count; center.Y /= count; return center; } static BOOL gdip_has_non_empty_color (GDIPCONST ARGB *colors, int count) { int i; ARGB *c = (ARGB*)colors; for (i = 0; i < count; i++, c++) { if (*c) return TRUE; } return FALSE; } static void gdip_rect_expand_by (GpRectF *rect, GpPointF *point) { /* This method is somewhat stupid, because GpRect is x,y width,height, * instead of x0,y0 x1,y1. */ float x0 = rect->X; float y0 = rect->Y; float x1 = x0 + rect->Width; float y1 = y0 + rect->Height; if (point->X < x0) x0 = point->X; else if (point->X > x1) x1 = point->X; if (point->Y < y0) y0 = point->Y; else if (point->Y > y1) y1 = point->Y; rect->X = x0; rect->Y = y0; rect->Width = (x1 - x0); rect->Height = (y1 - y0); } /* coverity[+alloc : arg-*3] */ GpStatus GdipCreatePathGradient (GDIPCONST GpPointF *points, int count, GpWrapMode wrapMode, GpPathGradient **polyGradient) { int i; GpPathGradient *gp; GpPath *gppath = NULL; GpStatus status; GpPointF point; if (!polyGradient) return InvalidParameter; /* this match MS GDI+ behaviour */ if (!points || (count < 2)) return OutOfMemory; status = GdipCreatePath (FillModeAlternate, /* ??? */ &gppath); if (status != Ok) { if (gppath) GdipDeletePath (gppath); return status; } GdipAddPathLine2 (gppath, points, count); gp = gdip_pathgradient_new (); gp->boundary = gppath; gp->wrapMode = wrapMode; gp->center = gdip_get_center (points, count); gp->centerColor = MAKE_ARGB_ARGB(255,0,0,0); /* black center color */ /* set the bounding rectangle */ point = g_array_index (gppath->points, GpPointF, 0); /* set the first point as the edge of the rectangle */ gp->rectangle.X = point.X; gp->rectangle.Y = point.Y; for (i = 1; i < gppath->count; i++) { point = g_array_index (gppath->points, GpPointF, i); gdip_rect_expand_by (&gp->rectangle, &point); } *polyGradient = gp; return Ok; } /* coverity[+alloc : arg-*3] */ GpStatus GdipCreatePathGradientI (GDIPCONST GpPoint *points, int count, GpWrapMode wrapMode, GpPathGradient **polyGradient) { int i; GpStatus result; GpPointF *newPoints; if (!polyGradient) return InvalidParameter; /* this match MS GDI+ behaviour */ if (!points || (count < 2)) return OutOfMemory; newPoints = GdipAlloc (sizeof (GpPointF) * count); if (!newPoints) return OutOfMemory; for (i = 0; i < count; i++) { newPoints[i].X = points[i].X; newPoints[i].Y = points[i].Y; } result = GdipCreatePathGradient (newPoints, count, wrapMode, polyGradient); GdipFree (newPoints); return result; } /* coverity[+alloc : arg-*1] */ GpStatus GdipCreatePathGradientFromPath (GDIPCONST GpPath *path, GpPathGradient **polyGradient) { int i, count; GpPathGradient *gp; GpPointF *points; /* this match MS GDI+ behaviour */ if (!path || (path->count < 2)) return OutOfMemory; if (!polyGradient) return InvalidParameter; gp = gdip_pathgradient_new (); GdipClonePath ((GpPath*) path, &(gp->boundary)); GdipGetPointCount ((GpPath*) path, &count); points = (GpPointF*) GdipAlloc (count * sizeof (GpPointF)); GdipGetPathPoints ((GpPath*) path, points, count); gp->center = gdip_get_center (points, count); gp->centerColor = MAKE_ARGB_ARGB(255,255,255,255); /* white center color */ /* set the bounding rectangle */ /* set the first point as the edge of the rectangle */ gp->rectangle.X = points [0].X; gp->rectangle.Y = points [0].Y; for (i = 1; i < count; i++) { gdip_rect_expand_by (&gp->rectangle, &points[i]); } *polyGradient = gp; GdipFree (points); return Ok; } GpStatus GdipGetPathGradientCenterColor (GpPathGradient *brush, ARGB *colors) { if (!brush || !colors) return InvalidParameter; *colors = brush->centerColor; return Ok; } GpStatus GdipSetPathGradientCenterColor (GpPathGradient *brush, ARGB colors) { if (!brush) return InvalidParameter; brush->centerColor = colors; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetPathGradientSurroundColorsWithCount (GpPathGradient *brush, ARGB *colors, int *count) { int i; if (!brush || !colors || !count) return InvalidParameter; for (i = 0; i < *count && i < brush->boundaryColorsCount; i++) { colors[i] = brush->boundaryColors[i]; } *count = i; return Ok; } GpStatus GdipSetPathGradientSurroundColorsWithCount (GpPathGradient *brush, GDIPCONST ARGB *colors, int *count) { if (!brush || !colors || !count) return InvalidParameter; if ((*count < 1) || (*count > brush->boundary->count)) return InvalidParameter; /* at least one of the colors must be non-zero (i.e. not empty) */ if (!gdip_has_non_empty_color (colors, *count)) return Ok; if (*count != brush->boundaryColorsCount) { GdipFree (brush->boundaryColors); brush->boundaryColors = (ARGB *) GdipAlloc (sizeof(ARGB) * (*count)); } memcpy (brush->boundaryColors, colors, sizeof (ARGB) * (*count)); brush->boundaryColorsCount = *count; return Ok; } GpStatus GdipGetPathGradientCenterPoint (GpPathGradient *brush, GpPointF *point) { if (!brush || !point) return InvalidParameter; point->X = brush->center.X; point->Y = brush->center.Y; return Ok; } GpStatus GdipSetPathGradientCenterPoint (GpPathGradient *brush, GDIPCONST GpPointF *point) { if (!brush || !point) return InvalidParameter; brush->center.X = point->X; brush->center.Y = point->Y; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetPathGradientRect (GpPathGradient *brush, GpRectF *rect) { if (!brush || !rect) return InvalidParameter; memcpy (rect, &brush->rectangle, sizeof (GpRectF)); return Ok; } GpStatus GdipGetPathGradientSurroundColorCount (GpPathGradient *brush, int *count) { if (!brush || !count) return InvalidParameter; *count = brush->boundaryColorsCount; return Ok; } GpStatus GdipGetPathGradientBlendCount (GpPathGradient *brush, int *count) { if (!brush || !count) return InvalidParameter; /* If count is less than 1, we are not in a proper state * to return blend property. By default, we have one blend * set. Therefore, count of 1 is acceptible. */ if (brush->blend->count < 1) return WrongState; *count = brush->blend->count; return Ok; } GpStatus GdipGetPathGradientBlend (GpPathGradient *brush, float *blend, float *positions, int count) { if (!brush || !blend || !positions || (brush->blend->count != count)) return InvalidParameter; /* If count is less than 1, we are not in a proper state * to return blend property. By default, we have one blend * set. Therefore, count of 1 is acceptible. */ if (brush->blend->count < 1) return WrongState; memcpy (blend, brush->blend->factors, count * sizeof (float)); memcpy (positions, brush->blend->positions, count * sizeof (float)); return Ok; } GpStatus GdipSetPathGradientBlend (GpPathGradient *brush, GDIPCONST float *blend, GDIPCONST float *positions, int count) { float *blendFactors; float *blendPositions; int index; if (!brush || !blend || !positions || (count < 2)) return InvalidParameter; if (brush->blend->count != count) { blendFactors = (float *) GdipAlloc (count * sizeof (float)); if (!blendFactors) return OutOfMemory; blendPositions = (float *) GdipAlloc (count * sizeof (float)); if (!blendPositions) { GdipFree (blendFactors); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blendFactors; brush->blend->positions = blendPositions; } for (index = 0; index < count; index++) { brush->blend->factors [index] = blend [index]; brush->blend->positions [index] = positions [index]; } brush->blend->count = count; /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 1) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 1; brush->presetColors->colors = (ARGB *) GdipAlloc (sizeof (ARGB)); brush->presetColors->positions = (float *) GdipAlloc (sizeof (float)); } brush->presetColors->colors [0] = MAKE_ARGB_ARGB(0,0,0,0); brush->presetColors->positions[0] = 0.0; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetPathGradientPresetBlendCount (GpPathGradient *brush, int *count) { if (!brush) return InvalidParameter; *count = brush->presetColors->count; return Ok; } GpStatus GdipGetPathGradientPresetBlend (GpPathGradient *brush, ARGB *blend, float *positions, int count) { if (!brush || !blend || !positions || (brush->presetColors->count != count) || (count < 2)) return InvalidParameter; memcpy (blend, brush->presetColors->colors, count * sizeof (ARGB)); memcpy (positions, brush->presetColors->positions, count * sizeof (float)); return Ok; } GpStatus GdipSetPathGradientPresetBlend (GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST float *positions, int count) { ARGB *blendColors; float *blendPositions; int index; if (!brush || !blend || !positions || (count < 2)) return InvalidParameter; if (brush->presetColors->count != count) { blendColors = (ARGB *) GdipAlloc (count * sizeof (ARGB)); if (!blendColors) return OutOfMemory; blendPositions = (float *) GdipAlloc (count * sizeof (float)); if (!blendPositions) { GdipFree (blendColors); return OutOfMemory; } /* free the existing values */ if (brush->presetColors->count != 0) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); } brush->presetColors->colors = blendColors; brush->presetColors->positions = blendPositions; } for (index = 0; index < count; index++) { brush->presetColors->colors [index] = blend [index]; brush->presetColors->positions [index] = positions [index]; } brush->presetColors->count = count; /* we clear the blend when setting preset colors */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); brush->blend->count = 0; } brush->base.changed = TRUE; return Ok; } GpStatus GdipSetPathGradientSigmaBlend (GpPathGradient *brush, float focus, float scale) { float *blends; float *positions; float pos = 0.0; int count = 511; /* total no of samples */ int index; float sigma; float mean; float fall_off_len = 2.0; /* curve fall off length in terms of SIGMA */ float delta; /* distance between two samples */ /* we get a curve not starting from 0 and not ending at 1. * so we subtract the starting value and divide by the curve * height to make it fit in the 0 to scale range */ float curve_bottom; float curve_top; float curve_height; if (!brush) return InvalidParameter; if (focus == 0 || focus == 1) { count = 256; } if (brush->blend->count != count) { blends = (float *) GdipAlloc (count * sizeof (float)); if (!blends) return OutOfMemory; positions = (float *) GdipAlloc (count * sizeof (float)); if (!positions) { GdipFree (blends); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blends; brush->blend->positions = positions; } /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 1) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 1; brush->presetColors->colors = (ARGB *) GdipAlloc (sizeof (ARGB)); brush->presetColors->positions = (float *) GdipAlloc (sizeof (float)); } brush->presetColors->colors [0] = MAKE_ARGB_ARGB(0,0,0,0); brush->presetColors->positions[0] = 0.0; /* Set the blend colors. We use integral of the Normal Distribution, * i.e. Cumulative Distribution Function (CFD). * * Normal distribution: * * y (x) = (1 / sqrt (2 * PI * sq (sigma))) * exp (-sq (x - mu)/ (2 * sq (sigma))) * * where, y = height of normal curve, * sigma = standard deviation * mu = mean * OR * y (x) = peak * exp ( - z * z / 2) * where, z = (x - mu) / sigma * * In this curve, peak would occur at mean i.e. for x = mu. This results in * a peak value of peak = (1 / sqrt (2 * PI * sq (sigma))). * * Cumulative distribution function: * Ref: http://mathworld.wolfram.com/NormalDistribution.html * * D (x) = (1 / 2) [1 + erf (z)] * where, z = (x - mu) / (sigma * sqrt (2)) * */ if (focus == 0) { /* right part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = 1.0 / fall_off_len; mean = 0.5; delta = 1.0 / 255.0; curve_bottom = 0.5 * (1.0 - gdip_erf (1.0, sigma, mean)); curve_top = 0.5 * (1.0 - gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; /* set the start */ brush->blend->positions [0] = focus; brush->blend->factors [0] = scale; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 - gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = 1.0; brush->blend->factors [count - 1] = 0.0; } else if (focus == 1) { /* left part of the curve with a complete rise in fall_off_len * SIGMAs */ sigma = 1.0 / fall_off_len; mean = 0.5; delta = 1.0 / 255.0; curve_bottom = 0.5 * (1.0 + gdip_erf (0.0, sigma, mean)); curve_top = 0.5 * (1.0 + gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; /* set the start */ brush->blend->positions [0] = 0.0; brush->blend->factors [0] = 0.0; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 + gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = focus; brush->blend->factors [count - 1] = scale; } else { /* left part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = focus / (2 * fall_off_len); mean = focus / 2.0; delta = focus / 255.0; /* set the start */ brush->blend->positions [0] = 0.0; brush->blend->factors [0] = 0.0; curve_bottom = 0.5 * (1.0 + gdip_erf (0.0, sigma, mean)); curve_top = 0.5 * (1.0 + gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; for (index = 1, pos = delta; index < 255; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 + gdip_erf (pos, sigma, mean)) - curve_bottom); } brush->blend->positions [index] = focus; brush->blend->factors [index] = scale; /* right part of the curve with a complete fall in fall_off_len * SIGMAs */ sigma = (1.0 - focus) / (2 * fall_off_len); mean = (1.0 + focus) / 2.0; delta = (1.0 - focus) / 255.0; curve_bottom = 0.5 * (1.0 - gdip_erf (1.0, sigma, mean)); curve_top = 0.5 * (1.0 - gdip_erf (focus, sigma, mean)); curve_height = curve_top - curve_bottom; index ++; pos = focus + delta; for (; index < 510; index++, pos += delta) { brush->blend->positions [index] = pos; brush->blend->factors [index] = (scale / curve_height) * (0.5 * (1.0 - gdip_erf (pos, sigma, mean)) - curve_bottom); } /* set the end */ brush->blend->positions [count - 1] = 1.0; brush->blend->factors [count - 1] = 0.0; } brush->blend->count = count; brush->base.changed = TRUE; return Ok; } GpStatus GdipSetPathGradientLinearBlend (GpPathGradient *brush, float focus, float scale) { float *blends; float *positions; int count = 3; if (!brush) return InvalidParameter; if (focus == 0 || focus == 1) { count = 2; } if (brush->blend->count != count) { blends = (float *) GdipAlloc (count * sizeof (float)); if (!blends) return OutOfMemory; positions = (float *) GdipAlloc (count * sizeof (float)); if (!positions) { GdipFree (blends); return OutOfMemory; } /* free the existing values */ if (brush->blend->count != 0) { GdipFree (brush->blend->factors); GdipFree (brush->blend->positions); } brush->blend->factors = blends; brush->blend->positions = positions; } /* we clear the preset colors when setting the blend */ if (brush->presetColors->count != 1) { GdipFree (brush->presetColors->colors); GdipFree (brush->presetColors->positions); brush->presetColors->count = 1; brush->presetColors->colors = (ARGB *) GdipAlloc (sizeof (ARGB)); brush->presetColors->positions = (float *) GdipAlloc (sizeof (float)); } brush->presetColors->colors [0] = MAKE_ARGB_ARGB(0,0,0,0); brush->presetColors->positions[0] = 0.0; /* set the blend colors */ if (focus == 0) { brush->blend->positions [0] = focus; brush->blend->factors [0] = scale; brush->blend->positions [1] = 1; brush->blend->factors [1] = 0; } else if (focus == 1) { brush->blend->positions [0] = 0; brush->blend->factors [0] = 0; brush->blend->positions [1] = focus; brush->blend->factors [1] = scale; } else { brush->blend->positions [0] = 0; brush->blend->factors [0] = 0; brush->blend->positions [1] = focus; brush->blend->factors [1] = scale; brush->blend->positions [2] = 1; brush->blend->factors [2] = 0; } brush->blend->count = count; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetPathGradientWrapMode (GpPathGradient *brush, GpWrapMode *wrapMode) { if (!brush || !wrapMode) return InvalidParameter; *wrapMode = brush->wrapMode; return Ok; } GpStatus GdipSetPathGradientWrapMode (GpPathGradient *brush, GpWrapMode wrapMode) { if (!brush) return InvalidParameter; brush->wrapMode = wrapMode; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetPathGradientTransform (GpPathGradient *brush, GpMatrix *matrix) { if (!brush || !matrix) return InvalidParameter; /* If presetcolors are set, we are not in a proper state * to return transform property. */ if (brush->presetColors->count >= 2) return WrongState; gdip_cairo_matrix_copy (matrix, &brush->transform); return Ok; } GpStatus GdipSetPathGradientTransform (GpPathGradient *brush, GpMatrix *matrix) { GpStatus status; BOOL invertible; if (!brush || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; gdip_cairo_matrix_copy (&brush->transform, matrix); brush->base.changed = TRUE; return Ok; } GpStatus GdipResetPathGradientTransform (GpPathGradient *brush) { if (!brush) return InvalidParameter; cairo_matrix_init_identity (&brush->transform); brush->base.changed = TRUE; return Ok; } GpStatus GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order) { GpStatus status; BOOL invertible; cairo_matrix_t mat; if (!brush || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; if (order == MatrixOrderPrepend) cairo_matrix_multiply (&mat, matrix, &brush->transform); else if (order == MatrixOrderAppend) cairo_matrix_multiply (&mat, &brush->transform, matrix); gdip_cairo_matrix_copy (&brush->transform, &mat); brush->base.changed = TRUE; return Ok; } GpStatus GdipTranslatePathGradientTransform (GpPathGradient *brush, float dx, float dy, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipTranslateMatrix (&brush->transform, dx, dy, order)) == Ok) brush->base.changed = TRUE; return status; } GpStatus GdipScalePathGradientTransform (GpPathGradient *brush, float sx, float sy, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipScaleMatrix (&brush->transform, sx, sy, order)) == Ok) brush->base.changed = TRUE; return status; } GpStatus GdipRotatePathGradientTransform (GpPathGradient *brush, float angle, GpMatrixOrder order) { GpStatus status; if (!brush) return InvalidParameter; if ((status = GdipRotateMatrix (&brush->transform, angle, order)) == Ok) brush->base.changed = TRUE; return status; } GpStatus GdipGetPathGradientFocusScales (GpPathGradient *brush, float *xScale, float *yScale) { if (!brush || !xScale || !yScale) return InvalidParameter; *xScale = brush->focusScales.X; *yScale = brush->focusScales.Y; return Ok; } GpStatus GdipSetPathGradientFocusScales (GpPathGradient *brush, float xScale, float yScale) { if (!brush) return InvalidParameter; brush->focusScales.X = xScale; brush->focusScales.Y = yScale; brush->base.changed = TRUE; return Ok; } libgdiplus-4.2/src/matrix.h0000664000175000017500000000562412377405421012720 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __MATRIX_H__ #define __MATRIX_H__ GpStatus GdipCreateMatrix (GpMatrix **matrix); GpStatus GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, GpMatrix **matrix); GpStatus GdipCreateMatrix3 (GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, GpMatrix **matrix); GpStatus GdipCreateMatrix3I (GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, GpMatrix **matrix); GpStatus GdipCloneMatrix (GpMatrix *matrix, GpMatrix **cloneMatrix); GpStatus GdipDeleteMatrix (GpMatrix *matrix); GpStatus GdipSetMatrixElements (GpMatrix *matrix, float m11, float m12, float m21, float m22, float dx, float dy); GpStatus GdipMultiplyMatrix (GpMatrix *matrix, GpMatrix *matrix2, GpMatrixOrder order); GpStatus GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order); GpStatus GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order); GpStatus GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order); GpStatus GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order); GpStatus GdipInvertMatrix (GpMatrix *matrix); GpStatus GdipTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count); GpStatus GdipTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count); GpStatus GdipVectorTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count); GpStatus GdipVectorTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count); GpStatus GdipGetMatrixElements (GpMatrix *matrix, float *matrixOut); GpStatus GdipIsMatrixInvertible (GpMatrix *matrix, BOOL *result); GpStatus GdipIsMatrixIdentity (GpMatrix *matrix, BOOL *result); GpStatus GdipIsMatrixEqual (GpMatrix *matrix, GpMatrix *matrix2, BOOL *result); #endif libgdiplus-4.2/src/text-pango-private.h0000664000175000017500000000515512377405421015151 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot * * Copyright (C) 2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __TEXT_PANGO_PRIVATE_H__ #define __TEXT_PANGO_PRIVATE_H__ #include "gdiplus-private.h" #ifdef USE_PANGO_RENDERING #include #include #include "graphics-private.h" #include "stringformat-private.h" #define GDIP_WINDOWS_ACCELERATOR '&' #define GDIP_PANGOHACK_ACCELERATOR ((char)1) #define text_DrawString pango_DrawString #define text_MeasureString pango_MeasureString #define text_MeasureCharacterRanges pango_MeasureCharacterRanges PangoLayout* gdip_pango_setup_layout (cairo_t *ct, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, RectF *box, GDIPCONST GpStringFormat *format); GpStatus pango_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; GpStatus pango_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, int *codepointsFitted, int *linesFilled) GDIP_INTERNAL; GpStatus pango_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, int regionCount, GpRegion **regions) GDIP_INTERNAL; #endif #endif libgdiplus-4.2/src/Makefile.in0000664000175000017500000006423212635563136013315 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libgdiplus_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libgdiplus_la_OBJECTS = adjustablearrowcap.lo bitmap.lo brush.lo \ carbon-private.lo customlinecap.lo dstream.lo font.lo gdi32.lo \ general.lo graphics.lo graphics-cairo.lo graphics-metafile.lo \ graphics-path.lo graphics-pathiterator.lo hatchbrush.lo \ icocodec.lo image.lo imageattributes.lo lineargradientbrush.lo \ matrix.lo metafile.lo pathgradientbrush.lo pen.lo print.lo \ region.lo region-bitmap.lo region-path-tree.lo solidbrush.lo \ stringformat.lo text.lo text-cairo.lo text-pango.lo \ text-metafile.lo texturebrush.lo bmpcodec.lo emfcodec.lo \ emfplus.lo gifcodec.lo jpegcodec.lo pngcodec.lo tiffcodec.lo \ wmfcodec.lo libgdiplus_la_OBJECTS = $(am_libgdiplus_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libgdiplus_la_SOURCES) DIST_SOURCES = $(libgdiplus_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@ BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_DIR = @CAIRO_DIR@ CAIRO_LIBS = @CAIRO_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ FONTCONFIG_CONFIG = @FONTCONFIG_CONFIG@ FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ FREETYPE2_LIBS = @FREETYPE2_LIBS@ FREETYPE_CONFIG = @FREETYPE_CONFIG@ GDIPLUS_CFLAGS = @GDIPLUS_CFLAGS@ GDIPLUS_LIBS = @GDIPLUS_LIBS@ GDIPLUS_PKG_CFLAGS = @GDIPLUS_PKG_CFLAGS@ GDIPLUS_PKG_LIBS = @GDIPLUS_PKG_LIBS@ GDIPLUS_PKG_REQ = @GDIPLUS_PKG_REQ@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEXIF_CFLAGS = @LIBEXIF_CFLAGS@ LIBEXIF_LIBS = @LIBEXIF_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PANGO_CFLAGS = @PANGO_CFLAGS@ PANGO_LIBS = @PANGO_LIBS@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libgdiplus.la libgdiplus_la_SOURCES = \ adjustablearrowcap.c \ adjustablearrowcap.h \ adjustablearrowcap-private.h \ alpha-premul-table.inc \ bitmap.c \ bitmap.h \ bitmap-private.h \ brush.c \ brush.h \ brush-private.h \ carbon-private.c \ carbon-private.h \ codecs.h \ codecs-private.h \ customlinecap.c \ customlinecap.h \ customlinecap-private.h \ dstream.c \ dstream.h \ font.c \ font.h \ font-private.h \ fontcollection.h \ fontcollection-private.h \ fontfamily.h \ fontfamily-private.h \ gdi32.h \ gdi32.c \ GdiPlusFlat.h \ gdiplus-private.h \ gdip.h \ gdipenums.h \ gdipstructs.h \ general.c \ general.h \ general-private.h \ graphics.c \ graphics.h \ graphics-cairo.c \ graphics-cairo-private.h \ graphics-metafile.c \ graphics-metafile-private.h \ graphics-private.h \ graphics-path.c \ graphics-path.h \ graphics-path-private.h \ graphics-pathiterator.c \ graphics-pathiterator.h \ graphics-pathiterator-private.h \ hatchbrush.c \ hatchbrush.h \ hatchbrush-private.h \ icocodec.c \ icocodec.h \ image.c \ image.h \ image-private.h \ imageattributes.c \ imageattributes.h \ imageattributes-private.h \ lineargradientbrush.c \ lineargradientbrush.h \ lineargradientbrush-private.h \ matrix.c \ matrix.h \ matrix-private.h \ metafile.c \ metafile.h \ metafile-private.h \ pathgradientbrush.c \ pathgradientbrush.h \ pathgradientbrush-private.h \ pen.c \ pen.h \ pen-private.h \ print.c \ region.c \ region.h \ region-private.h \ region-bitmap.c \ region-bitmap.h \ region-path-tree.c \ region-path-tree.h \ solidbrush.c \ solidbrush.h \ solidbrush-private.h \ stringformat.c \ stringformat.h \ stringformat-private.h \ text.c \ text.h \ text-cairo.c \ text-cairo-private.h \ text-pango.c \ text-pango-private.h \ text-metafile.c \ text-metafile-private.h \ texturebrush.c \ texturebrush.h \ texturebrush-private.h \ win32structs.h \ bmpcodec.h \ bmpcodec.c \ emfcodec.c \ emfcodec.h \ emfplus.c \ emfplus.h \ gifcodec.h \ gifcodec.c \ jpegcodec.h \ jpegcodec.c \ pngcodec.h \ pngcodec.c \ tiffcodec.h \ tiffcodec.c \ wmfcodec.c \ wmfcodec.h libgdiplus_la_LIBADD = $(GDIPLUS_LIBS) INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libgdiplus.la: $(libgdiplus_la_OBJECTS) $(libgdiplus_la_DEPENDENCIES) $(EXTRA_libgdiplus_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libgdiplus_la_OBJECTS) $(libgdiplus_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adjustablearrowcap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmpcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/carbon-private.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/customlinecap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emfcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emfplus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdi32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/general.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gifcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics-cairo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics-metafile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics-path.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics-pathiterator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hatchbrush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icocodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imageattributes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jpegcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lineargradientbrush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metafile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pathgradientbrush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region-bitmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region-path-tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solidbrush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringformat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-cairo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-metafile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-pango.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texturebrush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcodec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmfcodec.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES .PRECIOUS: Makefile # 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: libgdiplus-4.2/src/graphics.h0000664000175000017500000003333312377405421013212 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __GRAPHICS_H__ #define __GRAPHICS_H__ /* Graphics public API (only!) */ typedef unsigned int GraphicsContainer; GpStatus GdipBeginContainer (GpGraphics *graphics, GDIPCONST GpRectF* dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state); GpStatus GdipBeginContainer2 (GpGraphics *graphics, GraphicsContainer* state); GpStatus GdipBeginContainerI (GpGraphics *graphics, GDIPCONST GpRect* dstrect, GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state); GpStatus GdipEndContainer (GpGraphics *graphics, GraphicsContainer state); GpStatus GdipCreateFromHDC (HDC hDC, GpGraphics **graphics); GpStatus GdipDeleteGraphics (GpGraphics *graphics); GpStatus GdipGetDC (GpGraphics *graphics, HDC *hDC); GpStatus GdipReleaseDC (GpGraphics *graphics, HDC hDC); GpStatus GdipRestoreGraphics (GpGraphics *graphics, unsigned int graphicsState); GpStatus GdipSaveGraphics(GpGraphics *graphics, unsigned int * state); GpStatus GdipGetWorldTransform (GpGraphics *graphics, GpMatrix *matrix); GpStatus GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix); GpStatus GdipMultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order); GpStatus GdipResetWorldTransform (GpGraphics *graphics); GpStatus GdipScaleWorldTransform (GpGraphics *graphics, float sx, float sy, GpMatrixOrder order); GpStatus GdipRotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order); GpStatus GdipTranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order); GpStatus GdipDrawArc (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); GpStatus GdipDrawArcI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); GpStatus GdipDrawBezier (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); GpStatus GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); GpStatus GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); GpStatus GdipDrawCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension); GpStatus GdipDrawCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension); GpStatus GdipDrawCurve3 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, INT offset, INT numOfSegments, REAL tension); GpStatus GdipDrawCurve3I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, INT offset, INT numOfSegments, REAL tension); GpStatus GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); GpStatus GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); GpStatus GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension); GpStatus GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension); GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height); GpStatus GdipDrawEllipseI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height); GpStatus GdipDrawImage (GpGraphics *graphics, GpImage *image, REAL x, REAL y); GpStatus GdipDrawImageI (GpGraphics *graphics, GpImage *image, INT x, INT y); GpStatus GdipDrawImageRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL width, REAL height); GpStatus GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT width, INT height); GpStatus GdipDrawImagePoints (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstPoints, INT count); GpStatus GdipDrawImagePointsI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstPoints, INT count); GpStatus GdipDrawImagePointRect (GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit); GpStatus GdipDrawImagePointRectI (GpGraphics *graphics, GpImage *image, INT x, INT y, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit); GpStatus GdipDrawImageRectRect (GpGraphics *graphics, GpImage *image, REAL dstx, REAL dsty, REAL dstwidth, REAL dstheight, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData); GpStatus GdipDrawImageRectRectI (GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData); GpStatus GdipDrawImagePointsRect (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData); GpStatus GdipDrawImagePointsRectI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, INT count, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData); GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2); GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2); GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); GpStatus GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); GpStatus GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path); GpStatus GdipDrawPie (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); GpStatus GdipDrawPieI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); GpStatus GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); GpStatus GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); GpStatus GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height); GpStatus GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height); GpStatus GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, INT count); GpStatus GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, INT count); GpStatus GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count); GpStatus GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count); GpStatus GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, REAL tension); GpStatus GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, REAL tension); GpStatus GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height); GpStatus GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height); GpStatus GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, REAL x1, REAL y1, REAL x2, REAL y2); GpStatus GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush, INT x1, INT y1, INT x2, INT y2); GpStatus GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, INT count); GpStatus GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, INT count); GpStatus GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, FillMode fillMode); GpStatus GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, FillMode fillMode); GpStatus GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count); GpStatus GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count); GpStatus GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path); GpStatus GdipFillPie (GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); GpStatus GdipFillPieI( GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); GpStatus GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region); GpStatus GdipGraphicsClear (GpGraphics *graphics, ARGB color); GpStatus GdipGetDpiX( GpGraphics *graphics, REAL *dpi); GpStatus GdipGetDpiY (GpGraphics *graphics, REAL *dpi); GpStatus GdipGetNearestColor (GpGraphics *graphics, ARGB *argb); GpStatus GdipSetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode); GpStatus GdipGetCompositingMode (GpGraphics *graphics, CompositingMode *compositingMode); GpStatus GdipSetCompositingQuality (GpGraphics *graphics, CompositingQuality compositingQuality); GpStatus GdipGetCompositingQuality (GpGraphics *graphics, CompositingQuality *compositingQuality); GpStatus GdipSetInteroplationMode (GpGraphics *graphics, InterpolationMode imode); GpStatus GdipGetInteroplationMode (GpGraphics *graphics, InterpolationMode *imode); GpStatus GdipSetPageScale (GpGraphics *graphics, REAL scale); GpStatus GdipGetPageScale (GpGraphics *graphics, REAL *scale); GpStatus GdipSetPageUnit (GpGraphics *graphics, GpUnit unit); GpStatus GdipGetPageUnit (GpGraphics *graphics, GpUnit *unit); GpStatus GdipSetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode pixelOffsetMode); GpStatus GdipGetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode); GpStatus GdipSetRenderingOrigin (GpGraphics *graphics, INT x, INT y); GpStatus GdipGetRenderingOrigin (GpGraphics *graphics, INT *x, INT *y); GpStatus GdipSetSmoothingMode (GpGraphics *graphics, SmoothingMode mode); GpStatus GdipGetSmoothingMode (GpGraphics *graphics, SmoothingMode *mode); GpStatus GdipSetTextContrast (GpGraphics *graphics, UINT contrast); GpStatus GdipGetTextContrast (GpGraphics *graphics, UINT *contrast); GpStatus GdipSetTextRenderingHint (GpGraphics *graphics, TextRenderingHint mode); GpStatus GdipGetTextRenderingHint (GpGraphics *graphics, TextRenderingHint *mode); GpStatus GdipIsVisiblePoint (GpGraphics *graphics, REAL x, REAL y, BOOL *result); GpStatus GdipIsVisiblePointI (GpGraphics *graphics, INT x, INT y, BOOL *result); GpStatus GdipIsVisibleRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, BOOL *result); GpStatus GdipIsVisibleRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, BOOL *result); GpStatus GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPointF *points, INT count); GpStatus GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, INT count); GpStatus GdipResetClip (GpGraphics *graphics); GpStatus GdipGetClip (GpGraphics *graphics, GpRegion *region); GpStatus GdipGetClipBounds (GpGraphics *graphics, GpRectF *rect); GpStatus GdipGetClipBoundsI (GpGraphics *graphics, GpRect *rect); GpStatus GdipGetVisibleClipBounds (GpGraphics *graphics, GpRectF *rect); GpStatus GdipGetVisibleClipBoundsI (GpGraphics *graphics, GpRect *rect); GpStatus GdipIsClipEmpty (GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisibleClipEmpty (GpGraphics *graphics, BOOL *result); GpStatus GdipSetClipGraphics (GpGraphics *graphics, GpGraphics *srcgraphics, CombineMode combineMode); GpStatus GdipSetClipHrgn (GpGraphics *graphics, void *hRgn, CombineMode combineMode); GpStatus GdipSetClipPath (GpGraphics *graphics, GpPath *path, CombineMode combineMode); GpStatus GdipSetClipRect (GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode combineMode); GpStatus GdipSetClipRectI (GpGraphics *graphics, INT x, INT y, INT width, INT height, CombineMode combineMode); GpStatus GdipSetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode combineMode); GpStatus GdipSetVisibleClip_linux (GpGraphics *graphics, GpRect *rect); GpStatus GdipTranslateClip (GpGraphics *graphics, REAL dx, REAL dy); GpStatus GdipTranslateClipI (GpGraphics *graphics, INT dx, INT dy); /* missing API GdipCreateFromHDC2 GdipCreateFromHWND GdipCreateFromHWNDICM GdipCreateHalftonePalette GdipResetPageTransform */ #endif libgdiplus-4.2/src/gdipenums.h0000664000175000017500000005562012377405421013410 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __GDIPENUMS_H__ #define __GDIPENUMS_H__ typedef enum { ColorAdjustTypeDefault, ColorAdjustTypeBitmap, ColorAdjustTypeBrush, ColorAdjustTypePen, ColorAdjustTypeText, ColorAdjustTypeCount, ColorAdjustTypeAny } ColorAdjustType; typedef enum { ColorChannelFlagsC = 0, ColorChannelFlagsM, ColorChannelFlagsY, ColorChannelFlagsK, ColorChannelFlagsLast } ColorChannelFlags; typedef enum { ColorMatrixFlagsDefault = 0, ColorMatrixFlagsSkipGrays = 1, ColorMatrixFlagsAltGray = 2 } ColorMatrixFlags; typedef enum { CombineModeReplace = 0, CombineModeIntersect = 1, CombineModeUnion = 2, CombineModeXor = 3, CombineModeExclude = 4, CombineModeComplement = 5 } CombineMode; typedef enum { CompositingModeSourceOver, CompositingModeSourceCopy } CompositingMode; typedef enum { CoordinateSpaceWorld, CoordinateSpacePage, CoordinateSpaceDevice } CoordinateSpace, GpCoordinateSpace; typedef enum { CustomLineCapTypeDefault = 0, CustomLineCapTypeAdjustableArrow = 1 } CustomLineCapType; typedef enum { EncoderParameterValueTypeByte = 1, EncoderParameterValueTypeASCII = 2, EncoderParameterValueTypeShort = 3, EncoderParameterValueTypeLong = 4, EncoderParameterValueTypeRational = 5, EncoderParameterValueTypeLongRange = 6, EncoderParameterValueTypeUndefined = 7, EncoderParameterValueTypeRationalRange = 8 } EncoderParameterValueType; typedef enum { FontStyleRegular = 0, FontStyleBold = 1, FontStyleItalic = 2, FontStyleUnderline = 4, FontStyleStrikeout = 8 } FontStyle; typedef enum { BrushTypeSolidColor = 0, /* Solid Brush */ BrushTypeHatchFill = 1, /* Hatch Brush */ BrushTypeTextureFill = 2, /* Texture Brush */ BrushTypePathGradient = 3, /* PathGradient Brush */ BrushTypeLinearGradient = 4 /* LinearGradient Brush */ } GpBrushType, BrushType; typedef enum { DashCapFlat = 0, DashCapRound = 2, DashCapTriangle = 3 } GpDashCap; typedef enum { DashStyleSolid = 0, /* solid line */ DashStyleDash = 1, /* dashed line */ DashStyleDot = 2, /* dotted line */ DashStyleDashDot = 3, /* alt. dash-dot */ DashStyleDashDotDot = 4, /* alt. dash-dot-dot */ DashStyleCustom = 5 /* user-defined */ } GpDashStyle; typedef enum { FillModeAlternate, FillModeWinding } FillMode, GpFillMode; typedef enum { FlushIntentionFlush = 0, FlushIntentionSync = 1 } FlushIntention, GpFlushIntention; typedef enum { LineCapFlat = 0, LineCapSquare = 1, LineCapRound = 2, LineCapTriangle = 3, LineCapNoAnchor = 0x10, LineCapSquareAnchor = 0x11, LineCapRoundAnchor = 0x12, LineCapDiamondAnchor = 0x13, LineCapArrowAnchor = 0x14, LineCapCustom = 0xff } GpLineCap; typedef enum { LineJoinMiter = 0, /* sharp corner */ LineJoinBevel = 1, /* round corner */ LineJoinRound = 2, /* circular, smooth, circular arc */ LineJoinMiterClipped = 3 /* miter, sharp or beveled corner */ } GpLineJoin; typedef enum { MatrixOrderPrepend = 0, MatrixOrderAppend = 1 } GpMatrixOrder, MatrixOrder; typedef enum { PenAlignmentCenter = 0, PenAlignmentInset = 1 } GpPenAlignment, PenAlignment; typedef enum { HotkeyPrefixNone = 0, HotkeyPrefixShow = 1, HotkeyPrefixHide = 2 } HotkeyPrefix; typedef enum { ImageFlagsNone = 0, ImageFlagsScalable = 1, ImageFlagsHasAlpha = 2, ImageFlagsHasTranslucent = 4, ImageFlagsPartiallyScalable = 8, ImageFlagsColorSpaceRGB = 16, ImageFlagsColorSpaceCMYK = 32, ImageFlagsColorSpaceGRAY = 64, ImageFlagsColorSpaceYCBCR = 128, ImageFlagsColorSpaceYCCK = 256, ImageFlagsHasRealDPI = 4096, ImageFlagsHasRealPixelSize = 8192, ImageFlagsReadOnly = 65536, ImageFlagsCaching = 131072, ImageFlagsUndocumented = 0x00040000 } ImageFlags; typedef enum { ImageLockModeRead = 1, ImageLockModeWrite = 2, ImageLockModeUserInputBuf = 4 } ImageLockMode; typedef enum { ImageTypeUnknown, ImageTypeBitmap, ImageTypeMetafile } ImageType; typedef enum { QualityModeInvalid = -1, QualityModeDefault = 0, QualityModeLow = 1, QualityModeHigh = 2 } QualityMode; typedef enum { CompositingQualityInvalid = QualityModeInvalid, CompositingQualityDefault = QualityModeDefault, CompositingQualityHighSpeed = QualityModeLow, CompositingQualityHighQuality = QualityModeHigh, CompositingQualityGammaCorrected, CompositingQualityAssumeLinear } CompositingQuality; typedef enum { HatchStyleHorizontal = 0, HatchStyleVertical = 1, HatchStyleForwardDiagonal = 2, HatchStyleBackwardDiagonal = 3, HatchStyleCross = 4, HatchStyleDiagonalCross = 5, HatchStyle05Percent = 6, HatchStyle10Percent = 7, HatchStyle20Percent = 8, HatchStyle25Percent = 9, HatchStyle30Percent = 10, HatchStyle40Percent = 11, HatchStyle50Percent = 12, HatchStyle60Percent = 13, HatchStyle70Percent = 14, HatchStyle75Percent = 15, HatchStyle80Percent = 16, HatchStyle90Percent = 17, HatchStyleLightDownwardDiagonal = 18, HatchStyleLightUpwardDiagonal = 19, HatchStyleDarkDownwardDiagonal = 20, HatchStyleDarkUpwardDiagonal = 21, HatchStyleWideDownwardDiagonal = 22, HatchStyleWideUpwardDiagonal = 23, HatchStyleLightVertical = 24, HatchStyleLightHorizontal = 25, HatchStyleNarrowVertical = 26, HatchStyleNarrowHorizontal = 27, HatchStyleDarkVertical = 28, HatchStyleDarkHorizontal = 29, HatchStyleDashedDownwardDiagonal = 30, HatchStyleDashedUpwardDiagonal = 31, HatchStyleDashedHorizontal = 32, HatchStyleDashedVertical = 33, HatchStyleSmallConfetti = 34, HatchStyleLargeConfetti = 35, HatchStyleZigZag = 36, HatchStyleWave = 37, HatchStyleDiagonalBrick = 38, HatchStyleHorizontalBrick = 39, HatchStyleWeave = 40, HatchStylePlaid = 41, HatchStyleDivot = 42, HatchStyleDottedGrid = 43, HatchStyleDottedDiamond = 44, HatchStyleShingle = 45, HatchStyleTrellis = 46, HatchStyleSphere = 47, HatchStyleSmallGrid = 48, HatchStyleSmallCheckerBoard = 49, HatchStyleLargeCheckerBoard = 50, HatchStyleOutlinedDiamond = 51, HatchStyleSolidDiamond = 52, HatchStyleLargeGrid = HatchStyleCross, HatchStyleMin = HatchStyleHorizontal, HatchStyleMax = HatchStyleSolidDiamond } GpHatchStyle, HatchStyle; typedef enum { ImageCodecFlagsEncoder = 1, ImageCodecFlagsDecoder = 2, ImageCodecFlagsSupportBitmap = 4, ImageCodecFlagsSupportVector = 8, ImageCodecFlagsSeekableEncode = 16, ImageCodecFlagsBlockingDecode = 32, ImageCodecFlagsBuiltin = 65536, ImageCodecFlagsSystem = 131072, ImageCodecFlagsUser = 262144 } ImageCodecFlags; typedef enum { InterpolationModeInvalid = QualityModeInvalid, InterpolationModeDefault = QualityModeDefault, InterpolationModeLowQuality = QualityModeLow, InterpolationModeHighQuality = QualityModeHigh, InterpolationModeBilinear, InterpolationModeBicubic, InterpolationModeNearestNeighbor, InterpolationModeHighQualityBilinear, InterpolationModeHighQualityBicubic } InterpolationMode; typedef enum { PaletteFlagsHasAlpha = 0x0001, PaletteFlagsGrayScale = 0x0002, PaletteFlagsHalftone = 0x0004 } PaletteFlags; typedef enum { PathPointTypeStart = 0x00, PathPointTypeLine = 0x01, PathPointTypeBezier = 0x03, PathPointTypePathTypeMask = 0x07, PathPointTypeDashMode = 0x10, PathPointTypePathMarker = 0x20, PathPointTypeCloseSubpath = 0x80, PathPointTypeBezier3 = 0x03 } PathPointType; typedef enum { PenTypeSolidColor = BrushTypeSolidColor, PenTypeHatchFill = BrushTypeHatchFill, PenTypeTextureFill = BrushTypeTextureFill, PenTypePathGradient = BrushTypePathGradient, PenTypeLinearGradient = BrushTypeLinearGradient, PenTypeUnknown = -1 } PenType, GpPenType; /* The pixel format spec is: * [0-7 format index] [8-15 pixel size, bits] [16-23 flags] [24-31 reserved] * so, * (ID | (bpp << 8) | flags) */ typedef enum { PixelFormatAlpha = 0x00040000, /* flag: format has alpha */ PixelFormatCanonical = 0x00200000, /* flag: unknown */ PixelFormatExtended = 0x00100000, /* flag: 16 bits per channel (16bpp grayscale and 48/64bpp rgb) */ PixelFormatGDI = 0x00020000, /* flag: supported by GDI */ PixelFormatIndexed = 0x00010000, /* flag: is palette-indexed */ PixelFormatPAlpha = 0x00080000, /* flag: alpha is pre-multiplied */ PixelFormat16bppARGB1555 = 0x00061007, PixelFormat16bppGrayScale = 0x00101004, PixelFormat16bppRGB555 = 0x00021005, PixelFormat16bppRGB565 = 0x00021006, PixelFormat1bppIndexed = 0x00030101, PixelFormat24bppRGB = 0x00021808, PixelFormat32bppARGB = 0x0026200a, PixelFormat32bppPARGB = 0x000e200b, PixelFormat32bppRGB = 0x00022009, PixelFormat48bppRGB = 0x0010300c, PixelFormat4bppIndexed = 0x00030402, PixelFormat64bppARGB = 0x0034400d, PixelFormat64bppPARGB = 0x001c400e, PixelFormat8bppIndexed = 0x00030803, PixelFormatUndefined = 0, PixelFormatDontCare = 0 } PixelFormat; typedef enum { PixelOffsetModeInvalid = QualityModeInvalid, PixelOffsetModeDefault = QualityModeDefault, PixelOffsetModeHighSpeed = QualityModeLow, PixelOffsetModeHighQuality = QualityModeHigh, PixelOffsetModeNone, PixelOffsetModeHalf } PixelOffsetMode; typedef enum { PropertyTagExifIFD = 0x8769, PropertyTagGpsIFD = 0x8825, PropertyTagNewSubfileType = 0x00FE, PropertyTagSubfileType = 0x00FF, PropertyTagImageWidth = 0x0100, PropertyTagImageHeight = 0x0101, PropertyTagBitsPerSample = 0x0102, PropertyTagCompression = 0x0103, PropertyTagPhotometricInterp = 0x0106, PropertyTagThreshHolding = 0x0107, PropertyTagCellWidth = 0x0108, PropertyTagCellHeight = 0x0109, PropertyTagFillOrder = 0x010A, PropertyTagDocumentName = 0x010D, PropertyTagImageDescription = 0x010E, PropertyTagEquipMake = 0x010F, PropertyTagEquipModel = 0x0110, PropertyTagStripOffsets = 0x0111, PropertyTagOrientation = 0x0112, PropertyTagSamplesPerPixel = 0x0115, PropertyTagRowsPerStrip = 0x0116, PropertyTagStripBytesCount = 0x0117, PropertyTagMinSampleValue = 0x0118, PropertyTagMaxSampleValue = 0x0119, PropertyTagXResolution = 0x011A, PropertyTagYResolution = 0x011B, PropertyTagPlanarConfig = 0x011C, PropertyTagPageName = 0x011D, PropertyTagXPosition = 0x011E, PropertyTagYPosition = 0x011F, PropertyTagFreeOffset = 0x0120, PropertyTagFreeByteCounts = 0x0121, PropertyTagGrayResponseUnit = 0x0122, PropertyTagGrayResponseCurve = 0x0123, PropertyTagT4Option = 0x0124, PropertyTagT6Option = 0x0125, PropertyTagResolutionUnit = 0x0128, PropertyTagPageNumber = 0x0129, PropertyTagTransferFunction = 0x012D, PropertyTagSoftwareUsed = 0x0131, PropertyTagDateTime = 0x0132, PropertyTagArtist = 0x013B, PropertyTagHostComputer = 0x013C, PropertyTagPredictor = 0x013D, PropertyTagWhitePoint = 0x013E, PropertyTagPrimaryChromaticities = 0x013F, PropertyTagColorMap = 0x0140, PropertyTagHalftoneHints = 0x0141, PropertyTagTileWidth = 0x0142, PropertyTagTileLength = 0x0143, PropertyTagTileOffset = 0x0144, PropertyTagTileByteCounts = 0x0145, PropertyTagInkSet = 0x014C, PropertyTagInkNames = 0x014D, PropertyTagNumberOfInks = 0x014E, PropertyTagDotRange = 0x0150, PropertyTagTargetPrinter = 0x0151, PropertyTagExtraSamples = 0x0152, PropertyTagSampleFormat = 0x0153, PropertyTagSMinSampleValue = 0x0154, PropertyTagSMaxSampleValue = 0x0155, PropertyTagTransferRange = 0x0156, PropertyTagJPEGProc = 0x0200, PropertyTagJPEGInterFormat = 0x0201, PropertyTagJPEGInterLength = 0x0202, PropertyTagJPEGRestartInterval = 0x0203, PropertyTagJPEGLosslessPredictors = 0x0205, PropertyTagJPEGPointTransforms = 0x0206, PropertyTagJPEGQTables = 0x0207, PropertyTagJPEGDCTables = 0x0208, PropertyTagJPEGACTables = 0x0209, PropertyTagYCbCrCoefficients = 0x0211, PropertyTagYCbCrSubsampling = 0x0212, PropertyTagYCbCrPositioning = 0x0213, PropertyTagREFBlackWhite = 0x0214, PropertyTagICCProfile = 0x8773, PropertyTagGamma = 0x0301, PropertyTagICCProfileDescriptor = 0x0302, PropertyTagSRGBRenderingIntent = 0x0303, PropertyTagImageTitle = 0x0320, PropertyTagCopyright = 0x8298, // Other tags (Adobe Image Info, etc) PropertyTagResolutionXUnit = 0x5001, PropertyTagResolutionYUnit = 0x5002, PropertyTagResolutionXLengthUnit = 0x5003, PropertyTagResolutionYLengthUnit = 0x5004, PropertyTagPrintFlags = 0x5005, PropertyTagPrintFlagsVersion = 0x5006, PropertyTagPrintFlagsCrop = 0x5007, PropertyTagPrintFlagsBleedWidth = 0x5008, PropertyTagPrintFlagsBleedWidthScale = 0x5009, PropertyTagHalftoneLPI = 0x500A, PropertyTagHalftoneLPIUnit = 0x500B, PropertyTagHalftoneDegree = 0x500C, PropertyTagHalftoneShape = 0x500D, PropertyTagHalftoneMisc = 0x500E, PropertyTagHalftoneScreen = 0x500F, PropertyTagJPEGQuality = 0x5010, PropertyTagGridSize = 0x5011, PropertyTagThumbnailFormat = 0x5012, // 0 = RAW RGB, 1 = JPEG PropertyTagThumbnailWidth = 0x5013, PropertyTagThumbnailHeight = 0x5014, PropertyTagThumbnailColorDepth = 0x5015, PropertyTagThumbnailPlanes = 0x5016, PropertyTagThumbnailRawBytes = 0x5017, PropertyTagThumbnailSize = 0x5018, PropertyTagThumbnailCompressedSize = 0x5019, PropertyTagColorTransferFunction = 0x501A, PropertyTagThumbnailData = 0x501B, // embeded image, format depends on ThumbnailFormat PropertyTagThumbnailImageWidth = 0x5020, PropertyTagThumbnailImageHeight = 0x5021, PropertyTagThumbnailBitsPerSample = 0x5022, PropertyTagThumbnailCompression = 0x5023, PropertyTagThumbnailPhotometricInterp = 0x5024, PropertyTagThumbnailImageDescription = 0x5025, PropertyTagThumbnailEquipMake = 0x5026, PropertyTagThumbnailEquipModel = 0x5027, PropertyTagThumbnailStripOffsets = 0x5028, PropertyTagThumbnailOrientation = 0x5029, PropertyTagThumbnailSamplesPerPixel = 0x502A, PropertyTagThumbnailRowsPerStrip = 0x502B, PropertyTagThumbnailStripBytesCount = 0x502C, PropertyTagThumbnailResolutionX = 0x502D, PropertyTagThumbnailResolutionY = 0x502E, PropertyTagThumbnailPlanarConfig = 0x502F, PropertyTagThumbnailResolutionUnit = 0x5030, PropertyTagThumbnailTransferFunction = 0x5031, PropertyTagThumbnailSoftwareUsed = 0x5032, PropertyTagThumbnailDateTime = 0x5033, PropertyTagThumbnailArtist = 0x5034, PropertyTagThumbnailWhitePoint = 0x5035, PropertyTagThumbnailPrimaryChromaticities = 0x5036, PropertyTagThumbnailYCbCrCoefficients = 0x5037, PropertyTagThumbnailYCbCrSubsampling = 0x5038, PropertyTagThumbnailYCbCrPositioning = 0x5039, PropertyTagThumbnailRefBlackWhite = 0x503A, PropertyTagThumbnailCopyRight = 0x503B, PropertyTagLuminanceTable = 0x5090, PropertyTagChrominanceTable = 0x5091, PropertyTagFrameDelay = 0x5100, PropertyTagLoopCount = 0x5101, PropertyTagPixelUnit = 0x5110, PropertyTagPixelPerUnitX = 0x5111, PropertyTagPixelPerUnitY = 0x5112, PropertyTagPaletteHistogram = 0x5113, // EXIF specific tag PropertyTagExifExposureTime = 0x829A, PropertyTagExifFNumber = 0x829D, PropertyTagExifExposureProg = 0x8822, PropertyTagExifSpectralSense = 0x8824, PropertyTagExifISOSpeed = 0x8827, PropertyTagExifOECF = 0x8828, PropertyTagExifVer = 0x9000, PropertyTagExifDTOrig = 0x9003, PropertyTagExifDTDigitized = 0x9004, PropertyTagExifCompConfig = 0x9101, PropertyTagExifCompBPP = 0x9102, PropertyTagExifShutterSpeed = 0x9201, PropertyTagExifAperture = 0x9202, PropertyTagExifBrightness = 0x9203, PropertyTagExifExposureBias = 0x9204, PropertyTagExifMaxAperture = 0x9205, PropertyTagExifSubjectDist = 0x9206, PropertyTagExifMeteringMode = 0x9207, PropertyTagExifLightSource = 0x9208, PropertyTagExifFlash = 0x9209, PropertyTagExifFocalLength = 0x920A, PropertyTagExifMakerNote = 0x927C, PropertyTagExifUserComment = 0x9286, PropertyTagExifDTSubsec = 0x9290, PropertyTagExifDTOrigSS = 0x9291, PropertyTagExifDTDigSS = 0x9292, PropertyTagExifFPXVer = 0xA000, PropertyTagExifColorSpace = 0xA001, PropertyTagExifPixXDim = 0xA002, PropertyTagExifPixYDim = 0xA003, PropertyTagExifRelatedWav = 0xA004, PropertyTagExifInterop = 0xA005, PropertyTagExifFlashEnergy = 0xA20B, PropertyTagExifSpatialFR = 0xA20C, PropertyTagExifFocalXRes = 0xA20E, PropertyTagExifFocalYRes = 0xA20F, PropertyTagExifFocalResUnit = 0xA210, PropertyTagExifSubjectLoc = 0xA214, PropertyTagExifExposureIndex = 0xA215, PropertyTagExifSensingMethod = 0xA217, PropertyTagExifFileSource = 0xA300, PropertyTagExifSceneType = 0xA301, PropertyTagExifCfaPattern = 0xA302, PropertyTagGpsVer = 0x0000, PropertyTagGpsLatitudeRef = 0x0001, PropertyTagGpsLatitude = 0x0002, PropertyTagGpsLongitudeRef = 0x0003, PropertyTagGpsLongitude = 0x0004, PropertyTagGpsAltitudeRef = 0x0005, PropertyTagGpsAltitude = 0x0006, PropertyTagGpsGpsTime = 0x0007, PropertyTagGpsGpsSatellites = 0x0008, PropertyTagGpsGpsStatus = 0x0009, PropertyTagGpsGpsMeasureMode = 0x000A, PropertyTagGpsGpsDop = 0x000B, PropertyTagGpsSpeedRef = 0x000C, PropertyTagGpsSpeed = 0x000D, PropertyTagGpsTrackRef = 0x000E, PropertyTagGpsTrack = 0x000F, PropertyTagGpsImgDirRef = 0x0010, PropertyTagGpsImgDir = 0x0011, PropertyTagGpsMapDatum = 0x0012, PropertyTagGpsDestLatRef = 0x0013, PropertyTagGpsDestLat = 0x0014, PropertyTagGpsDestLongRef = 0x0015, PropertyTagGpsDestLong = 0x0016, PropertyTagGpsDestBearRef = 0x0017, PropertyTagGpsDestBear = 0x0018, PropertyTagGpsDestDistRef = 0x0019, PropertyTagGpsDestDist = 0x001A } PropertyTag; typedef enum { PropertyTagTypeByte = 1, PropertyTagTypeASCII = 2, PropertyTagTypeShort = 3, PropertyTagTypeLong = 4, PropertyTagTypeRational = 5, PropertyTagTypeSByte = 6, PropertyTagTypeUndefined = 7, PropertyTagTypeSShort = 8, PropertyTagTypeSLONG = 9, PropertyTagTypeSRational = 10, PropertyTagTypeFloat = 11, PropertyTagTypeDouble = 12 } PropertyTagType; typedef enum { RotateNoneFlipNone = 0, Rotate90FlipNone = 1, Rotate180FlipNone = 2, Rotate270FlipNone = 3, RotateNoneFlipX = 4, Rotate90FlipX = 5, Rotate180FlipX = 6, Rotate270FlipX = 7, RotateNoneFlipY = Rotate180FlipX, Rotate90FlipY = Rotate270FlipX, Rotate180FlipY = RotateNoneFlipX, Rotate270FlipY = Rotate90FlipX, RotateNoneFlipXY = Rotate180FlipNone, Rotate90FlipXY = Rotate270FlipNone, Rotate180FlipXY = RotateNoneFlipNone, Rotate270FlipXY = Rotate90FlipNone } RotateFlipType; typedef enum { SmoothingModeInvalid = QualityModeInvalid, SmoothingModeDefault = QualityModeDefault, SmoothingModeHighSpeed = QualityModeLow, SmoothingModeHighQuality = QualityModeHigh, SmoothingModeNone, SmoothingModeAntiAlias } SmoothingMode; typedef enum { Ok = 0, GenericError = 1, InvalidParameter = 2, OutOfMemory = 3, ObjectBusy = 4, InsufficientBuffer = 5, NotImplemented = 6, Win32Error = 7, WrongState = 8, Aborted = 9, FileNotFound = 10, ValueOverflow = 11, AccessDenied = 12, UnknownImageFormat = 13, FontFamilyNotFound = 14, FontStyleNotFound = 15, NotTrueTypeFont = 16, UnsupportedGdiplusVersion = 17, GdiplusNotInitialized = 18, PropertyNotFound = 19, PropertyNotSupported = 20 } GpStatus; typedef enum { StringAlignmentNear = 0, StringAlignmentCenter = 1, StringAlignmentFar = 2 } StringAlignment; typedef enum { StringDigitSubstituteUser = 0, StringDigitSubstituteNone = 1, StringDigitSubstituteNational = 2, StringDigitSubstituteTraditional = 3 } StringDigitSubstitute; typedef enum { StringFormatFlagsDirectionRightToLeft = 0x00000001, StringFormatFlagsDirectionVertical = 0x00000002, StringFormatFlagsNoFitBlackBox = 0x00000004, StringFormatFlagsDisplayFormatControl = 0x00000020, StringFormatFlagsNoFontFallback = 0x00000400, StringFormatFlagsMeasureTrailingSpaces = 0x00000800, StringFormatFlagsNoWrap = 0x00001000, StringFormatFlagsLineLimit = 0x00002000, StringFormatFlagsNoClip = 0x00004000 } StringFormatFlags; typedef enum { StringTrimmingNone = 0, StringTrimmingCharacter = 1, StringTrimmingWord = 2, StringTrimmingEllipsisCharacter = 3, StringTrimmingEllipsisWord = 4, StringTrimmingEllipsisPath = 5 } StringTrimming; typedef enum { TextRenderingHintSystemDefault = 0, TextRenderingHintSingleBitPerPixelGridFit, TextRenderingHintSingleBitPerPixel, TextRenderingHintAntiAliasGridFit, TextRenderingHintAntiAlias, TextRenderingHintClearTypeGridFit } TextRenderingHint; typedef enum { UnitWorld = 0, UnitDisplay = 1, UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6, UnitCairoPoint = 7 } Unit, GpUnit; typedef enum { WarpModePerspective = 0, WarpModeBilinear = 1 } WarpMode; typedef enum { WrapModeTile = 0, WrapModeTileFlipX = 1, WrapModeTileFlipY = 2, WrapModeTileFlipXY = 3, WrapModeClamp = 4 } WrapMode, GpWrapMode; #endif libgdiplus-4.2/src/image.c0000664000175000017500000021313212402012514012446 00000000000000/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 4; -*- * * image.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine(pigolkine@gmx.de) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Jordi Mas (jordi@ximian.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot */ #include "gdiplus-private.h" #include "image-private.h" #include "imageattributes-private.h" #include "graphics-private.h" #include "matrix.h" #include "metafile-private.h" #include "bmpcodec.h" #include "pngcodec.h" #include "jpegcodec.h" #include "gifcodec.h" #include "tiffcodec.h" #include "icocodec.h" #include "emfcodec.h" #include "wmfcodec.h" /* * format guids */ extern GUID gdip_bmp_image_format_guid; extern GUID gdip_jpg_image_format_guid; extern GUID gdip_png_image_format_guid; extern GUID gdip_gif_image_format_guid; extern GUID gdip_tif_image_format_guid; extern GUID gdip_wmf_image_format_guid; extern GUID gdip_emf_image_format_guid; extern GUID gdip_ico_image_format_guid; GUID gdip_exif_image_format_guid = {0xb96b3cb2U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; GUID gdip_membmp_image_format_guid = {0xb96b3caaU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; /* * encoder param guids */ GUID GdipEncoderQuality = {0x1d5be4b5U, 0xfa4aU, 0x452dU, {0x9c, 0xdd, 0x5d, 0xb3, 0x51, 0x05, 0xe7, 0xeb}}; GUID GdipEncoderCompression = {0xe09d739dU, 0xccd4U, 0x44eeU, {0x8e, 0xba, 0x3f, 0xbf, 0x8b, 0xe4, 0xfc, 0x58}}; #define DECODERS_SUPPORTED 8 #define ENCODERS_SUPPORTED 5 static BYTE *g_decoder_list; static int g_decoders = 0; static BYTE *g_encoder_list; static int g_encoders = 0; static ImageFormat gdip_image_format_for_format_guid (GDIPCONST GUID *formatGUID) { if (memcmp (formatGUID, &gdip_bmp_image_format_guid, sizeof (GUID)) == 0) return BMP; if (memcmp (formatGUID, &gdip_jpg_image_format_guid, sizeof (GUID)) == 0) return JPEG; if (memcmp (formatGUID, &gdip_png_image_format_guid, sizeof (GUID)) == 0) return PNG; if (memcmp (formatGUID, &gdip_gif_image_format_guid, sizeof (GUID)) == 0) return GIF; if (memcmp (formatGUID, &gdip_tif_image_format_guid, sizeof (GUID)) == 0) return TIF; if (memcmp (formatGUID, &gdip_exif_image_format_guid, sizeof (GUID)) == 0) return EXIF; if (memcmp (formatGUID, &gdip_wmf_image_format_guid, sizeof (GUID)) == 0) return WMF; if (memcmp (formatGUID, &gdip_emf_image_format_guid, sizeof (GUID)) == 0) return EMF; if (memcmp (formatGUID, &gdip_ico_image_format_guid, sizeof (GUID)) == 0) return ICON; if (memcmp (formatGUID, &gdip_membmp_image_format_guid, sizeof (GUID)) == 0) return PNG; /* MemoryBmp is saved as PNG */ return INVALID; } /* hack #1 - nonplaceable WMF metafiles are supported by no signature match them in the codecs */ static const BYTE nonplaceable_wmf_sig_pattern[] = { 0x01, 0x00, 0x09, 0x00, 0x00, 0x03 }; static const BYTE nonplaceable_wmf_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const int nonplaceable_wmf_sig_count = 1; static const int nonplaceable_wmf_sig_size = 6; static BOOL signature_match (char *data, size_t data_size, int size, int count, BYTE* sig_pattern, BYTE* sig_mask) { int sig; for (sig = 0; sig < (size * count); sig += size) { BOOL match = TRUE; int p; for (p = 0; ((p < size) && (p < data_size)); p++) { BYTE *mask = (BYTE*)(&sig_mask [sig]); BYTE *pattern = (BYTE*)(&sig_pattern [sig]); if ((data [p] & mask[p]) != pattern[p]) { match = FALSE; break; } } if (match) return TRUE; } return FALSE; } static ImageFormat get_image_format (char *sig_read, size_t size_read, ImageFormat *final) { ImageCodecInfo *decoder = (ImageCodecInfo*)g_decoder_list; int index; /* look at every decoder available, this will depends on how libgdiplus is compiled */ for (index = 0; index < g_decoders; index++, decoder++) { /* for each signature in the codec */ if (signature_match (sig_read, size_read, decoder->SigSize, decoder->SigCount, (BYTE*)&decoder->SigPattern[0], (BYTE*)&decoder->SigMask[0])) { *final = gdip_image_format_for_format_guid (&decoder->FormatID); return *final; } } /* last chance - GDI+ still detects some files even if they don't match the codec signatures */ /* [mis-]handle non-placeable metafiles are WMF but reported as EMF (see #81178 for a test case) */ if (signature_match (sig_read, size_read, nonplaceable_wmf_sig_size, nonplaceable_wmf_sig_count, (BYTE*)&nonplaceable_wmf_sig_pattern[0], (BYTE*)&nonplaceable_wmf_sig_mask[0])) { *final = EMF; return WMF; } return INVALID; } /* Converts the given interpolation value to cairo_filter_t */ static cairo_filter_t gdip_get_cairo_filter (InterpolationMode imode) { cairo_filter_t filter; switch (imode) { case InterpolationModeHighQuality: case InterpolationModeHighQualityBilinear: case InterpolationModeHighQualityBicubic: return CAIRO_FILTER_BEST; case InterpolationModeNearestNeighbor: return CAIRO_FILTER_NEAREST; case InterpolationModeBilinear: return CAIRO_FILTER_BILINEAR; case InterpolationModeBicubic: return CAIRO_FILTER_GAUSSIAN; case InterpolationModeLowQuality: return CAIRO_FILTER_FAST; case InterpolationModeDefault: default: return CAIRO_FILTER_GOOD; } } void gdip_image_init (GpImage *image) { gdip_bitmap_init(image); } static void copy_pixel (BYTE *src, BYTE *trg, int size) { memcpy (trg, src, size); } static GpStatus gdip_flip_x (GpImage *image) { BYTE *src; BYTE *line; int stride; int width; int height; int pixel_size; int i; int j; stride = image->active_bitmap->stride; width = image->active_bitmap->width; height = image->active_bitmap->height; pixel_size = gdip_get_pixel_format_components (image->active_bitmap->pixel_format) * gdip_get_pixel_format_depth (image->active_bitmap->pixel_format) / 8; line = GdipAlloc (stride); src = (BYTE *) image->active_bitmap->scan0; if (line == NULL) { return OutOfMemory; } for (i = 0; i < height; i++, src += stride) { memcpy (line, src, stride); /* Save original line */ for (j = 0; j < width; j++) { copy_pixel(&line[(width - j - 1) * pixel_size], &src[j * pixel_size], pixel_size); } } GdipFree (line); return Ok; } static GpStatus gdip_flip_y (GpImage *image) { BYTE *src; BYTE *trg; BYTE *line; int stride; int height; int i; stride = image->active_bitmap->stride; height = image->active_bitmap->height; line = GdipAlloc (stride); src = (BYTE *) image->active_bitmap->scan0; trg = (BYTE *) image->active_bitmap->scan0; trg += (height-1) * stride; if (line == NULL) { return OutOfMemory; } for (i = 0; i < (height /2); i++, src += stride, trg -= stride) { memcpy (line, trg, stride); /* Save target line*/ memcpy (trg, src, stride); /* Copy src to trg*/ memcpy (src, line, stride); /* Copy trg to src*/ } GdipFree (line); return Ok; } GpStatus GdipDisposeImage (GpImage *image) { if (!image) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: return gdip_bitmap_dispose (image); case ImageTypeMetafile: return gdip_metafile_dispose ((GpMetafile*)image); default: /* imageUndefined */ g_warning ("unknown image type couldn't be disposed, ptr = %d, type %d", image, image->type); return Ok; } } /* coverity[+alloc : arg-*1] */ GpStatus GdipGetImageGraphicsContext (GpImage *image, GpGraphics **graphics) { GpGraphics *gfx; cairo_surface_t *surface; cairo_pattern_t *filter; if (!image || !graphics) return InvalidParameter; /* This function isn't allowed on metafiles - unless we're recording */ if (image->type == ImageTypeMetafile) { GpMetafile *mf = (GpMetafile*)image; if (!mf->recording) return OutOfMemory; *graphics = gdip_metafile_graphics_new (mf); return *graphics ? Ok : OutOfMemory; } if (!image->active_bitmap) return InvalidParameter; /* * Microsoft GDI+ only supports these pixel formats Format24bppRGB, Format32bppARGB, * Format32bppPARGB, Format32bppRGB, Format48bppRGB, Format64bppARGB, Format64bppPARGB * but we're limited to 24/32 inside libgdiplus */ switch (image->active_bitmap->pixel_format) { case PixelFormat24bppRGB: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: break; default: return OutOfMemory; } surface = cairo_image_surface_create_for_data ((BYTE*) image->active_bitmap->scan0, image->cairo_format, image->active_bitmap->width, image->active_bitmap->height, image->active_bitmap->stride); gfx = gdip_graphics_new (surface); gfx->dpi_x = image->active_bitmap->dpi_horz <= 0 ? gdip_get_display_dpi () : image->active_bitmap->dpi_horz; gfx->dpi_y = image->active_bitmap->dpi_vert <= 0 ? gdip_get_display_dpi () : image->active_bitmap->dpi_vert; cairo_surface_destroy (surface); gfx->image = image; gfx->type = gtMemoryBitmap; filter = cairo_pattern_create_for_surface (image->surface); cairo_pattern_set_filter (filter, gdip_get_cairo_filter (gfx->interpolation)); cairo_pattern_destroy (filter); *graphics = gfx; return Ok; } GpStatus GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y) { if (!image) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: { BitmapData *data = image->active_bitmap; return GdipDrawImageRect (graphics, image, x, y, data->width, data->height); } case ImageTypeMetafile: { MetafileHeader *metaheader = &((GpMetafile*)image)->metafile_header; return GdipDrawImageRect (graphics, image, x, y, metaheader->Width, metaheader->Height); } default: return InvalidParameter; } } GpStatus GdipDrawImage (GpGraphics *graphics, GpImage *image, float x, float y) { if (!image) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: { BitmapData *data = image->active_bitmap; return GdipDrawImageRect (graphics, image, x, y, data->width, data->height); } case ImageTypeMetafile: { MetafileHeader *metaheader = &((GpMetafile*)image)->metafile_header; return GdipDrawImageRect (graphics, image, x, y, metaheader->Width, metaheader->Height); } default: return InvalidParameter; } } GpStatus GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height) { return GdipDrawImageRect (graphics, image, x, y, width, height); } GpStatus GdipDrawImageRect (GpGraphics *graphics, GpImage *image, float x, float y, float width, float height) { cairo_pattern_t *pattern; cairo_pattern_t *org_pattern; MetafilePlayContext *metacontext = NULL; BOOL need_scaling = FALSE; double scaled_width, scaled_height; cairo_matrix_t orig_matrix; BYTE *premul = NULL; cairo_surface_t *original = NULL; if (!graphics || !image) return InvalidParameter; if ((width <= 0) || (height <= 0)) return Ok; if (image->type == ImageTypeBitmap) { /* check does not apply to metafiles, and it's better be done before converting the image */ if (gdip_is_overflow(x) || gdip_is_overflow(y)) return ValueOverflow; if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format)) { GpStatus status = OutOfMemory; GpBitmap *rgb_bitmap = gdip_convert_indexed_to_rgb (image); if (rgb_bitmap) { status = GdipDrawImageRect (graphics, rgb_bitmap, x, y, width, height); GdipDisposeImage (rgb_bitmap); } return status; } } /* conversion must be done after the recursive call to GdipDrawImageRect to remove the indexed bitmap */ if (!OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); width = gdip_unitx_convgr (graphics, width); height = gdip_unity_convgr (graphics, height); } cairo_new_path (graphics->ct); /* metafile */ if (image->type == ImageTypeMetafile) { GpStatus status; metacontext = gdip_metafile_play_setup ((GpMetafile*)image, graphics, x, y, width, height); cairo_translate (graphics->ct, x, y); status = gdip_metafile_play (metacontext); gdip_metafile_play_cleanup (metacontext); return status; } /* Create a surface for this bitmap if one doesn't exist */ gdip_bitmap_ensure_surface (image); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (image)) { premul = gdip_bitmap_get_premultiplied_scan0 (image); if (premul) { BitmapData *data = image->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = image->surface; if (width != image->active_bitmap->width || height != image->active_bitmap->height) { scaled_width = (double) width / image->active_bitmap->width; scaled_height = (double) height / image->active_bitmap->height; need_scaling = TRUE; } /* Use the original as a pattern */ pattern = cairo_pattern_create_for_surface (original); cairo_pattern_set_filter (pattern, gdip_get_cairo_filter (graphics->interpolation)); cairo_get_matrix (graphics->ct, &orig_matrix); cairo_translate (graphics->ct, x, y); if (need_scaling) cairo_scale (graphics->ct, scaled_width, scaled_height); org_pattern = cairo_get_source(graphics->ct); cairo_pattern_reference(org_pattern); cairo_set_source (graphics->ct, pattern); cairo_identity_matrix (graphics->ct); cairo_paint (graphics->ct); cairo_set_source (graphics->ct, org_pattern); cairo_set_matrix (graphics->ct, &orig_matrix); cairo_pattern_destroy (org_pattern); cairo_pattern_destroy (pattern); if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return Ok; } /* points are upper left, upper right, lower left. fourth point is extrapolated. */ GpStatus GdipDrawImagePoints (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstPoints, int count) { cairo_pattern_t *pattern; cairo_pattern_t *org_pattern; GpMatrix *matrix = NULL; cairo_matrix_t orig_matrix; GpRectF tRect; MetafilePlayContext *metacontext = NULL; BYTE *premul = NULL; cairo_surface_t *original = NULL; if (!graphics || !image || !dstPoints || (count != 3)) return InvalidParameter; cairo_new_path (graphics->ct); if (image->type == ImageTypeBitmap) { if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format)) { GpStatus status = OutOfMemory; GpBitmap *rgb_bitmap = gdip_convert_indexed_to_rgb (image); if (rgb_bitmap) { status = GdipDrawImagePoints (graphics, rgb_bitmap, dstPoints, count); GdipDisposeImage(rgb_bitmap); } return status; } tRect.Width = image->active_bitmap->width; tRect.Height = image->active_bitmap->height; } else { MetafileHeader *metaheader = &((GpMetafile*)image)->metafile_header; tRect.Width = metaheader->Width; tRect.Height = metaheader->Height; } tRect.X = 0; tRect.Y = 0; GdipCreateMatrix3 (&tRect, dstPoints, &matrix); /* metafile */ if (image->type == ImageTypeMetafile) { GpStatus status; metacontext = gdip_metafile_play_setup ((GpMetafile*)image, graphics, tRect.X, tRect.Y, tRect.Width, tRect.Height); cairo_get_matrix (graphics->ct, &orig_matrix); cairo_set_matrix (graphics->ct, matrix); status = gdip_metafile_play (metacontext); GdipDeleteMatrix (matrix); gdip_metafile_play_cleanup (metacontext); return status; } /* Create a surface for this bitmap if one doesn't exist */ gdip_bitmap_ensure_surface (image); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (image)) { premul = gdip_bitmap_get_premultiplied_scan0 (image); if (premul) { BitmapData *data = image->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = image->surface; pattern = cairo_pattern_create_for_surface (original); cairo_pattern_set_filter (pattern, gdip_get_cairo_filter (graphics->interpolation)); org_pattern = cairo_get_source(graphics->ct); cairo_pattern_reference(org_pattern); cairo_get_matrix(graphics->ct, &orig_matrix); cairo_set_matrix (graphics->ct, matrix); cairo_set_source_surface (graphics->ct, image->surface, 0, 0); cairo_paint (graphics->ct); cairo_set_source(graphics->ct, org_pattern); cairo_set_matrix (graphics->ct, &orig_matrix); GdipDeleteMatrix (matrix); cairo_pattern_destroy (org_pattern); cairo_pattern_destroy (pattern); if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return Ok; } GpStatus GdipDrawImagePointsI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstPoints, int count) { GpPointF points[3]; int i; if (!dstPoints || (count != 3)) return InvalidParameter; for (i = 0; i < 3; i++) { points[i].X = dstPoints[i].X; points[i].Y = dstPoints[i].Y; } return GdipDrawImagePoints (graphics, image, points, 3); } GpStatus GdipDrawImagePointRect (GpGraphics *graphics, GpImage *image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit) { return GdipDrawImageRectRect (graphics, image, x, y, srcwidth, srcheight, srcx, srcy, srcwidth, srcheight, srcUnit, NULL, NULL, NULL); } GpStatus GdipDrawImagePointRectI (GpGraphics *graphics, GpImage *image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit) { return GdipDrawImagePointRect (graphics, image, x, y, srcx, srcy, srcwidth, srcheight, srcUnit); } GpStatus GdipDrawImageRectRect (GpGraphics *graphics, GpImage *image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData) { cairo_pattern_t *pattern; cairo_pattern_t *orig; cairo_matrix_t mat; void *dest; void *org; int org_format; BOOL allocated = FALSE; BYTE *premul = NULL; cairo_surface_t *original = NULL; if (!graphics || !image) return InvalidParameter; switch (srcUnit) { case UnitPixel: break; case UnitPoint: case UnitInch: case UnitDocument: case UnitMillimeter: if (graphics->type != gtPostScript) return NotImplemented; /* GDI+ returns the same */ break; case UnitWorld: case UnitDisplay: default: return InvalidParameter; } if (image->type == ImageTypeBitmap) { if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format)) { GpStatus status = OutOfMemory; GpBitmap *rgb_bitmap = gdip_convert_indexed_to_rgb (image); if (rgb_bitmap) { status = GdipDrawImageRectRect (graphics, rgb_bitmap, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); GdipDisposeImage (rgb_bitmap); } return status; } } else { /* metafile support */ return NotImplemented; } /* see OPTIMIZE_CONVERSION in general.h */ if ((srcUnit != UnitPixel) && (srcUnit != UnitWorld) && ((srcUnit != UnitDisplay) || (graphics->type != gtPostScript))) { dstx = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_x, graphics->type, dstx); dsty = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_y, graphics->type, dsty); dstwidth = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_x, graphics->type, dstwidth); dstheight = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_y, graphics->type, dstheight); srcx = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_x, graphics->type, srcx); srcy = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_y, graphics->type, srcy); srcwidth = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_x, graphics->type, srcwidth); srcheight = gdip_unit_conversion (srcUnit, UnitCairoPoint, graphics->dpi_y, graphics->type, srcheight); } org = dest = image->active_bitmap->scan0; org_format = image->active_bitmap->pixel_format; gdip_process_bitmap_attributes (image, &dest, (GpImageAttributes *) imageAttributes, &allocated); /* If allocated is true we have a newly allocated and altered Scan0 in dest */ if (allocated) { image->active_bitmap->scan0 = dest; } /* Drop the existing surface if attributes are being applied since the surface might be out-of-date */ if ((image->surface != NULL) && (imageAttributes != NULL)) { cairo_surface_destroy (image->surface); image->surface = NULL; } cairo_matrix_init (&mat, 1, 0, 0, 1, 0, 0); if (imageAttributes && imageAttributes->wrapmode != WrapModeClamp) { float posx; float posy; BOOL flipXOn = (imageAttributes->wrapmode == WrapModeTileFlipX); BOOL flipYOn = (imageAttributes->wrapmode == WrapModeTileFlipY); BOOL flipX = FALSE; BOOL flipY = FALSE; GpBitmap *imgflipX = NULL; GpBitmap *imgflipY = NULL; GpBitmap *imgflipXY = NULL; float img_width = image->active_bitmap->width * (dstwidth / srcwidth); float img_height = image->active_bitmap->height * (dstheight / srcheight); BYTE *premul = NULL; BYTE *premulX = NULL; BYTE *premulY = NULL; BYTE *premulXY = NULL; cairo_surface_t *original = NULL; cairo_surface_t *originalX = NULL; cairo_surface_t *originalY = NULL; cairo_surface_t *originalXY = NULL; cairo_surface_t *cur_surface; if (imageAttributes->wrapmode == WrapModeTileFlipXY) { flipXOn = flipYOn = TRUE; } if (flipXOn) { /* We're ok just cloning the bitmap, we don't need the image data * and we destroy it before we leave this function */ gdip_bitmap_clone (image, &imgflipX); gdip_flip_x (imgflipX); gdip_bitmap_ensure_surface (imgflipX); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (imgflipX)) { premulX = gdip_bitmap_get_premultiplied_scan0 (imgflipX); if (premulX) { BitmapData *data = imgflipX->active_bitmap; originalX = cairo_image_surface_create_for_data (premulX, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!originalX) originalX = imgflipX->surface; } if (flipYOn) { gdip_bitmap_clone (image, &imgflipY); gdip_flip_y (imgflipY); gdip_bitmap_ensure_surface (imgflipY); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (imgflipY)) { premulY = gdip_bitmap_get_premultiplied_scan0 (imgflipY); if (premulY) { BitmapData *data = imgflipY->active_bitmap; originalY = cairo_image_surface_create_for_data (premulY, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!originalY) originalY = imgflipY->surface; } if (flipXOn && flipYOn) { gdip_bitmap_clone (image, &imgflipXY); gdip_flip_x (imgflipXY); gdip_flip_y (imgflipXY); gdip_bitmap_ensure_surface (imgflipXY); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (imgflipXY)) { premulXY = gdip_bitmap_get_premultiplied_scan0 (imgflipXY); if (premulXY) { BitmapData *data = imgflipXY->active_bitmap; originalXY = cairo_image_surface_create_for_data (premulXY, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!originalXY) originalXY = imgflipXY->surface; } gdip_bitmap_ensure_surface (image); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (image)) { premul = gdip_bitmap_get_premultiplied_scan0 (image); if (premul) { BitmapData *data = image->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = image->surface; for (posy = 0; posy < dstheight; posy += img_height) { for (posx = 0; posx < dstwidth; posx += img_width) { if (flipX && flipY) { cur_surface = originalXY; } else { if (flipX) { cur_surface = originalX; } else { if (flipY) { cur_surface = originalY; } else { cur_surface = original; } } } cairo_matrix_translate (&mat, srcx, srcy); cairo_matrix_scale (&mat, srcwidth / dstwidth, srcheight / dstheight); cairo_matrix_translate (&mat, - (dstx + posx), - (dsty + posy)); pattern = cairo_pattern_create_for_surface(cur_surface); cairo_pattern_set_matrix (pattern, &mat); orig = cairo_get_source(graphics->ct); cairo_pattern_reference(orig); cairo_set_source(graphics->ct, pattern); cairo_rectangle (graphics->ct, dstx + posx, dsty + posy, img_width, img_height); cairo_fill (graphics->ct); cairo_set_source(graphics->ct, orig); cairo_matrix_init_identity (&mat); cairo_pattern_set_matrix (pattern, &mat); cairo_pattern_destroy(orig); cairo_pattern_destroy(pattern); if (flipXOn) { flipX = !flipX; } } if (flipYOn) { flipY = !flipY; } } if (imgflipX) { GdipDisposeImage ((GpImage *) imgflipX); if (premulX) { cairo_surface_destroy (originalX); GdipFree (premulX); } } if (imgflipY) { GdipDisposeImage ((GpImage *) imgflipY); if (premulY) { cairo_surface_destroy (originalY); GdipFree (premulY); } } if (imgflipXY) { GdipDisposeImage ((GpImage *) imgflipXY); if (premulXY) { cairo_surface_destroy (originalXY); GdipFree (premulXY); } } if (premul) { cairo_surface_destroy (original); GdipFree (premul); } } else { cairo_pattern_t *filter; gdip_bitmap_ensure_surface (image); if (graphics->type != gtMemoryBitmap && gdip_bitmap_format_needs_premultiplication (image)) { premul = gdip_bitmap_get_premultiplied_scan0 (image); if (premul) { BitmapData *data = image->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = image->surface; filter = cairo_pattern_create_for_surface (original); cairo_pattern_set_filter (filter, gdip_get_cairo_filter (graphics->interpolation)); cairo_matrix_translate (&mat, srcx, srcy); if (!gdip_near_zero(srcwidth - dstwidth) || !gdip_near_zero(srcheight - dstheight)) cairo_matrix_scale (&mat, srcwidth / dstwidth, srcheight / dstheight); cairo_matrix_translate (&mat, -dstx, -dsty); pattern = cairo_pattern_create_for_surface(original); cairo_pattern_set_matrix (pattern, &mat); orig = cairo_get_source(graphics->ct); cairo_pattern_reference(orig); cairo_set_source(graphics->ct, pattern); cairo_rectangle (graphics->ct, dstx, dsty, dstwidth, dstheight); cairo_fill (graphics->ct); cairo_set_source(graphics->ct, orig); cairo_pattern_destroy (orig); cairo_matrix_init_identity (&mat); cairo_pattern_set_matrix (pattern, &mat); cairo_pattern_destroy (pattern); cairo_pattern_destroy (filter); if (premul) { cairo_surface_destroy (original); GdipFree (premul); } } /* The current surface is no longer valid if we had attributes applied */ if (image->surface && imageAttributes != NULL) { cairo_surface_destroy (image->surface); image->surface = NULL; } if (allocated) { image->active_bitmap->scan0 = org; image->active_bitmap->pixel_format = org_format; GdipFree (dest); } return Ok; } GpStatus GdipDrawImageRectRectI (GpGraphics *graphics, GpImage *image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData) { return GdipDrawImageRectRect (graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); } GpStatus GdipDrawImagePointsRect (GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *points, int count, float srcx, float srcy, float srcwidth, float srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData) { GpRectF rect; GpStatus status; GpMatrix *matrix = NULL; cairo_matrix_t orig_matrix; if (!graphics || !image || !points || (count < 3)) return InvalidParameter; if (count > 3) return NotImplemented; rect.X = 0; rect.Y = 0; if (image->type == ImageTypeBitmap) { rect.Width = image->active_bitmap->width; rect.Height = image->active_bitmap->height; } else { MetafileHeader *metaheader = &((GpMetafile*)image)->metafile_header; rect.Width = metaheader->Width; rect.Height = metaheader->Height; } status = GdipCreateMatrix3 (&rect, points, &matrix); if (status == Ok) { cairo_get_matrix (graphics->ct, &orig_matrix); cairo_set_matrix (graphics->ct, matrix); status = GdipDrawImageRectRect (graphics, image, rect.X, rect.Y, rect.Width, rect.Height, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); cairo_set_matrix (graphics->ct, &orig_matrix); } if (matrix) GdipDeleteMatrix (matrix); return status; } GpStatus GdipDrawImagePointsRectI (GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, int count, int srcx, int srcy, int srcwidth, int srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, void *callbackData) { GpPointF pf[3]; if (!points || (count < 3)) return InvalidParameter; if (count > 3) return NotImplemented; pf[0].X = points[0].X; pf[0].Y = points[0].Y; pf[1].X = points[1].X; pf[1].Y = points[1].Y; pf[2].X = points[2].X; pf[2].Y = points[2].Y; return GdipDrawImagePointsRect (graphics, image, (GDIPCONST GpPointF*)&pf, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData); } /* * These two will never be implemented, as 'stream' is a COM IStream */ GpStatus GdipLoadImageFromStream (void *stream, GpImage **image) { return NotImplemented; /* GdipLoadImageFromStream - not supported */ } GpStatus GdipSaveImageToStream (GpImage *image, void *stream, GDIPCONST CLSID *encoderCLSID, GDIPCONST EncoderParameters *params) { return NotImplemented; /* GdipSaveImageToStream - not supported */ } /* coverity[+alloc : arg-*1] */ GpStatus GdipLoadImageFromFile (GDIPCONST WCHAR *file, GpImage **image) { FILE *fp = NULL; GpImage *result = NULL; GpStatus status = Ok; ImageFormat format, public_format; char *file_name = NULL; char format_peek[MAX_CODEC_SIG_LENGTH]; int format_peek_sz; if (!image || !file) return InvalidParameter; file_name = (char *) ucs2_to_utf8 ((const gunichar2 *)file, -1); if (!file_name) { *image = NULL; return InvalidParameter; } fp = fopen (file_name, "rb"); if (!fp) { GdipFree (file_name); return OutOfMemory; } format_peek_sz = fread (format_peek, 1, MAX_CODEC_SIG_LENGTH, fp); format = get_image_format (format_peek, format_peek_sz, &public_format); fseek (fp, 0, SEEK_SET); switch (format) { case BMP: status = gdip_load_bmp_image_from_file (fp, &result); break; case TIF: status = gdip_load_tiff_image_from_file (fp, &result); break; case GIF: status = gdip_load_gif_image_from_file (fp, &result); break; case PNG: status = gdip_load_png_image_from_file (fp, &result); break; case JPEG: status = gdip_load_jpeg_image_from_file (fp, file_name, &result); break; case ICON: status = gdip_load_ico_image_from_file (fp, &result); break; case WMF: status = gdip_load_wmf_image_from_file (fp, &result); break; case EMF: status = gdip_load_emf_image_from_file (fp, &result); break; case EXIF: status = NotImplemented; break; default: status = OutOfMemory; break; } if (result && (status == Ok)) result->image_format = public_format; fclose (fp); GdipFree (file_name); *image = result; if (status != Ok) { *image = NULL; } else if (result && (result->type == ImageTypeBitmap) && !result->active_bitmap) { /* If the codec didn't set the active bitmap we will */ gdip_bitmap_setactive (result, NULL, 0); } return status; } /* Note: use only for encoders (there's more decoders than encoders) */ static ImageFormat gdip_get_imageformat_from_codec_clsid (CLSID *encoderCLSID) { GpStatus status; UINT numEncoders, size, cnt; ImageCodecInfo *encoders, *encoder; status = GdipGetImageEncodersSize (&numEncoders, &size); if ((status != Ok) ||(numEncoders == 0)) return INVALID; encoders = GdipAlloc (size); status = GdipGetImageEncoders (numEncoders, size, encoders); if (status != Ok) return INVALID; for (cnt = 0, encoder = encoders; cnt < numEncoders; cnt++, encoder++) { if (memcmp (&encoder->Clsid, encoderCLSID, sizeof (GUID)) == 0) { ImageFormat ifmt = gdip_image_format_for_format_guid (&encoder->FormatID); GdipFree (encoders); return ifmt; } } GdipFree (encoders); return INVALID; } GpStatus GdipSaveImageToFile (GpImage *image, GDIPCONST WCHAR *file, GDIPCONST CLSID *encoderCLSID, GDIPCONST EncoderParameters *params) { FILE *fp = 0; GpStatus status = 0; char *file_name; ImageFormat format; if (!image || !file || !encoderCLSID) return InvalidParameter; if (image->type != ImageTypeBitmap) return InvalidParameter; format = gdip_get_imageformat_from_codec_clsid ( (CLSID *)encoderCLSID); if (format == INVALID) return UnknownImageFormat; file_name = (char *) ucs2_to_utf8 ((const gunichar2 *)file, -1); if (file_name == NULL) return InvalidParameter; if (format == GIF) { /* gif library has to open the file itself*/ status = gdip_save_gif_image_to_file ((BYTE*)file_name, image); GdipFree (file_name); return status; } else if (format == TIF) { /* tif library has to open the file itself or seeking will fail when saving multi-page images*/ status = gdip_save_tiff_image_to_file ((BYTE*)file_name, image, params); GdipFree (file_name); return status; } if ((fp = fopen(file_name, "wb")) == NULL) { GdipFree (file_name); return GenericError; } GdipFree (file_name); switch (format) { case BMP: case ICON: status = gdip_save_bmp_image_to_file (fp, image); break; case PNG: status = gdip_save_png_image_to_file (fp, image, params); break; case JPEG: status = gdip_save_jpeg_image_to_file (fp, image, params); break; default: status = NotImplemented; break; } fclose (fp); return status; } GpStatus GdipGetImageBounds (GpImage *image, GpRectF *rect, GpUnit *unit) { if (!image || !rect || !unit) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: rect->X = 0; rect->Y = 0; rect->Height = image->active_bitmap->height; rect->Width = image->active_bitmap->width; *unit = UnitPixel; break; case ImageTypeMetafile: { MetafileHeader *metaheader = gdip_get_metaheader(image); rect->X = metaheader->X; rect->Y = metaheader->Y; rect->Height = metaheader->Height; rect->Width = metaheader->Width; *unit = UnitPixel; break; } default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageDimension (GpImage *image, float *width, float *height) { if (!image || !width || !height) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *width = image->active_bitmap->width; *height = image->active_bitmap->height; break; case ImageTypeMetafile: { MetafileHeader *metaheader = gdip_get_metaheader(image); *width = metaheader->Width * METAFILE_DIMENSION_FACTOR / metaheader->DpiX; *height = metaheader->Height * METAFILE_DIMENSION_FACTOR / metaheader->DpiY; break; } default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageType (GpImage *image, ImageType *type) { if (!image || !type) return InvalidParameter; *type = image->type; return Ok; } GpStatus GdipGetImageWidth (GpImage *image, UINT *width) { if (!image || !width) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *width = image->active_bitmap->width; break; case ImageTypeMetafile: *width = gdip_get_metaheader(image)->Width; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageHeight (GpImage *image, UINT *height) { if (!image || !height) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *height = image->active_bitmap->height; break; case ImageTypeMetafile: *height = gdip_get_metaheader(image)->Height; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageHorizontalResolution (GpImage *image, float *resolution) { if (!image || !resolution) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *resolution = image->active_bitmap->dpi_horz; break; case ImageTypeMetafile: *resolution = gdip_get_metaheader(image)->DpiX; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageVerticalResolution (GpImage *image, float *resolution) { if (!image || !resolution) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *resolution = image->active_bitmap->dpi_vert; break; case ImageTypeMetafile: *resolution = gdip_get_metaheader(image)->DpiY; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageFlags (GpImage *image, UINT *flags) { if (!image || !flags) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *flags = image->active_bitmap->image_flags; break; case ImageTypeMetafile: *flags = ImageFlagsUndocumented | ImageFlagsReadOnly | ImageFlagsHasAlpha | ImageFlagsScalable; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImageRawFormat (GpImage *image, GUID *format) { if (!image || !format) return InvalidParameter; switch (image->image_format) { case BMP: memcpy (format, &gdip_bmp_image_format_guid, sizeof (GUID)); break; case TIF: memcpy (format, &gdip_tif_image_format_guid, sizeof (GUID)); break; case GIF: memcpy (format, &gdip_gif_image_format_guid, sizeof (GUID)); break; case PNG: memcpy (format, &gdip_png_image_format_guid, sizeof (GUID)); break; case JPEG: memcpy (format, &gdip_jpg_image_format_guid, sizeof (GUID)); break; case EXIF: memcpy (format, &gdip_exif_image_format_guid, sizeof (GUID)); break; case WMF: memcpy (format, &gdip_wmf_image_format_guid, sizeof (GUID)); break; case EMF: memcpy (format, &gdip_emf_image_format_guid, sizeof (GUID)); break; case MEMBMP: memcpy (format, &gdip_membmp_image_format_guid, sizeof (GUID)); break; case ICON: memcpy (format, &gdip_ico_image_format_guid, sizeof (GUID)); break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetImagePixelFormat (GpImage *image, PixelFormat *format) { if (!image || !format) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *format = image->active_bitmap->pixel_format; break; case ImageTypeMetafile: *format = PixelFormat32bppRGB; break; default: return InvalidParameter; } return Ok; } GpStatus GdipImageGetFrameDimensionsCount (GpImage *image, UINT *count) { if (!image || !count) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *count = image->num_of_frames; break; case ImageTypeMetafile: *count = 1; /* always one for metafiles */ break; default: return InvalidParameter; } return Ok; } GpStatus GdipImageGetFrameDimensionsList (GpImage *image, GUID *dimensionGUID, UINT count) { if (!image || !dimensionGUID) return InvalidParameter; if (count < 1) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: { int i; int countReturn = image->num_of_frames; if (countReturn > count) countReturn = count; for (i = 0; i < countReturn; i++) dimensionGUID[i] = image->frames[i].frame_dimension; break; } case ImageTypeMetafile: if (count > 1) return InvalidParameter; dimensionGUID[0] = gdip_image_frameDimension_page_guid; break; default: return InvalidParameter; } return Ok; } GpStatus GdipImageGetFrameCount (GpImage *image, GDIPCONST GUID *dimensionGUID, UINT* count) { if (!image || !dimensionGUID || !count) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: { int i; for (i = 0; i < image->num_of_frames; i++){ if (memcmp (dimensionGUID, &(image->frames[i].frame_dimension), sizeof (CLSID)) == 0) { *count = image->frames[i].count; return Ok; } } } case ImageTypeMetafile: /* note: an empty GUID also returns 1 */ *count = 1; return Ok; default: break; } return InvalidParameter; } GpStatus GdipImageSelectActiveFrame (GpImage *image, GDIPCONST GUID *dimensionGUID, UINT index) { if (!image || !dimensionGUID) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: return gdip_bitmap_setactive (image, dimensionGUID, index); case ImageTypeMetafile: /* any index value or GUID returns Ok */ return Ok; default: return InvalidParameter; } } static GpStatus gdip_rotate_orthogonal_flip_x (GpImage *image, int angle, BOOL flip_x) { BYTE *rotated; BYTE *source; BYTE *target; int x, y; int source_stride, source_height, source_width, source_pixel_delta, source_interscan_delta; int target_stride, target_height, target_width, target_pixel_delta, target_interscan_delta; int initial_source_offset, initial_target_offset; int components; int depth; int pixel_size; components = gdip_get_pixel_format_components (image->active_bitmap->pixel_format); depth = gdip_get_pixel_format_depth (image->active_bitmap->pixel_format); pixel_size = components * depth / 8; source_stride = image->active_bitmap->stride; source_width = image->active_bitmap->width; source_height = image->active_bitmap->height; source_pixel_delta = pixel_size; source_interscan_delta = source_stride - source_width * pixel_size; initial_source_offset = 0; if (angle == 180) { target_width = source_width; target_height = source_height; } else { target_height = source_width; /* swap width & height here */ target_width = source_height; } target_stride = target_width * pixel_size; target_stride = (target_stride + 3) & ~3; switch (angle) { case 90: { target_pixel_delta = target_stride; if (flip_x) { target_interscan_delta = +pixel_size - target_stride * target_height; initial_target_offset = 0; } else { target_interscan_delta = -pixel_size - target_stride * target_height; initial_target_offset = (target_width - 1) * pixel_size; } break; } case 180: { if (flip_x) { target_pixel_delta = +pixel_size; target_interscan_delta = -target_width * pixel_size - target_stride; initial_target_offset = (target_height - 1) * target_stride; } else { target_pixel_delta = -pixel_size; target_interscan_delta = +target_width * pixel_size - target_stride; initial_target_offset = (target_height - 1) * target_stride + (target_width - 1) * pixel_size; } break; } case 270: { target_pixel_delta = -target_stride; if (flip_x) { target_interscan_delta = target_stride * target_height - pixel_size; initial_target_offset = (target_height - 1) * target_stride + (target_width - 1) * pixel_size; } else { target_interscan_delta = target_stride * target_height + pixel_size; initial_target_offset = (target_height - 1) * target_stride; } break; } default: { if (flip_x) { return gdip_flip_x (image); } else { return Ok; } } } rotated = GdipAlloc (target_height * target_stride); if (rotated == NULL) { return OutOfMemory; } source = initial_source_offset + (BYTE *) image->active_bitmap->scan0; target = initial_target_offset + rotated; for (y = 0; y < source_height; y++, source += source_interscan_delta, target += target_interscan_delta) { for (x = 0; x < source_width; x++, source += source_pixel_delta, target += target_pixel_delta) { copy_pixel (source, target, pixel_size); } } image->active_bitmap->stride = target_stride; image->active_bitmap->height = target_height; image->active_bitmap->width = target_width; if ((image->active_bitmap->reserved & GBD_OWN_SCAN0) != 0) { GdipFree(image->active_bitmap->scan0); } image->active_bitmap->scan0 = rotated; image->active_bitmap->reserved |= GBD_OWN_SCAN0; if (image->surface != NULL) { cairo_surface_destroy (image->surface); image->surface = NULL; } return Ok; } static GpStatus gdip_rotate_flip_packed_indexed (GpImage *image, PixelFormat pixel_format, int angle, BOOL flip_x) { BYTE *rotated; StreamingState scan[8]; BOOL scan_valid[8]; int x; int y; int i; int bits_per_pixel; int pixels_per_byte; int source_width; int source_height; BOOL aspect_inversion; int target_width; int target_height; int target_scan_size; int target_stride; bits_per_pixel = gdip_get_pixel_format_depth (pixel_format); pixels_per_byte = 8 / bits_per_pixel; source_width = image->active_bitmap->width; source_height = image->active_bitmap->height; /* Swap the width & height if needed */ aspect_inversion = ((angle % 180) != 0); target_width = aspect_inversion ? source_height : source_width; target_height = aspect_inversion ? source_width : source_height; target_scan_size = (target_width + pixels_per_byte - 1) / pixels_per_byte; target_stride = (target_scan_size + 3) & ~3; if ((angle == 180) && flip_x) { return gdip_flip_y(image); } rotated = GdipAlloc (target_height * target_stride); if (rotated == NULL) { return OutOfMemory; } if (aspect_inversion == FALSE) { int x_alignment = ((source_width - 1) % pixels_per_byte) + 1 - pixels_per_byte; int x_step = pixels_per_byte; StreamingState stream; BOOL target_starts_at_bottom = (angle == 180); int target_x_offset = target_scan_size - 1; int target_y_offset = target_starts_at_bottom ? (target_height - 1) * target_stride : 0; int target_y_offset_delta = target_starts_at_bottom ? -target_stride : +target_stride; GpStatus status = gdip_init_pixel_stream (&stream, image->active_bitmap, 0, 0, image->active_bitmap->width, image->active_bitmap->height); if (status != Ok) { GdipFree (rotated); return status; } for (y = 0; y < source_height; y++, target_y_offset += target_y_offset_delta) { BYTE *target = rotated + target_x_offset + target_y_offset; for (x = x_alignment; x < source_width; x += x_step) { int byte = 0; for (i = 0; i < pixels_per_byte; i++) { int index = x + i; if ((index >= 0) && (index < source_width)) { byte |= (gdip_pixel_stream_get_next (&stream) << 8); } byte >>= bits_per_pixel; } *target = byte; target--; } } } else { int y_alignment = ((source_height - 1) % pixels_per_byte) + 1 - pixels_per_byte; int y_step = pixels_per_byte; int byte_column = 0; int target_delta; BOOL target_starts_at_bottom = (angle == 270); BOOL target_starts_at_left = (target_starts_at_bottom ^ flip_x); if (target_starts_at_left) { y_alignment = 0; } if (target_starts_at_bottom) { target_delta = -target_stride; } else { target_delta = +target_stride; } for (y = y_alignment; y < source_height; y += y_step) { BYTE *target; for (i=0; i < pixels_per_byte; i++) { int scan_index = y + i; scan_valid[i] = ((scan_index >= 0) && (scan_index < source_height)); if (scan_valid[i]) { GpStatus status = gdip_init_pixel_stream (&scan[i], image->active_bitmap, 0, scan_index, source_width, 1); if (status != Ok) { GdipFree (rotated); return status; } } } target = rotated; if (target_starts_at_left) { target += byte_column; } else { target += target_scan_size - byte_column - 1; } if (target_starts_at_bottom) { target += (target_height - 1) * target_stride; } for (x = 0; x < source_width; x++) { int byte = 0; if (target_starts_at_left) { for (i=0; i < pixels_per_byte; i++) { byte <<= bits_per_pixel; if (scan_valid[i]) byte |= gdip_pixel_stream_get_next (&scan[i]); } } else { for (i = pixels_per_byte - 1; i >= 0; i--) { byte <<= bits_per_pixel; if (scan_valid[i]) byte |= gdip_pixel_stream_get_next (&scan[i]); } } *target = byte; target += target_delta; } byte_column++; } } image->active_bitmap->stride = target_stride; image->active_bitmap->height = target_height; image->active_bitmap->width = target_width; if ((image->active_bitmap->reserved & GBD_OWN_SCAN0) != 0) { GdipFree(image->active_bitmap->scan0); } image->active_bitmap->scan0 = rotated; image->active_bitmap->reserved |= GBD_OWN_SCAN0; /* It shouldn't be possible for an indexed image to have one, * but if it does, it needs to be killed. */ if (image->surface != NULL) { cairo_surface_destroy (image->surface); image->surface = NULL; } return Ok; } GpStatus GdipImageRotateFlip (GpImage *image, RotateFlipType type) { int angle; BOOL flip_x; if (!image) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; angle = flip_x = 0; switch (type) { case RotateNoneFlipNone:/* equivalent to Rotate180FlipXY */ return Ok; case Rotate90FlipNone: /* equivalent to Rotate270FlipXY */ angle = 90; break; case RotateNoneFlipXY: /* equivalent to Rotate180FlipNone */ angle = 180; break; case Rotate90FlipXY: /* equivalent to Rotate270FlipNone */ angle = 270; break; case RotateNoneFlipX: /* equivalent to Rotate180FlipY */ flip_x = TRUE; break; case Rotate90FlipX: /* equivalent to Rotate270FlipY */ angle = 90; flip_x = TRUE; break; case RotateNoneFlipY: /* equivalent to Rotate180FlipX */ return gdip_flip_y (image); case Rotate90FlipY: /* equivalent to Rotate270FlipX */ angle = 270; flip_x = TRUE; break; default: return NotImplemented; } if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format) && (gdip_get_pixel_format_depth (image->active_bitmap->pixel_format) < 8)) { return gdip_rotate_flip_packed_indexed (image, image->active_bitmap->pixel_format, angle, flip_x); } else { return gdip_rotate_orthogonal_flip_x (image, angle, flip_x); } } GpStatus GdipGetImagePalette (GpImage *image, ColorPalette *palette, int size) { int palette_entries; int bytes_needed; if (!image || !palette) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; if (!image->active_bitmap->palette) { /* ColorPalette definition includes one ARGB member (ARGB Entries[1]). In reality there are * Count entries allocated, where Count can be 0 (and required to substract the ARGB size) */ /* coverity[buffer_alloc] */ image->active_bitmap->palette = (ColorPalette*) GdipAlloc (sizeof(ColorPalette) - sizeof(ARGB)); image->active_bitmap->palette->Flags = 0; image->active_bitmap->palette->Count = 0; } palette_entries = image->active_bitmap->palette->Count; if (image->active_bitmap->pixel_format == PixelFormat4bppIndexed) palette_entries = 16; bytes_needed = (palette_entries - 1) * sizeof(ARGB) + sizeof(ColorPalette); if (bytes_needed > size) { return InvalidParameter; } memcpy(palette, image->active_bitmap->palette, bytes_needed); return Ok; } GpStatus GdipSetImagePalette (GpImage *image, GDIPCONST ColorPalette *palette) { int size; if (!image || !palette) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; size = (palette->Count - 1) * sizeof(ARGB) + sizeof(ColorPalette); if (!image->active_bitmap->palette || (palette->Count != image->active_bitmap->palette->Count)) { if (image->active_bitmap->palette) GdipFree (image->active_bitmap->palette); image->active_bitmap->palette = (ColorPalette*) GdipAlloc (size); } memcpy (image->active_bitmap->palette, palette, size); return Ok; } GpStatus GdipGetImagePaletteSize (GpImage *image, int* size) { int palette_entries; if (!image || !size) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return GenericError; palette_entries = (image->active_bitmap->palette) ? image->active_bitmap->palette->Count : 0; if (image->active_bitmap->pixel_format == PixelFormat4bppIndexed) palette_entries = 16; *size = (palette_entries - 1) * sizeof(ARGB) + sizeof(ColorPalette); return Ok; } GpStatus GdipGetPropertyCount (GpImage *image, UINT *propertyNumber) { if (!image || !propertyNumber) return InvalidParameter; switch (image->type) { case ImageTypeBitmap: *propertyNumber = image->active_bitmap->property_count; break; case ImageTypeMetafile: *propertyNumber = 0; break; default: return InvalidParameter; } return Ok; } GpStatus GdipGetPropertyIdList (GpImage *image, UINT propertyNumber, PROPID *list) { int i; if (!image || !list) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; if (propertyNumber != image->active_bitmap->property_count) return InvalidParameter; for (i = 0; i < propertyNumber; i++) { list[i] = image->active_bitmap->property[i].id; } return Ok; } GpStatus GdipGetPropertyItemSize (GpImage *image, PROPID propID, UINT *size) { int index; if (!image || !size) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; if (gdip_bitmapdata_property_find_id(image->active_bitmap, propID, &index) != Ok) { return PropertyNotFound; } *size = sizeof(PropertyItem) + image->active_bitmap->property[index].length; return Ok; } GpStatus GdipGetPropertyItem (GpImage *image, PROPID propID, UINT size, PropertyItem *buffer) { int index; int size_needed; if (!image || !buffer) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; if (gdip_bitmapdata_property_find_id(image->active_bitmap, propID, &index) != Ok) { return PropertyNotFound; } if (size != (sizeof(PropertyItem) + image->active_bitmap->property[index].length)) { return InvalidParameter; } memcpy(buffer, &image->active_bitmap->property[index], sizeof(PropertyItem)); buffer->value = (BYTE*)buffer + sizeof(PropertyItem); memcpy(buffer->value, image->active_bitmap->property[index].value, buffer->length); return Ok; } GpStatus GdipGetPropertySize (GpImage *image, UINT *totalBufferSize, UINT *numProperties) { UINT size; int i; if (!image || !totalBufferSize || !numProperties) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; *numProperties = image->active_bitmap->property_count; size = image->active_bitmap->property_count * sizeof(PropertyItem); for (i = 0; i < image->active_bitmap->property_count; i++) { size += image->active_bitmap->property[i].length; } *totalBufferSize = size; return Ok; } GpStatus GdipRemovePropertyItem (GpImage *image, PROPID propID) { if (!image) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; return gdip_bitmapdata_property_remove_id(image->active_bitmap, propID); } GpStatus GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem *item) { int i; if (!image || !item) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; switch(image->image_format) { case TIF: case JPEG: case PNG: { break; } default: { return PropertyNotSupported; } } /* Check if it exists and we need to replace */ if (gdip_bitmapdata_property_find_id(image->active_bitmap, item->id, &i) != Ok) { /* We're adding a new item */ return gdip_bitmapdata_property_add(image->active_bitmap, item->id, item->length, item->type, item->value); } /* We're replacing an existing item */ if (item->length > image->active_bitmap->property[i].length) { /* We need to allocate more space for our value */ if (image->active_bitmap->property[i].value != NULL) { GdipFree(image->active_bitmap->property[i].value); } image->active_bitmap->property[i].value = GdipAlloc(item->length); if (image->active_bitmap->property[i].value == NULL) { /* We already freed the old value, remove the entry */ gdip_bitmapdata_property_remove_index(image->active_bitmap, i); return OutOfMemory; } } else if (item->length == 0) { /* Just drop the old value */ if (image->active_bitmap->property[i].value != NULL) { GdipFree(image->active_bitmap->property[i].value); image->active_bitmap->property[i].value = NULL; } } image->active_bitmap->property[i].id = item->id; image->active_bitmap->property[i].length = item->length; image->active_bitmap->property[i].type = item->type; if (item->length > 0) { memcpy(image->active_bitmap->property[i].value, item->value, item->length); } return Ok; } GpStatus GdipCloneImage (GpImage *image, GpImage **cloneImage) { if (!image || !cloneImage) return InvalidParameter; switch (image->type){ case ImageTypeBitmap: gdip_bitmap_clone (image, cloneImage); gdip_bitmap_setactive(*cloneImage, NULL, 0); return Ok; case ImageTypeMetafile: return gdip_metafile_clone ((GpMetafile*)image, (GpMetafile**)cloneImage); case ImageTypeUnknown: default: return Ok; } } int gdip_get_pixel_format_bpp (PixelFormat pixfmt) { return gdip_get_pixel_format_depth (pixfmt) * gdip_get_pixel_format_components (pixfmt); } int gdip_get_pixel_format_depth(PixelFormat pixfmt) { switch (pixfmt) { case PixelFormat16bppARGB1555: case PixelFormat16bppGrayScale: case PixelFormat16bppRGB555: case PixelFormat16bppRGB565: case PixelFormat24bppRGB: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: return 8; /* FIXME - shouldn't this be 32? - pdb */ case PixelFormat48bppRGB: case PixelFormat64bppARGB: case PixelFormat64bppPARGB: return 16; case PixelFormat8bppIndexed: return 8; case PixelFormat4bppIndexed: return 4; case PixelFormat1bppIndexed: return 1; default: break; } return 0; } int gdip_get_pixel_format_components(PixelFormat pixfmt) { switch (pixfmt) { case PixelFormat16bppARGB1555: case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat64bppARGB: case PixelFormat64bppPARGB: case PixelFormat32bppRGB: /* Cairo uses four bytes for 32BPP*/ case PixelFormat24bppRGB: return 4; case PixelFormat16bppRGB555: case PixelFormat16bppRGB565: case PixelFormat48bppRGB: return 3; case PixelFormat16bppGrayScale: case PixelFormat8bppIndexed: case PixelFormat4bppIndexed: case PixelFormat1bppIndexed: return 1; default: break; } return 0; } GpStatus GdipLoadImageFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image) { GpImage *result = 0; GpStatus status = 0; ImageFormat format, public_format; dstream_t *loader = NULL; BYTE format_peek[MAX_CODEC_SIG_LENGTH]; int format_peek_sz; format_peek_sz = getHeaderFunc (format_peek, MAX_CODEC_SIG_LENGTH); format = get_image_format ((char *)format_peek, format_peek_sz, &public_format); switch (format) { case JPEG: loader = dstream_input_new (getBytesFunc, seekFunc); status = gdip_load_jpeg_image_from_stream_delegate (loader, &result); break; case PNG: status = gdip_load_png_image_from_stream_delegate (getBytesFunc, seekFunc, &result); break; case BMP: loader = dstream_input_new (getBytesFunc, seekFunc); status = gdip_load_bmp_image_from_stream_delegate (loader, &result); break; case TIF: status = gdip_load_tiff_image_from_stream_delegate (getBytesFunc, putBytesFunc, seekFunc, closeFunc, sizeFunc, &result); break; case GIF: status = gdip_load_gif_image_from_stream_delegate (getBytesFunc, seekFunc, &result); break; case ICON: loader = dstream_input_new (getBytesFunc, seekFunc); status = gdip_load_ico_image_from_stream_delegate (loader, &result); break; case EMF: loader = dstream_input_new (getBytesFunc, seekFunc); status = gdip_load_emf_image_from_stream_delegate (loader, &result); break; case WMF: loader = dstream_input_new (getBytesFunc, seekFunc); status = gdip_load_wmf_image_from_stream_delegate (loader, &result); break; default: /* NotImplemented looks better but this matchs MS behavior */ status = InvalidParameter; break; } if (result && (status == Ok)) result->image_format = public_format; dstream_free (loader); *image = result; if (status != Ok) { *image = NULL; } else if (result && (result->type == ImageTypeBitmap) && !result->active_bitmap) { /* If the codec didn't set the active bitmap we will */ gdip_bitmap_setactive(result, NULL, 0); } return status; } GpStatus GdipSaveImageToDelegate_linux (GpImage *image, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GDIPCONST CLSID *encoderCLSID, GDIPCONST EncoderParameters *params) { if (!image || !encoderCLSID || (image->type != ImageTypeBitmap)) return InvalidParameter; switch (gdip_get_imageformat_from_codec_clsid ((CLSID *)encoderCLSID)) { case ICON: case BMP: return gdip_save_bmp_image_to_stream_delegate (putBytesFunc, image); case PNG: return gdip_save_png_image_to_stream_delegate (putBytesFunc, image, params); case JPEG: return gdip_save_jpeg_image_to_stream_delegate (putBytesFunc, image, params); case GIF: return gdip_save_gif_image_to_stream_delegate (putBytesFunc, image, params); case TIF: return gdip_save_tiff_image_to_stream_delegate (getBytesFunc, putBytesFunc, seekFunc, closeFunc, sizeFunc, image, params); case INVALID: return UnknownImageFormat; default: return NotImplemented; } } GpStatus initCodecList (void) { BYTE *dpos, *epos; g_decoder_list = dpos = GdipAlloc (sizeof (ImageCodecInfo) * DECODERS_SUPPORTED); if (!g_decoder_list) return OutOfMemory; g_encoder_list = epos = GdipAlloc (sizeof (ImageCodecInfo) * ENCODERS_SUPPORTED); if (!g_decoder_list) { GdipFree (g_decoder_list); g_decoder_list = NULL; return OutOfMemory; } /* BMP codec (encoder+decoder) - built-in */ memcpy (dpos, gdip_getcodecinfo_bmp (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; memcpy (epos, gdip_getcodecinfo_bmp (), sizeof (ImageCodecInfo)); epos += sizeof (ImageCodecInfo); g_encoders++; /* ICO codec (decoder-only) - built-in */ memcpy (dpos, gdip_getcodecinfo_ico (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; /* JPEG codec (encoder+decoder) */ if (gdip_getcodecinfo_jpeg ()) { memcpy (dpos, gdip_getcodecinfo_jpeg(), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; memcpy (epos, gdip_getcodecinfo_jpeg(), sizeof (ImageCodecInfo)); epos += sizeof (ImageCodecInfo); g_encoders++; } /* GIF codec (encoder+decoder) */ if (gdip_getcodecinfo_gif ()) { memcpy (dpos, gdip_getcodecinfo_gif (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; memcpy (epos, gdip_getcodecinfo_gif (), sizeof (ImageCodecInfo)); epos += sizeof (ImageCodecInfo); g_encoders++; } /* TIFF codec (encoder+decoder) */ if (gdip_getcodecinfo_tiff ()) { memcpy (dpos, gdip_getcodecinfo_tiff (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; memcpy (epos, gdip_getcodecinfo_tiff (), sizeof (ImageCodecInfo)); epos += sizeof (ImageCodecInfo); g_encoders++; } /* PNG codec (encoder+decoder) */ if (gdip_getcodecinfo_png ()) { memcpy (dpos, gdip_getcodecinfo_png (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; memcpy (epos, gdip_getcodecinfo_png (), sizeof (ImageCodecInfo)); epos += sizeof (ImageCodecInfo); g_encoders++; } /* WMF codec (decoder-only) */ if (gdip_getcodecinfo_wmf ()) { memcpy (dpos, gdip_getcodecinfo_wmf (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; } /* EMF codec (decoder-only) */ if (gdip_getcodecinfo_emf ()) { memcpy (dpos, gdip_getcodecinfo_emf (), sizeof (ImageCodecInfo)); dpos += sizeof (ImageCodecInfo); g_decoders++; } return Ok; } void releaseCodecList (void) { if (g_decoder_list) { GdipFree (g_decoder_list); g_decoder_list = NULL; g_decoders = 0; } if (g_encoder_list) { GdipFree (g_encoder_list); g_encoder_list = NULL; g_encoders = 0; } } GpStatus GdipGetImageDecodersSize (UINT *numDecoders, UINT *size) { if (!numDecoders || !size) return InvalidParameter; *numDecoders = g_decoders; *size = sizeof (ImageCodecInfo) * g_decoders; return Ok; } GpStatus GdipGetImageDecoders (UINT numDecoders, UINT size, ImageCodecInfo *decoders) { if (!decoders || (numDecoders != g_decoders) || (size != sizeof (ImageCodecInfo) * g_decoders)) return GenericError; memcpy (decoders, g_decoder_list, size); return Ok; } GpStatus GdipGetImageEncodersSize (UINT *numEncoders, UINT *size) { if (!numEncoders || !size) return InvalidParameter; *numEncoders = g_encoders; *size = sizeof (ImageCodecInfo) * g_encoders; return Ok; } GpStatus GdipGetImageEncoders (UINT numEncoders, UINT size, ImageCodecInfo *encoders) { if (!encoders || (numEncoders != g_encoders) || (size != sizeof (ImageCodecInfo) * g_encoders)) return GenericError; memcpy (encoders, g_encoder_list, size); return Ok; } GpStatus GdipGetAllPropertyItems (GpImage *image, UINT totalBufferSize, UINT numProperties, PropertyItem *allItems) { int size; int i; BYTE *ptr; if (!image || !allItems) return InvalidParameter; /* GDI+ doesn't support this for metafiles */ if (image->type != ImageTypeBitmap) return NotImplemented; if (numProperties != image->active_bitmap->property_count) { return InvalidParameter; } size = image->active_bitmap->property_count * sizeof(PropertyItem); for (i = 0; i < numProperties; i++) { size += image->active_bitmap->property[i].length; } if (size != totalBufferSize) { return InvalidParameter; } ptr = (BYTE*)allItems; ptr += totalBufferSize; /* Copy the PropertyItem array */ memcpy(allItems, image->active_bitmap->property, sizeof(PropertyItem) * numProperties); /* Copy the values and fix up the value pointers in the PropertyItem array to point to them */ for (i = 0; i < numProperties; i++) { if (allItems[i].value != NULL) { ptr -= allItems[i].length; memcpy(ptr, allItems[i].value, allItems[i].length); /* Use the copied pointer, less indirection than image->active_bitmap->property[i].value */ allItems[i].value = ptr; } } return Ok; } GpStatus GdipGetEncoderParameterListSize (GpImage *image, GDIPCONST CLSID *clsidEncoder, UINT *size) { ImageFormat fmt; if (!image || !clsidEncoder || !size) return InvalidParameter; fmt = gdip_get_imageformat_from_codec_clsid ((CLSID *) clsidEncoder); switch (fmt) { case JPEG: *size = gdip_get_encoder_parameter_list_size_jpeg (); return Ok; case TIF: *size = 0; return NotImplemented; default: break; } return FileNotFound; } GpStatus GdipGetEncoderParameterList (GpImage *image, GDIPCONST CLSID *clsidEncoder, UINT size, EncoderParameters *buffer) { ImageFormat fmt; if (!image || !clsidEncoder || !buffer) return InvalidParameter; fmt = gdip_get_imageformat_from_codec_clsid ((CLSID *) clsidEncoder); switch (fmt) { case JPEG: return gdip_fill_encoder_parameter_list_jpeg (buffer, size); case TIF: return NotImplemented; default: break; } return FileNotFound; } GpStatus GdipGetImageThumbnail (GpImage *image, UINT thumbWidth, UINT thumbHeight, GpImage **thumbImage, GetThumbnailImageAbort callback, VOID *callbackData) { /* We don't really need to implement this; we've got it handled in System.Drawing directly */ return NotImplemented; } /* coverity[+alloc : arg-*1] */ GpStatus GdipLoadImageFromFileICM (GDIPCONST WCHAR* filename, GpImage **image) { return GdipLoadImageFromFile (filename, image); } const EncoderParameter * gdip_find_encoder_parameter (GDIPCONST EncoderParameters *eps, const GUID *guid) { int i; for (i = 0; i < eps->Count; i++) { if (memcmp (&(eps->Parameter[i].Guid), guid, sizeof(GUID)) == 0) return &(eps->Parameter[i]); } return NULL; } /* GDI+ 1.0 only supports multiple frames on an image for the tiff format */ GpStatus GdipSaveAdd (GpImage *image, GDIPCONST EncoderParameters* encoderParams) { if (!image || !encoderParams) return InvalidParameter; return NotImplemented; } GpStatus GdipSaveAddImage (GpImage *image, GpImage *imageNew, GDIPCONST EncoderParameters *params) { if (!image || !imageNew || !params) return InvalidParameter; return NotImplemented; } libgdiplus-4.2/src/stringformat.c0000664000175000017500000002162612377405421014126 00000000000000/* * Copyright (C) 2004 Ximian inc. http://www.ximian.com * Copyright (C) 2004,2006-2007 Novell Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jordi Mas i Hernandez , 2004 * Ravindra * Sebastien Pouliot * */ #include "stringformat-private.h" /* coverity[+alloc : arg-*2] */ GpStatus GdipCreateStringFormat (INT formatAttributes, LANGID language, GpStringFormat **format) { GpStringFormat *result; if (!format) return InvalidParameter; result = (GpStringFormat *) GdipAlloc (sizeof (GpStringFormat)); if (!result) return OutOfMemory; result->alignment = StringAlignmentNear; result->lineAlignment = StringAlignmentNear; result->hotkeyPrefix = HotkeyPrefixNone; result->formatFlags = formatAttributes; result->trimming = StringTrimmingCharacter; result->substitute = StringDigitSubstituteUser; result->firstTabOffset = 0; result->tabStops = NULL; result->numtabStops = 0; result->charRanges = NULL; result->charRangeCount = 0; *format = result; return Ok; } /* coverity[+alloc : arg-*0] */ GpStatus GdipStringFormatGetGenericDefault (GpStringFormat **format) { return GdipCreateStringFormat (0, 0, format); } /* coverity[+alloc : arg-*0] */ GpStatus GdipStringFormatGetGenericTypographic (GpStringFormat **format) { int formatFlags = StringFormatFlagsNoFitBlackBox | StringFormatFlagsLineLimit | StringFormatFlagsNoClip; GpStatus status = GdipCreateStringFormat (formatFlags, 0, format); if (status == Ok) (*format)->trimming = StringTrimmingNone; return status; } /* coverity[+alloc : arg-*1] */ GpStatus GdipCloneStringFormat (GDIPCONST GpStringFormat *format, GpStringFormat **newFormat) { int i; GpStringFormat *result; if (!format || !newFormat) return InvalidParameter; result = (GpStringFormat *) GdipAlloc (sizeof (GpStringFormat)); if (!result) return OutOfMemory; result->alignment = format->alignment; result->lineAlignment = format->lineAlignment; result->hotkeyPrefix = format->hotkeyPrefix; result->formatFlags = format->formatFlags; result->trimming = format->trimming; result->substitute = format->substitute; result->firstTabOffset = format->firstTabOffset; result->numtabStops = format->numtabStops; result->charRangeCount = format->charRangeCount; /* Create a copy of tab stops for the clone */ result->tabStops = (float *) GdipAlloc (sizeof (float) * format->numtabStops); if (result->tabStops == NULL) { GdipFree (result); return OutOfMemory; } for (i = 0; i < format->numtabStops; i++) result->tabStops [i] = format->tabStops [i]; /* Create a copy of char ranges for the clone */ result->charRanges = (CharacterRange *) GdipAlloc (format->charRangeCount * sizeof (CharacterRange)); if (result->charRanges == NULL) { GdipFree (result->tabStops); GdipFree (result); return OutOfMemory; } for (i = 0; i < format->charRangeCount; i++) { result->charRanges [i].First = format->charRanges [i].First; result->charRanges [i].Length = format->charRanges [i].Length; } *newFormat = result; return Ok; } GpStatus GdipDeleteStringFormat (GpStringFormat *format) { if (!format) return InvalidParameter; if (format->tabStops) { GdipFree (format->tabStops); format->tabStops = NULL; } if (format->charRanges) { GdipFree (format->charRanges); format->charRanges = NULL; } GdipFree (format); return Ok; } GpStatus GdipSetStringFormatAlign (GpStringFormat *format, StringAlignment align) { if (!format) return InvalidParameter; format->alignment = align; return Ok; } GpStatus GdipGetStringFormatAlign (GDIPCONST GpStringFormat *format, StringAlignment *align) { if (!format || !align) return InvalidParameter; *align = format->alignment; return Ok; } GpStatus GdipSetStringFormatLineAlign (GpStringFormat *format, StringAlignment align) { if (!format) return InvalidParameter; format->lineAlignment = align; return Ok; } GpStatus GdipGetStringFormatLineAlign (GDIPCONST GpStringFormat *format, StringAlignment *align) { if (!format || !align) return InvalidParameter; *align = format->lineAlignment; return Ok; } GpStatus GdipSetStringFormatHotkeyPrefix (GpStringFormat *format, INT hotkeyPrefix) { if (!format) return InvalidParameter; format->hotkeyPrefix = hotkeyPrefix; return Ok; } GpStatus GdipGetStringFormatHotkeyPrefix (GDIPCONST GpStringFormat *format, INT *hotkeyPrefix) { if (!format || !hotkeyPrefix) return InvalidParameter; *hotkeyPrefix = format->hotkeyPrefix; return Ok; } GpStatus GdipSetStringFormatFlags (GpStringFormat *format, INT flags) { if (!format) return InvalidParameter; format->formatFlags = flags; return Ok; } GpStatus GdipGetStringFormatFlags (GDIPCONST GpStringFormat *format, INT *flags) { if (!format || !flags) return InvalidParameter; *flags = format->formatFlags; return Ok; } GpStatus GdipSetStringFormatTrimming (GpStringFormat *format, StringTrimming trimming) { if (!format) return InvalidParameter; format->trimming = trimming; return Ok; } GpStatus GdipGetStringFormatTrimming (GDIPCONST GpStringFormat *format, StringTrimming *trimming) { if (!format || !trimming) return InvalidParameter; *trimming = format->trimming; return Ok; } GpStatus GdipSetStringFormatTabStops (GpStringFormat *format, float firstTabOffset, int count, GDIPCONST float *tabStops) { int i; float *pItemSrc = (float*) tabStops; float *pItemTrg; if (!format || !tabStops) return InvalidParameter; if (format->tabStops) GdipFree (format->tabStops); format->firstTabOffset = (count >= 0) ? firstTabOffset : 0.0f; if (count <= 0) { format->tabStops = NULL; format->numtabStops = 0; return Ok; } pItemTrg = format->tabStops = GdipAlloc (sizeof(float) * count); if (!pItemTrg) return OutOfMemory; for (i = 0; i < count; i++, pItemSrc++, pItemTrg++) *pItemTrg = *pItemSrc; format->numtabStops = count; return Ok; } GpStatus GdipGetStringFormatDigitSubstitution (GDIPCONST GpStringFormat *format, LANGID *language, StringDigitSubstitute *substitute) { if (!format || !substitute) return InvalidParameter; *substitute = format->substitute; return Ok; } GpStatus GdipSetStringFormatDigitSubstitution (GpStringFormat *format, LANGID language, StringDigitSubstitute substitute) { if (!format) return InvalidParameter; format->substitute = substitute; return Ok; } GpStatus GdipGetStringFormatTabStopCount (GDIPCONST GpStringFormat *format, int *count) { if (!format || !count) return InvalidParameter; *count = format->numtabStops; return Ok; } GpStatus GdipGetStringFormatTabStops (GDIPCONST GpStringFormat *format, int count, float *firstTabOffset, float *tabStops) { int i; float *pItemSrc; float *pItemTrg = tabStops; int elems; if (!format || !firstTabOffset || !tabStops) return InvalidParameter; pItemSrc = format->tabStops; elems = countnumtabStops ? count : format->numtabStops; for (i = 0; i < elems; i++, pItemSrc++, pItemTrg++) *pItemTrg = *pItemSrc; *firstTabOffset = format->firstTabOffset; return Ok; } GpStatus GdipGetStringFormatMeasurableCharacterRangeCount (GDIPCONST GpStringFormat *format, int *count) { if (! format || !count) return InvalidParameter; *count = format->charRangeCount; return Ok; } GpStatus GdipSetStringFormatMeasurableCharacterRanges (GpStringFormat *format, int rangeCount, GDIPCONST CharacterRange *ranges) { if (!format || !ranges || (rangeCount < 0)) return InvalidParameter; if (rangeCount == 0) return Ok; else if (rangeCount > 32) return ValueOverflow; if (format->charRanges && format->charRangeCount != rangeCount) { GdipFree (format->charRanges); format->charRanges = NULL; } if (format->charRanges == NULL) { format->charRanges = (CharacterRange *) GdipAlloc (rangeCount * sizeof (CharacterRange)); if (format->charRanges == NULL) return OutOfMemory; } memcpy (format->charRanges, ranges, rangeCount * sizeof (CharacterRange)); format->charRangeCount = rangeCount; return Ok; } libgdiplus-4.2/src/alpha-premul-table.inc0000664000175000017500000121014712377405421015411 00000000000000/* precomputed table for alpha*value divised by 255 */ const BYTE pre_multiplied_table[256][256] = { /* 000 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* 001 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, /* 002 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 }, /* 003 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 }, /* 004 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 }, /* 005 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, /* 006 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6 }, /* 007 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7 }, /* 008 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8 }, /* 009 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9 }, /* 010 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10 }, /* 011 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11 }, /* 012 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12 }, /* 013 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13 }, /* 014 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14 }, /* 015 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15 }, /* 016 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16 }, /* 017 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17 }, /* 018 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18 }, /* 019 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19 }, /* 020 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20 }, /* 021 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21 }, /* 022 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22 }, /* 023 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23 }, /* 024 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24 }, /* 025 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25 }, /* 026 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26 }, /* 027 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27 }, /* 028 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }, /* 029 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29 }, /* 030 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30 }, /* 031 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31 }, /* 032 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32 }, /* 033 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33 }, /* 034 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34 }, /* 035 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 35 }, /* 036 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 36 }, /* 037 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37 }, /* 038 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38 }, /* 039 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39 }, /* 040 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40 }, /* 041 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41 }, /* 042 */ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 42 }, /* 043 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43 }, /* 044 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44 }, /* 045 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45 }, /* 046 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46 }, /* 047 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47 }, /* 048 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48 }, /* 049 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49 }, /* 050 */ { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50 }, /* 051 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51 }, /* 052 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 52 }, /* 053 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 53 }, /* 054 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54 }, /* 055 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55 }, /* 056 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, 55, 55, 56 }, /* 057 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57 }, /* 058 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58 }, /* 059 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59 }, /* 060 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60 }, /* 061 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61 }, /* 062 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62 }, /* 063 */ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63 }, /* 064 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64 }, /* 065 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 65 }, /* 066 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66 }, /* 067 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67 }, /* 068 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68 }, /* 069 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69 }, /* 070 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 70 }, /* 071 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 71 }, /* 072 */ { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72 }, /* 073 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73 }, /* 074 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74 }, /* 075 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75 }, /* 076 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76 }, /* 077 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77 }, /* 078 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78 }, /* 079 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79 }, /* 080 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80 }, /* 081 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81 }, /* 082 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82 }, /* 083 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83 }, /* 084 */ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84 }, /* 085 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85 }, /* 086 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86 }, /* 087 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 87 }, /* 088 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88 }, /* 089 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 89 }, /* 090 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 89, 89, 90 }, /* 091 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 89, 89, 89, 90, 90, 91 }, /* 092 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 92 }, /* 093 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 88, 89, 89, 90, 90, 90, 91, 91, 91, 92, 92, 93 }, /* 094 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 92, 92, 92, 93, 93, 94 }, /* 095 */ { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 93, 94, 94, 95 }, /* 096 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 92, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96 }, /* 097 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 82, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97 }, /* 098 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98 }, /* 099 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99 }, /* 100 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100 }, /* 101 */ { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101 }, /* 102 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102 }, /* 103 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103 }, /* 104 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104 }, /* 105 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 102, 103, 103, 104, 104, 105 }, /* 106 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 103, 104, 104, 105, 105, 106 }, /* 107 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107 }, /* 108 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108 }, /* 109 */ { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 82, 82, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 103, 104, 104, 105, 105, 106, 106, 106, 107, 107, 108, 108, 109 }, /* 110 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 103, 104, 104, 105, 105, 106, 106, 106, 107, 107, 108, 108, 109, 109, 110 }, /* 111 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, 109, 109, 110, 110, 111 }, /* 112 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 108, 109, 109, 110, 110, 111, 111, 112 }, /* 113 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 109, 110, 110, 111, 111, 112, 112, 113 }, /* 114 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114 }, /* 115 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115 }, /* 116 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116 }, /* 117 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117 }, /* 118 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118 }, /* 119 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119 }, /* 120 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120 }, /* 121 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121 }, /* 122 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122 }, /* 123 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123 }, /* 124 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124 }, /* 125 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125 }, /* 126 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126 }, /* 127 */ { 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127 }, /* 128 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 128 }, /* 129 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 129 }, /* 130 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 130 }, /* 131 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 131 }, /* 132 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 132 }, /* 133 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 133 }, /* 134 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 134 }, /* 135 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 135 }, /* 136 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 136 }, /* 137 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, 137 }, /* 138 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 138 }, /* 139 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 139 }, /* 140 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, 140 }, /* 141 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 138, 139, 139, 140, 141 }, /* 142 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 138, 138, 139, 139, 140, 140, 141, 142 }, /* 143 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 109, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143 }, /* 144 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 90, 91, 92, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 142, 143, 144 }, /* 145 */ { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 38, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 46, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 92, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 135, 136, 137, 137, 138, 138, 139, 139, 140, 141, 141, 142, 142, 143, 143, 144, 145 }, /* 146 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 34, 35, 36, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 93, 94, 95, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 109, 110, 111, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 117, 118, 119, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 133, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146 }, /* 147 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 38, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 74, 75, 76, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 93, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, 106, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147 }, /* 148 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 76, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 136, 137, 138, 138, 139, 139, 140, 141, 141, 142, 142, 143, 143, 144, 145, 145, 146, 146, 147, 148 }, /* 149 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 75, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 120, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 148, 149 }, /* 150 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 122, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 148, 149, 150 }, /* 151 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 142, 142, 143, 143, 144, 145, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151 }, /* 152 */ { 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 103, 103, 104, 104, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 125, 125, 126, 126, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152 }, /* 153 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 135, 135, 136, 136, 137, 138, 138, 139, 139, 140, 141, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 148, 149, 150, 150, 151, 151, 152, 153 }, /* 154 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 120, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 126, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 152, 153, 154 }, /* 155 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 103, 104, 105, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 148, 149, 150, 150, 151, 151, 152, 153, 153, 154, 155 }, /* 156 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 77, 77, 78, 78, 79, 80, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 116, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 138, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 152, 153, 154, 154, 155, 156 }, /* 157 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 81, 82, 83, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 110, 110, 111, 112, 112, 113, 113, 114, 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 121, 122, 123, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 129, 130, 131, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 153, 154, 155, 155, 156, 157 }, /* 158 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 123, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 154, 155, 156, 156, 157, 158 }, /* 159 */ { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112, 113, 114, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159 }, /* 160 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 112, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160 }, /* 161 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 114, 115, 116, 116, 117, 118, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161 }, /* 162 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 59, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 127, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 155, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162 }, /* 163 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163 }, /* 164 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164 }, /* 165 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165 }, /* 166 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 55, 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166 }, /* 167 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167 }, /* 168 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 112, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 166, 167, 168 }, /* 169 */ { 0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 112, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 167, 168, 169 }, /* 170 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 112, 112, 113, 114, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 166, 167, 168, 168, 169, 170 }, /* 171 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 166, 167, 168, 168, 169, 170, 171 }, /* 172 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 172 }, /* 173 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 132, 132, 133, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 166, 167, 168, 168, 169, 170, 170, 171, 172, 173 }, /* 174 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 139, 139, 140, 141, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 174 }, /* 175 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 153, 153, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175 }, /* 176 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 86, 87, 88, 89, 89, 90, 91, 91, 92, 93, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 135, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 176 }, /* 177 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 79, 80, 81, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 174, 174, 175, 176, 177 }, /* 178 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 141, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 178 }, /* 179 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 136, 137, 138, 138, 139, 140, 141, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 148, 149, 150, 150, 151, 152, 153, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 176, 177, 178, 179 }, /* 180 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 141, 142, 143, 144, 144, 145, 146, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 153, 154, 155, 156, 156, 157, 158, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180 }, /* 181 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 102, 103, 104, 105, 105, 106, 107, 107, 108, 109, 110, 110, 111, 112, 112, 113, 114, 114, 115, 116, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 141, 142, 143, 144, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 151, 152, 153, 154, 154, 155, 156, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181 }, /* 182 */ { 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 79, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 109, 110, 111, 112, 112, 113, 114, 114, 115, 116, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 179, 180, 181, 182 }, /* 183 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 53, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 109, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183 }, /* 184 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 147, 148, 149, 150, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184 }, /* 185 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 116, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 150, 151, 152, 153, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185 }, /* 186 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 105, 106, 107, 107, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 150, 151, 152, 153, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, 185, 186 }, /* 187 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 79, 80, 81, 82, 82, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 110, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187 }, /* 188 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 86, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104, 105, 106, 106, 107, 108, 109, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188 }, /* 189 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 42, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, 185, 186, 186, 187, 188, 189 }, /* 190 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 125, 125, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 190 }, /* 191 */ { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 125, 125, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191 }, /* 192 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 82, 82, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 103, 103, 104, 105, 106, 106, 107, 108, 109, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 192 }, /* 193 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 130, 130, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, 185, 186, 186, 187, 188, 189, 189, 190, 191, 192, 193 }, /* 194 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 82, 82, 83, 84, 85, 85, 86, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 130, 130, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 190, 190, 191, 192, 193, 194 }, /* 195 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 143, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 195 }, /* 196 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 19, 19, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 63, 63, 64, 65, 66, 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 89, 89, 90, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 106, 106, 107, 108, 109, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 186, 186, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196 }, /* 197 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 61, 61, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 94, 95, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 104, 105, 105, 106, 107, 108, 108, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 118, 119, 120, 121, 122, 122, 123, 124, 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 135, 135, 136, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 146, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, 185, 186, 186, 187, 188, 189, 190, 190, 191, 192, 193, 193, 194, 195, 196, 197 }, /* 198 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 64, 65, 66, 66, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 93, 94, 95, 96, 97, 97, 98, 99, 100, 100, 101, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 125, 125, 126, 127, 128, 128, 129, 130, 131, 132, 132, 133, 134, 135, 135, 136, 137, 138, 138, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 194, 194, 195, 196, 197, 198 }, /* 199 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 91, 92, 92, 93, 94, 95, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 103, 104, 105, 106, 106, 107, 108, 109, 110, 110, 111, 112, 113, 113, 114, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 135, 136, 137, 138, 138, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 176, 177, 177, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199 }, /* 200 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 87, 87, 88, 89, 90, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200 }, /* 201 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 93, 94, 95, 96, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 104, 105, 106, 107, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 186, 187, 188, 189, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201 }, /* 202 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 118, 119, 120, 121, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202 }, /* 203 */ { 0, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203 }, /* 204 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204 }, /* 205 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 139, 140, 141, 142, 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205 }, /* 206 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206 }, /* 207 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207 }, /* 208 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208 }, /* 209 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209 }, /* 210 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 102, 103, 104, 105, 106, 107, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210 }, /* 211 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 124, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 139, 140, 141, 142, 143, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211 }, /* 212 */ { 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212 }, /* 213 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213 }, /* 214 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 146, 147, 148, 149, 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214 }, /* 215 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 102, 102, 103, 104, 105, 106, 107, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 139, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215 }, /* 216 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216 }, /* 217 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 102, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217 }, /* 218 */ { 0, 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 153, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218 }, /* 219 */ { 0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 139, 140, 141, 142, 143, 144, 145, 146, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 219 }, /* 220 */ { 0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 220 }, /* 221 */ { 0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 141, 142, 143, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 220, 221 }, /* 222 */ { 0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 107, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222 }, /* 223 */ { 0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 139, 139, 140, 141, 142, 143, 144, 145, 146, 146, 147, 148, 149, 150, 151, 152, 153, 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 221, 222, 223 }, /* 224 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 122, 122, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 172, 173, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 221, 222, 223, 224 }, /* 225 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 223, 224, 225 }, /* 226 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 179, 180, 181, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 223, 224, 225, 226 }, /* 227 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 97, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227 }, /* 228 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 142, 143, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228 }, /* 229 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229 }, /* 230 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230 }, /* 231 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231 }, /* 232 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232 }, /* 233 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233 }, /* 234 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234 }, /* 235 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235 }, /* 236 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236 }, /* 237 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237 }, /* 238 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238 }, /* 239 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 }, /* 240 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240 }, /* 241 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241 }, /* 242 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242 }, /* 243 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243 }, /* 244 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244 }, /* 245 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245 }, /* 246 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246 }, /* 247 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247 }, /* 248 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248 }, /* 249 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249 }, /* 250 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250 }, /* 251 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251 }, /* 252 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252 }, /* 253 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253 }, /* 254 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254 }, /* 255 */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 } }; libgdiplus-4.2/src/dstream.h0000664000175000017500000000343312377405421013047 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef __DSTREAM_H #define __DSTREAM_H #include "win32structs.h" #include "image.h" typedef struct _dstream_pvt dstream_private; typedef struct _dstream dstream_t; struct _dstream { dstream_private *pvt; }; dstream_t *dstream_input_new (GetBytesDelegate read, SeekDelegate seek) GDIP_INTERNAL; int dstream_read (dstream_t *loader, void *buffer, int size, char peek) GDIP_INTERNAL; void dstream_skip (dstream_t *loader, int nbytes) GDIP_INTERNAL; void dstream_free (dstream_t *loader) GDIP_INTERNAL; void dstream_keep_exif_buffer (dstream_t *loader) GDIP_INTERNAL; void dstream_get_exif_buffer (dstream_t *loader, unsigned char **ptr, unsigned int *length) GDIP_INTERNAL; #endif libgdiplus-4.2/src/gdip.h0000664000175000017500000000260212377405421012330 00000000000000/* * gdip.h - THIS FILE IS DEPRECATED - please use the new GdiPlusFlat.h header file * * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #warning The file gdip.h will eventually disappear, please directly include GdiPlusFlat.h instead #include "GdiPlusFlat.h" libgdiplus-4.2/src/hatchbrush.h0000664000175000017500000000103512377405421013537 00000000000000/* * hatchbrush.h * * Author: * Ravindra (rkumar@novell.com) * * Copyright (C) 2004, 2007 Novell, Inc. http://www.novell.com */ #ifndef __HATCHBRUSH_H__ #define __HATCHBRUSH_H__ #include "brush.h" GpStatus GdipCreateHatchBrush (GpHatchStyle hatchstyle, ARGB forecolor, ARGB backcolor, GpHatch **brush); GpStatus GdipGetHatchStyle (GpHatch *brush, GpHatchStyle *hatchstyle); GpStatus GdipGetHatchForegroundColor (GpHatch *brush, ARGB *forecolor); GpStatus GdipGetHatchBackgroundColor (GpHatch *brush, ARGB *backcolor); #endif libgdiplus-4.2/src/text-cairo.c0000664000175000017500000011400412377405421013457 00000000000000/* * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #include "gdiplus-private.h" #ifndef USE_PANGO_RENDERING #include #include "text-cairo-private.h" #include "graphics-private.h" #include "graphics-cairo-private.h" #include "brush-private.h" #include "font-private.h" /* * NOTE: all parameter's validations are done inside text.c */ #undef DRAWSTRING_DEBUG static int CalculateStringWidths (cairo_t *ct, GDIPCONST GpFont *gdiFont, GDIPCONST gunichar2 *stringUnicode, unsigned long StringDetailElements, GpStringDetailStruct *StringDetails) { size_t i; cairo_text_extents_t ext; GpStringDetailStruct *CurrentDetail; BYTE utf8[5]; CurrentDetail = StringDetails; for (i = 0; i < StringDetailElements; i++) { utf8[utf8_encode_ucs2char(*(stringUnicode + i), utf8)] = '\0'; cairo_text_extents(ct, (const char *) utf8, &ext); CurrentDetail->Width = ext.x_advance; CurrentDetail++; } return StringDetailElements; } #ifdef NOT_USED /* Currently not used */ static int CalculateStringWidthsUTF8 (cairo_t *ct, GDIPCONST GpFont *gdiFont, const BYTE *utf8, unsigned long StringDetailElements, GpStringDetailStruct *StringDetails) { FT_Face face; size_t i; gunichar *ucs4 = NULL; cairo_font_face_t *Font; GpStringDetailStruct *CurrentDetail; glong NumOfGlyphs; cairo_matrix_t matrix; #ifdef DRAWSTRING_DEBUG printf("CalculateStringWidths(font, %s, %d, details) called\n", utf8, StringDetailElements); #endif Font = (cairo_font_face_t *)gdiFont->cairofnt; face = gdip_cairo_ft_font_lock_face(Font); if (!face) return 0; cairo_get_font_matrix(ct, &matrix); cairo_matrix_scale(&matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels); ucs4 = g_utf8_to_ucs4 ((const gchar *) utf8, (glong)-1, NULL, &NumOfGlyphs, NULL); if ((NumOfGlyphs == 0) || (ucs4 == NULL)) { return 0; } CurrentDetail=StringDetails; for (i = 0; i < NumOfGlyphs; i++) { FT_Load_Glyph (face, FT_Get_Char_Index (face, ucs4[i]), FT_LOAD_DEFAULT); CurrentDetail->Width = DOUBLE_FROM_26_6 (face->glyph->advance.x); CurrentDetail++; } gdip_cairo_ft_font_unlock_face(Font); GdipFree(ucs4); #ifdef DRAWSTRING_DEBUG printf("CalculateStringWidths: string >%s< translated into %d glyphs\n", utf8, NumOfGlyphs); #endif return NumOfGlyphs; } #endif static GpStatus MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int *length, GDIPCONST GpFont *font, GDIPCONST RectF *rc_org, GDIPCONST GpStringFormat *format, GpBrush *brush, RectF *boundingBox, int *codepointsFitted, int *linesFilled, WCHAR *CleanString, GpStringDetailStruct* StringDetails, GpDrawTextData *data) { BYTE *String; /* Holds the UTF8 version of our sanitized string */ unsigned long StringLen; /* Length of CleanString */ GDIPCONST WCHAR *Src; WCHAR *Dest; unsigned long i; unsigned long j; GpStringDetailStruct *CurrentDetail; GpStringDetailStruct *CurrentLineStart; /* For rendering engine, to bump LineLen */ float *TabStops; int NumOfTabStops; int WrapPoint; /* Array index of wrap character */ int WrapX; /* Width of text at wrap character */ float CursorX; /* Current X position of drawing cursor */ float CursorY; /* Current Y position of drawing cursor */ int MaxX; /* Largest X of cursor */ int MaxXatY; /* Y coordinate of line with largest X, needed for MaxX resetting on wrap */ int MaxY; /* Largest Y of cursor */ int FrameWidth; /* rc->Width (or rc->Height if vertical) */ int FrameHeight; /* rc->Height (or rc->Width if vertical) */ int AlignHorz; /* Horizontal Alignment mode */ int AlignVert; /* Vertical Alignment mode */ int LineHeight; /* Height of a line with given font */ cairo_font_extents_t FontExtent; /* Info about our font */ cairo_font_options_t *FontOptions; RectF rc_coords, *rc = &rc_coords; float FontSize; if (OPTIMIZE_CONVERSION (graphics)) { rc->X = rc_org->X; rc->Y = rc_org->Y; rc->Width = rc_org->Width; rc->Height = rc_org->Height; } else { rc->X = gdip_unitx_convgr (graphics, rc_org->X); rc->Y = gdip_unity_convgr (graphics, rc_org->Y); rc->Width = gdip_unitx_convgr (graphics, rc_org->Width); rc->Height = gdip_unity_convgr (graphics, rc_org->Height); } #ifdef DRAWSTRING_DEBUG printf("GdipDrawString(...) called (length=%d, fontsize=%d)\n", length, (int)font->sizeInPixels); #endif TabStops = format->tabStops; NumOfTabStops = format->numtabStops; /* Prepare our various buffers and variables */ StringLen = *length; if (data) data->has_hotkeys = FALSE; /* Set aliasing mode */ FontOptions = cairo_font_options_create(); switch(graphics->text_mode) { default: case TextRenderingHintSystemDefault: { cairo_font_options_set_antialias(FontOptions, CAIRO_ANTIALIAS_DEFAULT); //cairo_font_options_set_hint_style(FontOptions, CAIRO_HINT_STYLE_NONE); //cairo_font_options_set_subpixel_order(FontOptions, CAIRO_SUBPIXEL_ORDER_DEFAULT); //cairo_font_options_set_hint_style(FontOptions, CAIRO_HINT_STYLE_DEFAULT); //cairo_font_options_set_hint_metrics(FontOptions, CAIRO_HINT_METRICS_DEFAULT); break; } // FIXME - pick matching settings for each text mode case TextRenderingHintSingleBitPerPixelGridFit: case TextRenderingHintSingleBitPerPixel: case TextRenderingHintAntiAliasGridFit: case TextRenderingHintAntiAlias: { cairo_font_options_set_antialias(FontOptions, CAIRO_ANTIALIAS_DEFAULT); break; } case TextRenderingHintClearTypeGridFit: { cairo_font_options_set_antialias(FontOptions, CAIRO_ANTIALIAS_DEFAULT); break; } } cairo_set_font_options(graphics->ct, FontOptions); cairo_font_options_destroy(FontOptions); // Do we want this here? /* Commented out until we properly save/restore AA settings; should fix bug #76135 cairo_set_antialias(graphics->ct, CAIRO_ANTIALIAS_NONE); */ /* Get font size information; how expensive is the cairo stuff here? */ cairo_set_font_face (graphics->ct, (cairo_font_face_t*) font->cairofnt); /* Set our font; this will also be used for later drawing */ /* this will always return the same value, except when printing */ FontSize = (graphics->type == gtPostScript) ? font->emSize : font->sizeInPixels; cairo_set_font_size (graphics->ct, FontSize); cairo_font_extents (graphics->ct, &FontExtent); /* Get the size we're looking for */ /* cairo_font_set_transform(font->cairofnt, SavedMatrix);*/ /* Restore the matrix */ if ((LineHeight=FontExtent.ascent)<1) { LineHeight=1; } #ifdef DRAWSTRING_DEBUG printf("Font extents: ascent:%d, descent: %d, height:%d, maxXadvance:%d, maxYadvance:%d\n", (int)FontExtent.ascent, (int)FontExtent.descent, (int)FontExtent.height, (int)FontExtent.max_x_advance, (int)FontExtent.max_y_advance); #endif /* Sanitize string, remove formatting chars and build description array */ #ifdef DRAWSTRING_DEBUG printf("GdipDrawString(...) Sanitizing string, StringLen=%d\n", StringLen); #endif Src=stringUnicode; /* unless specified we don't consider the trailing spaces, unless there is just one space (#80680) */ if ((format->formatFlags & StringFormatFlagsMeasureTrailingSpaces) == 0) { while ((StringLen > 0) && (isspace ((int) ((unsigned char) *(Src + StringLen - 1))))) StringLen--; if (StringLen == 0) StringLen = 1; } Dest=CleanString; CurrentDetail=StringDetails; for (i=0; i 0) { CurrentDetail->Flags |= STRING_DETAIL_TAB; } Src++; continue; } case '\n': { /* LF */ CurrentDetail->Flags |= STRING_DETAIL_LF; CurrentDetail->Linefeeds++; Src++; continue; } case '&': { /* We print *all* chars if no hotkeys */ if (format->hotkeyPrefix==HotkeyPrefixNone) { break; } Src++; if (*Src=='&') { /* We skipped the first '&', the break will make us drop to copying the second */ break; } CurrentDetail->Flags |= STRING_DETAIL_HOTKEY; if (data) data->has_hotkeys = TRUE; continue; } /* Boy, this must be slow, FIXME somehow */ default: { if (((format->formatFlags & StringFormatFlagsNoWrap)==0) || ((format->trimming != StringTrimmingCharacter) && (format->trimming != StringTrimmingNone))) { break; } /* Fall through */ } case ' ': case '.': { /* Mark where we can break for a new line */ CurrentDetail->Flags |= STRING_DETAIL_BREAK; break; } } *Dest=*Src; Src++; Dest++; CurrentDetail++; } *Dest='\0'; /* Recalculate StringLen; we may have shortened String */ Dest=CleanString; StringLen=0; while (*Dest!=0) { StringLen++; Dest++; } /* Don't bother doing anything else if the length is 0 */ if (StringLen == 0) { *length = 0; return Ok; } /* Convert string from Gdiplus format to UTF8, suitable for cairo */ String = (BYTE*) ucs2_to_utf8 ((const gunichar2 *)CleanString, -1); if (!String) return OutOfMemory; #ifdef DRAWSTRING_DEBUG printf("Sanitized string: >%s<, length %d (utf8-length:%d)\n", String, StringLen, strlen((char *)String)); #endif /* Generate size array */ if (CalculateStringWidths (graphics->ct, font, CleanString, StringLen, StringDetails)==0) { /* FIXME; pick right return code */ GdipFree(String); return Ok; } GdipFree (String); CursorX=0; CursorY=0; MaxX=0; MaxXatY=0; MaxY=0; CurrentLineStart=StringDetails; CurrentDetail=StringDetails; CurrentDetail->Flags |= STRING_DETAIL_LINESTART; WrapPoint=-1; WrapX=0; if (format->formatFlags & StringFormatFlagsDirectionVertical) { FrameWidth = SAFE_FLOAT_TO_UINT32 (rc->Height); FrameHeight = SAFE_FLOAT_TO_UINT32 (rc->Width); } else { FrameWidth = SAFE_FLOAT_TO_UINT32 (rc->Width); FrameHeight = SAFE_FLOAT_TO_UINT32 (rc->Height); } #ifdef DRAWSTRING_DEBUG printf("Frame %d x %d\n", FrameWidth, FrameHeight); #endif for (i=0; iFlags & STRING_DETAIL_TAB) { float tab_pos; int tab_index; tab_pos = format->firstTabOffset; tab_index = 0; while (CursorX > tab_pos) { tab_pos += TabStops[tab_index % NumOfTabStops]; tab_index++; } CursorX = tab_pos; CurrentLineStart = CurrentDetail; CurrentDetail->Flags |= STRING_DETAIL_LINESTART; } if (CurrentDetail->Flags & STRING_DETAIL_LF) { CursorX = 0; CursorY += LineHeight * CurrentDetail->Linefeeds; CurrentDetail->Flags |= STRING_DETAIL_LINESTART; CurrentLineStart = CurrentDetail; #ifdef DRAWSTRING_DEBUG { int j; for (j=0; jLinefeeds; j++) { printf("\n"); } } #endif } #ifdef DRAWSTRING_DEBUG printf("[%3d] X: %3d, Y:%3d, '%c' | ", i, (int)CursorX, (int)CursorY, CleanString[i]>=32 ? CleanString[i] : '?'); #endif /* Remember where to wrap next, but only if wrapping allowed */ if (((format->formatFlags & StringFormatFlagsNoWrap)==0) && (CurrentDetail->Flags & STRING_DETAIL_BREAK)) { if (CleanString[i] == ' ') { WrapPoint=i+1; /* We skip the break char itself, keeping it at the end of the old line */ } else { WrapPoint=i; } if (CursorX>MaxX) { WrapX=CursorX; } else { WrapX=MaxX; } #ifdef DRAWSTRING_DEBUG printf(""); #endif } /* New line voids any previous wrap point */ if (CurrentDetail->Flags & STRING_DETAIL_LINESTART) { WrapPoint=-1; } CurrentDetail->PosX=CursorX; CurrentDetail->PosY=CursorY; /* Advance cursor */ CursorX+=CurrentDetail->Width; if (MaxXFrameWidth) { if (WrapPoint!=-1) { /** Re-Calculate line lengths **/ /* Old line */ CurrentLineStart->LineLen-=i-WrapPoint; if (MaxXatY==CursorY) { MaxX=WrapX; } /* Remove the trailing space from being counted if we're not supposed to */ if (((format->formatFlags & StringFormatFlagsMeasureTrailingSpaces)==0) && (WrapPoint>0)) { if (CleanString[WrapPoint-1]==' ') { if (MaxXatY==CursorY) { MaxX-=StringDetails[WrapPoint-1].Width; } StringDetails[WrapPoint-1].Width=0; CurrentLineStart->LineLen--; } } /* New line */ CurrentLineStart=&(StringDetails[WrapPoint]); CurrentLineStart->Flags|=STRING_DETAIL_LINESTART; CurrentLineStart->LineLen=0; /* Generate CursorX/Y for new line */ CursorY+=LineHeight; CursorX=CurrentLineStart->Width; i=WrapPoint; #ifdef DRAWSTRING_DEBUG printf("\n\n", WrapPoint, CursorX, CurrentLineStart->LineLen); #endif CurrentDetail=&(StringDetails[WrapPoint]); CurrentDetail->PosX=0; CurrentDetail->PosY=CursorY; WrapPoint=-1; } else { /* This line is too long and has no wrap points, check if we need to insert ellipsis. To keep at least a bit of performance, we cheat - we don't actually calculate the size of the elipsis chars but assume that they're always smaller than any other character. And we don't try to hard to fit as many chars as possible. */ int EndOfLine; #ifdef DRAWSTRING_DEBUG printf("No wrappoint (yet) set\n"); #endif /* Find end of line, index i is the first char no longer visible on the line */ EndOfLine=i; if ((format->formatFlags & StringFormatFlagsNoWrap)==0) { while (EndOfLinetrimming==StringTrimmingEllipsisWord) || (format->trimming==StringTrimmingEllipsisCharacter)) { if (CurrentLineStart->LineLen>3) { if (format->trimming==StringTrimmingEllipsisCharacter) { CleanString[i-1]='.'; CleanString[i-2]='.'; CleanString[i-3]='.'; } else { int found=0; j=i; while(j>(i-CurrentLineStart->LineLen)) { if (CleanString[j]==' ') { CleanString[j]='.'; CurrentLineStart->LineLen-=i-j-1; if ((j+1)LineLen++; } if ((j+2)LineLen++; } found=1; break; } j--; } if (!found) { CleanString[i-1]='.'; CleanString[i-2]='.'; CleanString[i-3]='.'; } } } } else if (format->trimming==StringTrimmingEllipsisPath) { int k; float LineWidth; /* Find end of line, index i is the first char no longer visible on the line */ EndOfLine=i; while (EndOfLineLineLen>3) { j=i-(CurrentLineStart->LineLen/2); CleanString[j-1]='.'; CleanString[j]='.'; CleanString[j+1]='.'; /* Have just enough to include our ellipsis */ LineWidth=0; for (k=i-CurrentLineStart->LineLen; k<(j+1); k++) { LineWidth+=StringDetails[k].Width; } CurrentLineStart->LineLen=i-j+3; /* 3=ellipsis */ /* Now figure out how many chars from the end of the string we have to copy */ j+=2; /* Points to the char behind the last ellipsis */ k=EndOfLine-1; while ((LineWidth+StringDetails[k].Width)LineLen+=EndOfLine-k-1; } } else { #ifdef DRAWSTRING_DEBUG /* Just cut off the text */ printf("End of line at index:%d\n", EndOfLine); #endif CurrentLineStart->LineLen=EndOfLine; } if ((format->formatFlags & StringFormatFlagsNoWrap)!=0) { // Avoid endless loops, always print at least one char if (CurrentLineStart->LineLen == 0) { CurrentLineStart->LineLen = 1; } break; } /* avoid endless loop when wrapping is allowed */ if (CurrentLineStart->LineLen == 0) { CurrentLineStart->LineLen = 1; } /* New line */ CurrentLineStart=&(StringDetails[EndOfLine]); CurrentLineStart->Flags|=STRING_DETAIL_LINESTART; CurrentLineStart->LineLen=0; /* Generate CursorX/Y for new line */ CursorY+=LineHeight; CursorX=CurrentLineStart->Width; i=EndOfLine; CurrentDetail=&(StringDetails[EndOfLine]); CurrentDetail->PosX=0; CurrentDetail->PosY=CursorY; } } /* Still visible? */ if ((FrameWidth && CursorX>FrameWidth) || (FrameHeight && ((CursorY>FrameHeight) || ((format->formatFlags & StringFormatFlagsLineLimit) && (CursorY+LineHeight)>FrameHeight)))) { CurrentDetail->Flags|=STRING_DETAIL_HIDDEN; #ifdef DRAWSTRING_DEBUG if (CurrentDetail->Flags & STRING_DETAIL_LINESTART) { printf(""); } else { printf(""); } #endif } else { if (MaxYLineLen++; } /* We ignored it above, for shorter of calculations, also, add a bit of padding */ #if 0 if ((fmt->formatFlags & StringFormatFlagsNoFitBlackBox) == 0) { MaxX+=2; } #endif MaxY+=LineHeight+FontExtent.descent; #ifdef DRAWSTRING_DEBUG printf("\n"); printf("Bounding box: %d x %d\n", MaxX, MaxY); printf("Line layout [Total len %d]:\n", StringLen); for (i=0; ialignment; if (format->formatFlags & StringFormatFlagsDirectionRightToLeft) { if (format->alignment==StringAlignmentNear) { AlignHorz=StringAlignmentFar; } else if (format->alignment==StringAlignmentFar) { AlignHorz=StringAlignmentNear; } } AlignVert = format->lineAlignment; #if 0 /* Alignment sanity checks, not sure about these, might not match MS */ if (MaxX>rc->Width) { AlignHorz=StringAlignmentNear; } if (MaxY>rc->Height) { AlignVert=StringAlignmentNear; } #endif /* At this point we know our bounding box, what characters are to be displayed and where every character goes */ if (boundingBox) { boundingBox->X = rc->X; boundingBox->Y = rc->Y; if (format->formatFlags & StringFormatFlagsDirectionVertical) { boundingBox->Width = MaxY; boundingBox->Height = MaxX; } else { boundingBox->Width = MaxX; boundingBox->Height = MaxY; } if ((rc->Width > 0) && (boundingBox->Width > rc->Width)) { boundingBox->Width = rc->Width; } if ((rc->Height > 0) && (boundingBox->Height > rc->Height)) { boundingBox->Height = rc->Height; } /* avoid conversion computations if possible */ if (!OPTIMIZE_CONVERSION (graphics)) { boundingBox->X = gdip_convgr_unitx (graphics, boundingBox->X); boundingBox->Y = gdip_convgr_unity (graphics, boundingBox->Y); boundingBox->Width = gdip_convgr_unitx (graphics, boundingBox->Width); boundingBox->Height = gdip_convgr_unity (graphics, boundingBox->Height); } } if (codepointsFitted) { /* how many characters from the string can be drawn in the boundingBox (#76664) */ double max_width = boundingBox ? (boundingBox->X + boundingBox->Width) : rc->X + min (MaxX, rc->Width); double max_height = boundingBox ? (boundingBox->Y + boundingBox->Height) : rc->Y + min (MaxY, rc->Height); int charactersFitted; for (charactersFitted = 0; charactersFitted < StringLen; charactersFitted++) { if ((StringDetails[charactersFitted].PosX + StringDetails[charactersFitted].Width) > max_width) break; if (StringDetails[charactersFitted].PosY + LineHeight > max_height) break; } *codepointsFitted = charactersFitted; } if (linesFilled) { /* how many *complete* lines fits in our calculated boundingBox */ double height = (boundingBox) ? boundingBox->Height : min (MaxY, rc->Height); *linesFilled = floor (height / LineHeight); } /* if asked, supply extra data to be reused when drawing the same string */ if (data) { data->align_horz = AlignHorz; data->align_vert = AlignVert; data->line_height = LineHeight; data->max_y = MaxY; data->descent = FontExtent.descent; } return Ok; } static GpStatus DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc_org, GDIPCONST GpStringFormat *fmt, GpBrush *brush, WCHAR *CleanString, GpStringDetailStruct* StringDetails, GpDrawTextData *data) { float CursorX = 0.0; /* Current X position of drawing cursor */ float CursorY = 0.0; /* Current Y position of drawing cursor */ int StringLen = length; BOOL SetClipping = FALSE; unsigned long i, j; int AlignHorz = data->align_horz; int AlignVert = data->align_vert; int LineHeight = data->line_height; int MaxY = data->max_y; cairo_font_extents_t FontExtent; RectF rect, *rc = ▭ cairo_font_extents (graphics->ct, &FontExtent); if (OPTIMIZE_CONVERSION (graphics)) { rc->X = rc_org->X; rc->Y = rc_org->Y; rc->Width = rc_org->Width; rc->Height = rc_org->Height; } else { rc->X = gdip_unitx_convgr (graphics, rc_org->X); rc->Y = gdip_unity_convgr (graphics, rc_org->Y); rc->Width = gdip_unitx_convgr (graphics, rc_org->Width); rc->Height = gdip_unity_convgr (graphics, rc_org->Height); } /* Set our clipping rectangle */ if ((rc->Width!=0) && (rc->Height!=0) && ((fmt->formatFlags & StringFormatFlagsNoClip)==0)) { #ifdef DRAWSTRING_DEBUG printf("Setting clipping rectangle (%f, %f %fx%f)\n", rc->X, rc->Y, rc->Width, rc->Height); #endif /* We do not call cairo_reset_clip because we want to take previous clipping into account */ gdip_cairo_rectangle (graphics, rc->X, rc->Y, rc->Width, rc->Height, TRUE); cairo_clip (graphics->ct); SetClipping = TRUE; } /* Setup cairo */ if (brush) { gdip_brush_setup (graphics, (GpBrush *)brush); } else { cairo_set_source_rgb (graphics->ct, 0., 0., 0.); } for (i=0; i StringLen - i) length = StringLen - i; String = (BYTE*) ucs2_to_utf8 ((const gunichar2 *)(CleanString+i), length); #ifdef DRAWSTRING_DEBUG printf("Displaying line >%s< (%d chars)\n", String, length); #endif if ((fmt->formatFlags & StringFormatFlagsDirectionVertical)==0) { CursorX = rc->X + StringDetails[i].PosX; switch (AlignHorz) { case StringAlignmentNear: break; case StringAlignmentCenter: /* PosX isn't calculated if the char is out of the bounding box (#79573/#79685) */ if ((current_line_length == 1) || (StringDetails [current_line_length-1].PosX > 0)) { CursorX += (rc->Width - StringDetails [current_line_length-1].PosX - StringDetails [current_line_length-1].Width) / 2; } /* which means that the line is too long so no centering is required */ break; case StringAlignmentFar: CursorX += rc->Width - StringDetails [current_line_length-1].PosX - StringDetails [current_line_length-1].Width; break; } switch (AlignVert) { case StringAlignmentNear: CursorY=rc->Y+StringDetails[i].PosY+LineHeight; break; case StringAlignmentCenter: CursorY=rc->Y+(rc->Height-MaxY)/2+StringDetails[i].PosY+LineHeight; break; case StringAlignmentFar: CursorY=rc->Y+rc->Height-MaxY+StringDetails[i].PosY+LineHeight; break; } gdip_cairo_move_to (graphics, CursorX, CursorY, FALSE, TRUE); cairo_show_text (graphics->ct, (const char *) String); } else { CursorY = rc->Y; switch (AlignHorz) { case StringAlignmentNear: break; case StringAlignmentCenter: /* PosX isn't calculated if the char is out of the bounding box (#79573/#79685) */ if ((current_line_length == 1) || (StringDetails [current_line_length-1].PosX > 0)) { CursorY += (rc->Height - StringDetails[current_line_length-1].PosX - StringDetails [current_line_length-1].Width) / 2; } /* which means that the line is too long so no centering is required */ break; case StringAlignmentFar: CursorY += rc->Height - StringDetails[current_line_length-1].PosX - StringDetails [current_line_length-1].Width; break; } switch (AlignVert) { case StringAlignmentNear: CursorX=rc->X + StringDetails[i].PosX+StringDetails[i].PosY; break; case StringAlignmentCenter: CursorX=rc->X + StringDetails[i].PosX+(rc->Width-MaxY)/2+StringDetails[i].PosY; break; case StringAlignmentFar: CursorX=rc->X + StringDetails[i].PosX+rc->Width-MaxY+StringDetails[i].PosY; break; } /* Rotate text for vertical drawing */ cairo_save (graphics->ct); gdip_cairo_move_to (graphics, CursorX, CursorY, FALSE, TRUE); cairo_rotate (graphics->ct, PI/2); cairo_show_text (graphics->ct, (const char *) String); cairo_restore (graphics->ct); } #ifdef DRAWSTRING_DEBUG printf("Drawing %d chars at %d x %d (width=%f pixels)\n", StringDetails[i].LineLen, (int)CursorX, (int)CursorY, StringDetails[i+StringDetails[i].LineLen-1].PosX); #endif GdipFree (String); if (font->style & (FontStyleUnderline | FontStyleStrikeout)) { double line_width = cairo_get_line_width (graphics->ct); /* Calculate the width of the line */ cairo_set_line_width (graphics->ct, 1.0); j=StringDetails[i+StringDetails[i].LineLen-1].PosX+StringDetails[i+StringDetails[i].LineLen-1].Width; if (font->style & FontStyleStrikeout) { if ((fmt->formatFlags & StringFormatFlagsDirectionVertical)==0) { gdip_cairo_move_to (graphics, (int)(CursorX), (int)(CursorY-FontExtent.descent), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX+j), (int)(CursorY-FontExtent.descent), FALSE, TRUE); } else { gdip_cairo_move_to (graphics, (int)(CursorX+FontExtent.descent), (int)(CursorY), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX+FontExtent.descent), (int)(CursorY+j), FALSE, TRUE); } } if (font->style & FontStyleUnderline) { if ((fmt->formatFlags & StringFormatFlagsDirectionVertical)==0) { gdip_cairo_move_to (graphics, (int)(CursorX), (int)(CursorY+FontExtent.descent-2), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX+j), (int)(CursorY+FontExtent.descent-2), FALSE, TRUE); } else { gdip_cairo_move_to (graphics, (int)(CursorX+FontExtent.descent-2), (int)(CursorY), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX+FontExtent.descent-2), (int)(CursorY+j), FALSE, TRUE); } } cairo_stroke (graphics->ct); cairo_set_line_width (graphics->ct, line_width); } i+=StringDetails[i].LineLen-1; } } /* Handle Hotkey prefix */ if (fmt->hotkeyPrefix==HotkeyPrefixShow && data->has_hotkeys) { GpStringDetailStruct *CurrentDetail = StringDetails; for (i=0; iFlags & STRING_DETAIL_LINESTART) { if ((fmt->formatFlags & StringFormatFlagsDirectionVertical)==0) { switch (AlignHorz) { case StringAlignmentNear: CursorX=rc->X; break; case StringAlignmentCenter: CursorX=rc->X+(rc->Width-StringDetails[i+StringDetails[i].LineLen-1].PosX-StringDetails[i+StringDetails[i].LineLen-1].Width)/2; break; case StringAlignmentFar: CursorX=rc->X+rc->Width-StringDetails[i+StringDetails[i].LineLen-1].PosX-StringDetails[i+StringDetails[i].LineLen-1].Width; break; } switch (AlignVert) { case StringAlignmentNear: CursorY=rc->Y+StringDetails[i].PosY+LineHeight; break; case StringAlignmentCenter: CursorY=rc->Y+(rc->Height-MaxY)/2+StringDetails[i].PosY+LineHeight; break; case StringAlignmentFar: CursorY=rc->Y+rc->Height-MaxY+StringDetails[i].PosY+LineHeight; break; } } else { switch (AlignHorz) { case StringAlignmentNear: CursorY=rc->Y; break; case StringAlignmentCenter: CursorY=rc->Y+(rc->Height-StringDetails[i+StringDetails[i].LineLen-1].PosX-StringDetails[i+StringDetails[i].LineLen-1].Width)/2; break; case StringAlignmentFar: CursorY=rc->Y+rc->Height-StringDetails[i+StringDetails[i].LineLen-1].PosX-StringDetails[i+StringDetails[i].LineLen-1].Width; break; } switch (AlignVert) { case StringAlignmentNear: CursorX=rc->X+StringDetails[i].PosY; break; case StringAlignmentCenter: CursorX=rc->X+(rc->Width-MaxY)/2+StringDetails[i].PosY; break; case StringAlignmentFar: CursorX=rc->X+rc->Width-MaxY+StringDetails[i].PosY; break; } } } if (CurrentDetail->Flags & STRING_DETAIL_HOTKEY) { if ((fmt->formatFlags & StringFormatFlagsDirectionVertical)==0) { CursorX+=CurrentDetail->PosX; cairo_set_line_width(graphics->ct, 1); gdip_cairo_move_to (graphics, (int)(CursorX), (int)(CursorY+FontExtent.descent/2), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX+CurrentDetail->Width), (int)(CursorY+FontExtent.descent/2), FALSE, TRUE); cairo_stroke (graphics->ct); CursorX-=CurrentDetail->PosX; } else { CursorY+=CurrentDetail->PosX; gdip_cairo_move_to (graphics, (int)(CursorX-FontExtent.descent/2), (int)(CursorY), FALSE, TRUE); gdip_cairo_line_to (graphics, (int)(CursorX-FontExtent.descent/2), (int)(CursorY+CurrentDetail->Width), FALSE, TRUE); CursorY-=CurrentDetail->PosX; } } CurrentDetail++; } } /* Restore the graphics clipping region */ if (SetClipping) cairo_SetGraphicsClip (graphics); return Ok; } static GpStatus AllocStringData (WCHAR **clean_string, GpStringDetailStruct **details, int length) { *details = gdip_calloc (length + 1, sizeof (GpStringDetailStruct)); if (!*details) return OutOfMemory; *clean_string = GdipAlloc (sizeof (WCHAR) * (length + 1)); if (!*clean_string) { GdipFree (*details); return OutOfMemory; } return Ok; } GpStatus cairo_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) { cairo_matrix_t SavedMatrix; GpStringFormat *fmt; BOOL hotkeys = FALSE; GpStringDetailStruct *StringDetails; WCHAR *CleanString; GpDrawTextData data; /* avoid recomputation of stuff done while measuring */ int StringLen = length; GpStatus status = AllocStringData (&CleanString, &StringDetails, length); if (status != Ok) return status; /* a NULL format is valid, it means get the generic default values (and free them later) */ if (!format) { GdipStringFormatGetGenericDefault ((GpStringFormat **)&fmt); } else { fmt = (GpStringFormat *)format; } /* is the following ok ? */ cairo_get_font_matrix (graphics->ct, &SavedMatrix); status = MeasureString (graphics, stringUnicode, &StringLen, font, rc, fmt, brush, NULL, NULL, NULL, CleanString, StringDetails, &data); if ((status == Ok) && (StringLen > 0)) { status = DrawString (graphics, stringUnicode, StringLen, font, rc, fmt, brush, CleanString, StringDetails, &data); } /* Restore matrix to original values */ cairo_set_font_matrix (graphics->ct, &SavedMatrix); /* Cleanup */ GdipFree (CleanString); GdipFree (StringDetails); /* we must delete the default stringformat (when one wasn't provided by the caller) */ if (format != fmt) GdipDeleteStringFormat (fmt); return status; } GpStatus cairo_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, int *codepointsFitted, int *linesFilled) { cairo_matrix_t SavedMatrix; GpStringFormat *fmt; GpStringDetailStruct *StringDetails; WCHAR *CleanString; int StringLen = length; GpStatus status; status = AllocStringData (&CleanString, &StringDetails, length); if (status != Ok) return status; /* a NULL format is valid, it means get the generic default values (and free them later) */ if (!format) { GdipStringFormatGetGenericDefault ((GpStringFormat **)&fmt); } else { fmt = (GpStringFormat *)format; } /* is the following ok ? */ cairo_get_font_matrix (graphics->ct, &SavedMatrix); status = MeasureString (graphics, stringUnicode, &StringLen, font, rc, fmt, NULL, boundingBox, codepointsFitted, linesFilled, CleanString, StringDetails, NULL); /* Restore matrix to original values */ cairo_set_font_matrix (graphics->ct, &SavedMatrix); /* Cleanup */ GdipFree (CleanString); GdipFree (StringDetails); /* we must delete the default stringformat (when one wasn't provided by the caller) */ if (format != fmt) GdipDeleteStringFormat (fmt); return status; } GpStatus cairo_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, int regionCount, GpRegion **regions) { int i, j, start, end; int lineHeight; CharacterRange range; GpStringDetailStruct* StringDetails; RectF boundingBox; RectF charRect; RectF rc_coords, *layoutRect = &rc_coords; float FontSize; BOOL optimize_convert; WCHAR *CleanString; GpDrawTextData data; /* avoid recomputation of stuff done while measuring */ int StringLen = length; GpStatus status = AllocStringData (&CleanString, &StringDetails, length); if (status != Ok) return status; /* avoid conversion if possible */ optimize_convert = OPTIMIZE_CONVERSION (graphics); if (optimize_convert) { layoutRect->X = layout->X; layoutRect->Y = layout->Y; layoutRect->Width = layout->Width; layoutRect->Height = layout->Height; } else { layoutRect->X = gdip_unitx_convgr (graphics, layout->X); layoutRect->Y = gdip_unity_convgr (graphics, layout->Y); layoutRect->Width = gdip_unitx_convgr (graphics, layout->Width); layoutRect->Height = gdip_unity_convgr (graphics, layout->Height); } if (layoutRect->Width <= 0.0) { if (layoutRect->Height < 0.0) { /* special case only if BOTH values are negative */ for (i = 0; i < format->charRangeCount; i++) GdipSetInfinite (regions [i]); return Ok; } else { layoutRect->Width = REGION_INFINITE_LENGTH; } } if (layoutRect->Height <= 0.0) { layoutRect->Height = REGION_INFINITE_LENGTH; } /* string measurements */ status = MeasureString (graphics, stringUnicode, &StringLen, font, layoutRect, format, NULL, NULL, NULL, NULL, CleanString, StringDetails, &data); if (status != Ok) goto cleanup; lineHeight = data.line_height + data.descent; /* Create a region for every char range */ for (i = 0; i < format->charRangeCount; i++) { range = format->charRanges [i]; GdipSetEmpty (regions [i]); if (range.Length > 0) start = range.First; else start = range.First + range.Length; end = start + range.Length; /* sanity check on charRange. negative lengths are allowed */ if (range.First < 0) { status = InvalidParameter; goto cleanup; } if ((start < 0) || (end > length)) { status = InvalidParameter; goto cleanup; } /* calculate the regions */ for (j = start; j < end; j++) { /* the prefix char (&) always count - even if we are not actually print it as a char */ if ((StringDetails[j].Flags & STRING_DETAIL_HOTKEY) && (format->hotkeyPrefix != HotkeyPrefixNone)) { end--; /* '&' count as invisible char */ continue; } /* workaround the fact that current implementation thinks LF is on the next line */ if ((j == end - 1) && (StringDetails[j].Flags & STRING_DETAIL_LF)) continue; if (format->formatFlags & StringFormatFlagsDirectionVertical) { charRect.X = StringDetails [j].PosY; charRect.Y = StringDetails [j].PosX; charRect.Width = lineHeight; charRect.Height = StringDetails [j].Width; } else { charRect.X = StringDetails [j].PosX; charRect.Y = StringDetails [j].PosY; charRect.Width = StringDetails [j].Width; charRect.Height = lineHeight; } if (optimize_convert) { charRect.X = gdip_convgr_unitx (graphics, charRect.X); charRect.Y = gdip_convgr_unity (graphics, charRect.Y); charRect.Width = gdip_convgr_unitx (graphics, charRect.Width); charRect.Height = gdip_convgr_unity (graphics, charRect.Height); } status = GdipCombineRegionRect (regions [i], &charRect, CombineModeUnion); if (status != Ok) break; } if (status != Ok) break; } cleanup: /* Cleanup */ GdipFree (CleanString); GdipFree (StringDetails); return status; } #endif libgdiplus-4.2/src/fontfamily.h0000664000175000017500000000520412377405421013556 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __FONTFAMILY_H__ #define __FONTFAMILY_H__ /* FontFamily public API (only!) */ GpStatus GdipCreateFontFamilyFromName (GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **FontFamily); GpStatus GdipCloneFontFamily (GpFontFamily *fontFamily, GpFontFamily **clonedFontFamily); GpStatus GdipDeleteFontFamily (GpFontFamily *fontFamily); GpStatus GdipGetCellAscent (GDIPCONST GpFontFamily *family, int style, guint16 *CellAscent); GpStatus GdipGetCellDescent (GDIPCONST GpFontFamily *family, int style, guint16 *CellDescent); GpStatus GdipGetGenericFontFamilySansSerif (GpFontFamily **nativeFamily); GpStatus GdipGetGenericFontFamilySerif (GpFontFamily **nativeFamily); GpStatus GdipGetGenericFontFamilyMonospace (GpFontFamily **nativeFamily); GpStatus GdipGetEmHeight (GDIPCONST GpFontFamily *family, int style, guint16 *EmHeight); GpStatus GdipGetFamilyName (GDIPCONST GpFontFamily *family, WCHAR name[LF_FACESIZE], LANGID language); GpStatus GdipGetLineSpacing (GDIPCONST GpFontFamily *family, int style, guint16 *LineSpacing); GpStatus GdipIsStyleAvailable (GDIPCONST GpFontFamily *family, int style, BOOL *IsStyleAvailable); #endif libgdiplus-4.2/src/graphics.c0000664000175000017500000017176312377405421013217 00000000000000/* * graphics.c * * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #include "graphics-private.h" #include "graphics-cairo-private.h" #include "graphics-metafile-private.h" #include "region-private.h" #include "graphics-path-private.h" #include "brush-private.h" #include "matrix-private.h" #include "bitmap-private.h" #include "metafile-private.h" #include #define NO_CAIRO_AA #define MAX_GRAPHICS_STATE_STACK 512 float gdip_unit_conversion (Unit from, Unit to, float dpi, GraphicsType type, float nSrc) { float inchs = 0; switch (from) { case UnitDocument: inchs = nSrc / 300.0f; break; case UnitInch: inchs = nSrc; break; case UnitMillimeter: inchs = nSrc / 25.4f; break; case UnitDisplay: if (type == gtPostScript) { /* Uses 1/100th on printers */ inchs = nSrc / 100; } else { /* Pixel for video display */ inchs = nSrc / dpi; } break; case UnitPixel: case UnitWorld: inchs = nSrc / dpi; break; case UnitPoint: inchs = nSrc / 72.0f; break; case UnitCairoPoint: if (type == gtPostScript) { /* Uses 1/100th on printers */ inchs = nSrc / 72.0f; } else { /* Pixel for video display */ inchs = nSrc / dpi; } break; default: return nSrc; } switch (to) { case UnitDocument: return inchs * 300.0f; case UnitInch: return inchs; case UnitMillimeter: return inchs * 25.4f; case UnitDisplay: if (type == gtPostScript) { /* Uses 1/100th on printers */ return inchs * 100; } else { /* Pixel for video display */ return inchs * dpi; } case UnitPixel: case UnitWorld: return inchs * dpi; case UnitPoint: return inchs * 72.0f; case UnitCairoPoint: if (type == gtPostScript) { /* Uses 1/100th on printers */ return inchs * 72.0f; } else { /* Pixel for video display */ return inchs * dpi; } default: return nSrc; } } static void gdip_graphics_reset (GpGraphics *graphics) { /* if required, previous_matrix will be assigned later (e.g. containers) */ cairo_matrix_init_identity (&graphics->previous_matrix); GdipResetClip (graphics); cairo_matrix_init_identity (graphics->clip_matrix); graphics->page_unit = UnitDisplay; graphics->scale = 1.0f; graphics->interpolation = InterpolationModeBilinear; graphics->composite_quality = CompositingQualityDefault; graphics->composite_mode = CompositingModeSourceOver; graphics->text_mode = TextRenderingHintSystemDefault; graphics->pixel_mode = PixelOffsetModeDefault; graphics->text_contrast = DEFAULT_TEXT_CONTRAST; GdipSetSmoothingMode(graphics, SmoothingModeNone); } static void gdip_graphics_common_init (GpGraphics *graphics) { graphics->image = NULL; graphics->type = gtUndefined; cairo_identity_matrix (graphics->ct); GdipCreateMatrix (&graphics->copy_of_ctm); cairo_matrix_init_identity (graphics->copy_of_ctm); GdipCreateRegion (&graphics->clip); GdipCreateMatrix (&graphics->clip_matrix); graphics->bounds.X = graphics->bounds.Y = graphics->bounds.Width = graphics->bounds.Height = 0; graphics->last_pen = NULL; graphics->last_brush = NULL; graphics->saved_status = NULL; graphics->saved_status_pos = 0; graphics->render_origin_x = 0; graphics->render_origin_y = 0; graphics->dpi_x = graphics->dpi_y = 0; graphics->display = NULL; graphics->drawable = NULL; gdip_graphics_reset (graphics); } static void gdip_graphics_cairo_init (GpGraphics *graphics, cairo_surface_t *surface) { graphics->backend = GraphicsBackEndCairo; graphics->metafile = NULL; graphics->ct = cairo_create (surface); #ifndef NO_CAIRO_AA cairo_set_shape_format (graphics->ct, CAIRO_FORMAT_A1); #endif /* cairo_select_font_face (graphics->ct, "serif:12"); */ cairo_select_font_face (graphics->ct, "serif:12", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); gdip_graphics_common_init (graphics); } GpGraphics * gdip_graphics_new (cairo_surface_t *surface) { GpGraphics *result = (GpGraphics *) GdipAlloc (sizeof (GpGraphics)); if (result) gdip_graphics_cairo_init (result, surface); return result; } static void gdip_graphics_metafile_init (GpGraphics *graphics, GpMetafile *metafile) { graphics->backend = GraphicsBackEndMetafile; /* some API requires a valid cairo context (even on a metafile-based graphics) */ graphics->metasurface = cairo_image_surface_create (CAIRO_FORMAT_A1, 1, 1); graphics->ct = cairo_create (graphics->metasurface); graphics->metafile = metafile; gdip_graphics_common_init (graphics); } GpGraphics* gdip_metafile_graphics_new (GpMetafile *metafile) { GpGraphics *result = (GpGraphics *) GdipAlloc (sizeof (GpGraphics)); if (result) gdip_graphics_metafile_init (result, metafile); return result; } // coverity[+alloc : arg-*1] GpStatus GdipCreateFromHDC (void *hDC, GpGraphics **graphics) { GpGraphics *clone = (GpGraphics *) hDC; cairo_surface_t *surface; int x, y; unsigned int w, h, border_w, depth; Window root; if (!hDC) return OutOfMemory; #ifdef CAIRO_HAS_PS_SURFACE if (clone->type == gtPostScript) { *graphics = clone; return Ok; } #endif if (clone->type == gtMemoryBitmap) return GdipGetImageGraphicsContext (clone->image, graphics); #ifdef CAIRO_HAS_XLIB_SURFACE XGetGeometry (clone->display, clone->drawable, &root, &x, &y, &w, &h, &border_w, &depth); surface = cairo_xlib_surface_create(clone->display, clone->drawable, DefaultVisual(clone->display, DefaultScreen(clone->display)), w, h); *graphics = gdip_graphics_new (surface); if (!*graphics) return OutOfMemory; (*graphics)->dpi_x = (*graphics)->dpi_y = gdip_get_display_dpi (); cairo_surface_destroy (surface); if ((*graphics)->drawable) (*graphics)->drawable = clone->drawable; if ((*graphics)->display) (*graphics)->display = clone->display; return Ok; #endif return NotImplemented; } GpStatus GdipCreateFromHWND (void *hwnd, GpGraphics **graphics) { return NotImplemented; } #ifdef CAIRO_HAS_QUARTZ_SURFACE // coverity[+alloc : arg-*3] GpStatus GdipCreateFromContext_macosx (void *ctx, int width, int height, GpGraphics **graphics) { cairo_surface_t *surface; if (!graphics) return InvalidParameter; surface = cairo_quartz_surface_create (0, width, height); *graphics = gdip_graphics_new(surface); (*graphics)->dpi_x = (*graphics)->dpi_y = gdip_get_display_dpi (); cairo_surface_destroy (surface); (*graphics)->bounds.Width = width; (*graphics)->bounds.Height = height; (*graphics)->type = gtOSXDrawable; (*graphics)->cg_context = ctx; return Ok; } #endif #ifdef CAIRO_HAS_XLIB_SURFACE // coverity[+alloc : arg-*2] GpStatus GdipCreateFromXDrawable_linux(Drawable d, Display *dpy, GpGraphics **graphics) { Window root_ignore; GpRect bounds; int bwidth_ignore, depth_ignore; cairo_surface_t *surface; if (!graphics) return InvalidParameter; XGetGeometry (dpy, d, &root_ignore, &bounds.X, &bounds.Y, (unsigned int *)&bounds.Width, (unsigned int *)&bounds.Height, (unsigned int *)&bwidth_ignore, (unsigned int *)&depth_ignore); surface = cairo_xlib_surface_create(dpy, d, DefaultVisual(dpy, DefaultScreen(dpy)), bounds.Width, bounds.Height); *graphics = gdip_graphics_new(surface); (*graphics)->dpi_x = (*graphics)->dpi_y = gdip_get_display_dpi (); cairo_surface_destroy (surface); (*graphics)->type = gtX11Drawable; (*graphics)->display = dpy; (*graphics)->drawable = d; GdipSetVisibleClip_linux (*graphics, &bounds); return Ok; } #endif #ifdef CAIRO_HAS_XLIB_SURFACE static int ignore_error_handler (Display *dpy, XErrorEvent *event) { return Success; } #endif GpStatus GdipDeleteGraphics (GpGraphics *graphics) { if (!graphics) return InvalidParameter; /* We don't destroy image because we did not create one. */ if (graphics->copy_of_ctm) { GdipDeleteMatrix (graphics->copy_of_ctm); graphics->copy_of_ctm = NULL; } if (graphics->clip) { GdipDeleteRegion (graphics->clip); graphics->clip = NULL; } if (graphics->clip_matrix) { GdipDeleteMatrix (graphics->clip_matrix); graphics->clip_matrix = NULL; } if (graphics->ct) { #ifdef CAIRO_HAS_XLIB_SURFACE int (*old_error_handler)(Display *dpy, XErrorEvent *ev) = NULL; if (graphics->type == gtX11Drawable) old_error_handler = XSetErrorHandler (ignore_error_handler); #endif cairo_destroy (graphics->ct); graphics->ct = NULL; #ifdef CAIRO_HAS_XLIB_SURFACE if (graphics->type == gtX11Drawable) XSetErrorHandler (old_error_handler); #endif } if (graphics->backend == GraphicsBackEndMetafile) { /* if recording this is where we save the metafile (stream or file) */ if (graphics->metafile->recording) gdip_metafile_stop_recording (graphics->metafile); cairo_surface_destroy (graphics->metasurface); graphics->metasurface = NULL; } if (graphics->saved_status) { GpState* pos_state = graphics->saved_status; int i; for (i = 0; i < MAX_GRAPHICS_STATE_STACK; i++, pos_state++) { if (pos_state->clip) GdipDeleteRegion (pos_state->clip); } GdipFree (graphics->saved_status); graphics->saved_status = NULL; } GdipFree (graphics); return Ok; } GpStatus GdipGetDC (GpGraphics *graphics, HDC *hDC) { /* For our gdi+ the hDC is equivalent to the graphics handle */ if (hDC) { *hDC = (void *)graphics; } return Ok; } GpStatus GdipReleaseDC (GpGraphics *graphics, HDC hDC) { if (hDC != (void *)graphics) { return InvalidParameter; } return Ok; } GpStatus GdipRestoreGraphics (GpGraphics *graphics, unsigned int graphicsState) { GpState* pos_state; if (!graphics) return InvalidParameter; ///printf("[%s %d] GdipRestoreGraphics called\n", __FILE__, __LINE__); if (graphicsState >= MAX_GRAPHICS_STATE_STACK || graphicsState > graphics->saved_status_pos) return InvalidParameter; pos_state = graphics->saved_status; pos_state += graphicsState; /* Save from GpState to Graphics */ gdip_cairo_matrix_copy (graphics->copy_of_ctm, &pos_state->matrix); gdip_cairo_matrix_copy (&graphics->previous_matrix, &pos_state->previous_matrix); GdipSetRenderingOrigin (graphics, pos_state->org_x, pos_state->org_y); if (graphics->clip) GdipDeleteRegion (graphics->clip); GdipCloneRegion (pos_state->clip, &graphics->clip); gdip_cairo_matrix_copy (graphics->clip_matrix, &pos_state->clip_matrix); graphics->composite_mode = pos_state->composite_mode; graphics->composite_quality = pos_state->composite_quality; graphics->interpolation = pos_state->interpolation; graphics->page_unit = pos_state->page_unit; graphics->scale = pos_state->scale; GdipSetSmoothingMode(graphics, pos_state->draw_mode); graphics->text_mode = pos_state->text_mode; graphics->pixel_mode = pos_state->pixel_mode; graphics->text_contrast = pos_state->text_contrast; graphics->saved_status_pos = graphicsState; /* re-adjust clipping (region and matrix) */ cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); /* GdipCloneRegion was called, but for some reason, not registred as an allocation */ /* coverity[freed_arg] */ return cairo_SetGraphicsClip (graphics); } GpStatus GdipSaveGraphics (GpGraphics *graphics, unsigned int *state) { GpState* pos_state; if (!graphics || !state) return InvalidParameter; ///printf("[%s %d] GdipSaveGraphics called\n", __FILE__, __LINE__); if (graphics->saved_status == NULL) { graphics->saved_status = gdip_calloc (MAX_GRAPHICS_STATE_STACK, sizeof (GpState)); graphics->saved_status_pos = 0; } if (graphics->saved_status_pos >= MAX_GRAPHICS_STATE_STACK) return OutOfMemory; pos_state = graphics->saved_status; pos_state += graphics->saved_status_pos; /* Save from Graphics to GpState */ gdip_cairo_matrix_copy (&pos_state->matrix, graphics->copy_of_ctm); GdipGetRenderingOrigin (graphics, &pos_state->org_x, &pos_state->org_y); gdip_cairo_matrix_copy (&pos_state->previous_matrix, &graphics->previous_matrix); if (pos_state->clip) GdipDeleteRegion (pos_state->clip); GdipCloneRegion (graphics->clip, &pos_state->clip); gdip_cairo_matrix_copy (&pos_state->clip_matrix, graphics->clip_matrix); pos_state->composite_mode = graphics->composite_mode; pos_state->composite_quality = graphics->composite_quality; pos_state->interpolation = graphics->interpolation; pos_state->page_unit = graphics->page_unit; pos_state->scale = graphics->scale; pos_state->draw_mode = graphics->draw_mode; pos_state->text_mode = graphics->text_mode; pos_state->pixel_mode = graphics->pixel_mode; pos_state->text_contrast = graphics->text_contrast; *state = graphics->saved_status_pos; graphics->saved_status_pos++; return Ok; } GpStatus GdipResetWorldTransform (GpGraphics *graphics) { if (!graphics) return InvalidParameter; cairo_matrix_init_identity (graphics->copy_of_ctm); cairo_matrix_init_identity (graphics->clip_matrix); switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_ResetWorldTransform (graphics); case GraphicsBackEndMetafile: return metafile_ResetWorldTransform (graphics); default: return GenericError; } } GpStatus GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) { GpStatus status; BOOL invertible; if (!graphics || !matrix) return InvalidParameter; /* optimization - inverting an identity matrix result in the identity matrix */ if (gdip_is_matrix_empty (matrix)) return GdipResetWorldTransform (graphics); /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible (matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; gdip_cairo_matrix_copy (graphics->copy_of_ctm, matrix); gdip_cairo_matrix_copy (graphics->clip_matrix, matrix); /* we already know it's invertible */ GdipInvertMatrix (graphics->clip_matrix); switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_SetWorldTransform (graphics, matrix); case GraphicsBackEndMetafile: return metafile_SetWorldTransform (graphics, matrix); default: return GenericError; } } GpStatus GdipGetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) { if (!graphics || !matrix) return InvalidParameter; /* get the effective matrix from cairo */ gdip_cairo_matrix_copy (matrix, graphics->copy_of_ctm); /* if we're inside a container then the previous matrix are hidden */ if (!gdip_is_matrix_empty (&graphics->previous_matrix)) { cairo_matrix_t inverted; /* substract the previous matrix from the effective matrix */ gdip_cairo_matrix_copy (&inverted, &graphics->previous_matrix); cairo_matrix_invert (&inverted); return GdipMultiplyMatrix (matrix, &inverted, MatrixOrderAppend); } return Ok; } static GpStatus apply_world_to_bounds (GpGraphics *graphics) { GpStatus status; GpPointF pts[2]; pts[0].X = graphics->bounds.X; pts[0].Y = graphics->bounds.Y; pts[1].X = graphics->bounds.X + graphics->bounds.Width; pts[1].Y = graphics->bounds.Y + graphics->bounds.Height; status = GdipTransformMatrixPoints (graphics->clip_matrix, (GpPointF*)&pts, 2); if (status != Ok) return status; if (pts[0].X > pts[1].X) { graphics->bounds.X = pts[1].X; graphics->bounds.Width = iround (pts[0].X - pts[1].X); } else { graphics->bounds.X = pts[0].X; graphics->bounds.Width = iround (pts[1].X - pts[0].X); } if (pts[0].Y > pts[1].Y) { graphics->bounds.Y = pts[1].Y; graphics->bounds.Height = iround (pts[0].Y - pts[1].Y); } else { graphics->bounds.Y = pts[0].Y; graphics->bounds.Height = iround (pts[1].Y - pts[0].Y); } return Ok; } GpStatus GdipMultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order) { GpStatus s; BOOL invertible; GpMatrix inverted; if (!graphics) return InvalidParameter; /* the matrix MUST be invertible to be used */ s = GdipIsMatrixInvertible (matrix, &invertible); if (!invertible || (s != Ok)) return InvalidParameter; s = GdipMultiplyMatrix (graphics->copy_of_ctm, matrix, order); if (s != Ok) return s; /* Multiply the inverted matrix with the clipping matrix */ gdip_cairo_matrix_copy (&inverted, matrix); s = GdipInvertMatrix (&inverted); if (s != Ok) return s; s = GdipMultiplyMatrix (graphics->clip_matrix, &inverted, order); if (s != Ok) return s; apply_world_to_bounds (graphics); switch (graphics->backend) { case GraphicsBackEndCairo: /* not a typo - we apply to calculated matrix to cairo context */ return cairo_SetWorldTransform (graphics, graphics->copy_of_ctm); case GraphicsBackEndMetafile: return metafile_MultiplyWorldTransform (graphics, matrix, order); default: return GenericError; } } GpStatus GdipRotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order) { GpStatus s; if (!graphics) return InvalidParameter; s = GdipRotateMatrix (graphics->copy_of_ctm, angle, order); if (s != Ok) return s; s = GdipRotateMatrix (graphics->clip_matrix, -angle, gdip_matrix_reverse_order (order)); if (s != Ok) return s; apply_world_to_bounds (graphics); switch (graphics->backend) { case GraphicsBackEndCairo: /* not a typo - we apply to calculated matrix to cairo context */ return cairo_SetWorldTransform (graphics, graphics->copy_of_ctm); case GraphicsBackEndMetafile: return metafile_RotateWorldTransform (graphics, angle, order); default: return GenericError; } } GpStatus GdipScaleWorldTransform (GpGraphics *graphics, float sx, float sy, GpMatrixOrder order) { GpStatus s; if (!graphics || (sx == 0.0f) || (sy == 0.0f)) return InvalidParameter; s = GdipScaleMatrix (graphics->copy_of_ctm, sx, sy, order); if (s != Ok) return s; s = GdipScaleMatrix (graphics->clip_matrix, (1.0f / sx), (1.0f / sy), gdip_matrix_reverse_order (order)); if (s != Ok) return s; apply_world_to_bounds (graphics); switch (graphics->backend) { case GraphicsBackEndCairo: /* not a typo - we apply to calculated matrix to cairo context */ return cairo_SetWorldTransform (graphics, graphics->copy_of_ctm); case GraphicsBackEndMetafile: return metafile_ScaleWorldTransform (graphics, sx, sy, order); default: return GenericError; } } GpStatus GdipTranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order) { GpStatus s; if (!graphics) return InvalidParameter; s = GdipTranslateMatrix (graphics->copy_of_ctm, dx, dy, order); if (s != Ok) return s; s = GdipTranslateMatrix (graphics->clip_matrix, -dx, -dy, gdip_matrix_reverse_order (order)); if (s != Ok) return s; apply_world_to_bounds (graphics); switch (graphics->backend) { case GraphicsBackEndCairo: /* not a typo - we apply to calculated matrix to cairo context */ return cairo_SetWorldTransform (graphics, graphics->copy_of_ctm); case GraphicsBackEndMetafile: return metafile_TranslateWorldTransform (graphics, dx, dy, order); default: return GenericError; } } /* * Draw operations - validate parameters and delegate to cairo/metafile backends */ GpStatus GdipDrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawArc (graphics, pen, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_DrawArc (graphics, pen, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipDrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawArcI (graphics, pen, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_DrawArcI (graphics, pen, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipDrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawBezier (graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); case GraphicsBackEndMetafile: return metafile_DrawBezier (graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); default: return GenericError; } } GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawBezierI (graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); case GraphicsBackEndMetafile: return metafile_DrawBezierI (graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); default: return GenericError; } } GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { if (count == 0) return Ok; if (!graphics || !pen || !points) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawBeziers (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawBeziers (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { if (count == 0) return Ok; if (!graphics || !pen || !points) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawBeziersI (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawBeziersI (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawEllipse (graphics, pen, x, y, width, height); case GraphicsBackEndMetafile: return metafile_DrawEllipse (graphics, pen, x, y, width, height); default: return GenericError; } } GpStatus GdipDrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawEllipseI (graphics, pen, x, y, width, height); case GraphicsBackEndMetafile: return metafile_DrawEllipseI (graphics, pen, x, y, width, height); default: return GenericError; } } GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawLine (graphics, pen, x1, y1, x2, y2); case GraphicsBackEndMetafile: return metafile_DrawLine (graphics, pen, x1, y1, x2, y2); default: return GenericError; } } GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2) { if (!graphics || !pen) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawLineI (graphics, pen, x1, y1, x2, y2); case GraphicsBackEndMetafile: return metafile_DrawLineI (graphics, pen, x1, y1, x2, y2); default: return GenericError; } } GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { if (!graphics || !pen || !points || count < 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawLines (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawLines (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { if (!graphics || !pen || !points || count < 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawLinesI (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawLinesI (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) { if (!graphics || !pen || !path) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawPath (graphics, pen, path); case GraphicsBackEndMetafile: return metafile_DrawPath (graphics, pen, path); default: return GenericError; } } GpStatus GdipDrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { if (!graphics || !pen) return InvalidParameter; /* We don't do anything, if sweep angle is zero. */ if (sweepAngle == 0) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawPie (graphics, pen, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_DrawPie (graphics, pen, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipDrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) { if (!graphics || !pen) return InvalidParameter; /* We don't do anything, if sweep angle is zero. */ if (sweepAngle == 0) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawPieI (graphics, pen, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_DrawPieI (graphics, pen, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { if (!graphics || !pen || !points || count < 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawPolygon (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawPolygon (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { if (!graphics || !pen || !points || count < 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawPolygonI (graphics, pen, points, count); case GraphicsBackEndMetafile: return metafile_DrawPolygonI (graphics, pen, points, count); default: return GenericError; } } GpStatus GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { if (!graphics || !pen) return InvalidParameter; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((width < 0) || (height < 0)) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawRectangle (graphics, pen, x, y, width, height); case GraphicsBackEndMetafile: return metafile_DrawRectangle (graphics, pen, x, y, width, height); default: return GenericError; } } GpStatus GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) { if (!graphics || !pen) return InvalidParameter; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((width < 0) || (height < 0)) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawRectangle (graphics, pen, x, y, width, height); case GraphicsBackEndMetafile: return metafile_DrawRectangle (graphics, pen, x, y, width, height); default: return GenericError; } } GpStatus GdipDrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) { if (!graphics || !pen || !rects || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawRectangles (graphics, pen, rects, count); case GraphicsBackEndMetafile: return metafile_DrawRectangles (graphics, pen, rects, count); default: return GenericError; } } GpStatus GdipDrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) { if (!graphics || !pen || !rects || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawRectanglesI (graphics, pen, rects, count); case GraphicsBackEndMetafile: return metafile_DrawRectanglesI (graphics, pen, rects, count); default: return GenericError; } } GpStatus GdipDrawClosedCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { return GdipDrawClosedCurve2 (graphics, pen, points, count, 0.5f); } GpStatus GdipDrawClosedCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { return GdipDrawClosedCurve2I (graphics, pen, points, count, 0.5f); } GpStatus GdipDrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension) { /* when tension is 0, draw straight lines */ if (tension == 0) return GdipDrawPolygon (graphics, pen, points, count); if (!graphics || !pen || !points || count <= 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawClosedCurve2 (graphics, pen, points, count, tension); case GraphicsBackEndMetafile: return metafile_DrawClosedCurve2 (graphics, pen, points, count, tension); default: return GenericError; } } GpStatus GdipDrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension) { /* when tension is 0, draw straight lines */ if (tension == 0) return GdipDrawPolygonI (graphics, pen, points, count); if (!graphics || !pen || !points || count <= 2) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawClosedCurve2I (graphics, pen, points, count, tension); case GraphicsBackEndMetafile: return metafile_DrawClosedCurve2I (graphics, pen, points, count, tension); default: return GenericError; } } GpStatus GdipDrawCurve (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { if (count == 2) { return GdipDrawLines (graphics, pen, points, count); } else { int segments = (count > 3) ? (count - 1) : (count - 2); return GdipDrawCurve3 (graphics, pen, points, count, 0, segments, 0.5f); } } GpStatus GdipDrawCurveI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { if (count == 2) { return GdipDrawLinesI (graphics, pen, points, count); } else { int segments = (count > 3) ? (count - 1) : (count - 2); return GdipDrawCurve3I (graphics, pen, points, count, 0, segments, 0.5f); } } GpStatus GdipDrawCurve2 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, float tension) { if (count == 2) { return GdipDrawLines (graphics, pen, points, count); } else { int segments = (count > 3) ? (count - 1) : (count - 2); return GdipDrawCurve3 (graphics, pen, points, count, 0, segments, tension); } } GpStatus GdipDrawCurve2I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, float tension) { if (count == 2) { return GdipDrawLinesI (graphics, pen, points, count); } else { int segments = (count > 3) ? (count - 1) : (count - 2); return GdipDrawCurve3I (graphics, pen, points, count, 0, segments, tension); } } GpStatus GdipDrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension) { /* draw lines if tension = 0 */ if (tension == 0) return GdipDrawLines (graphics, pen, points, count); if (!graphics || !pen || !points || numOfSegments < 1) return InvalidParameter; /* we need 3 points for the first curve, 2 more for each curves */ /* and it's possible to use a point prior to the offset (to calculate) */ if ((offset == 0) && (numOfSegments == 1) && (count < 3)) return InvalidParameter; else if (numOfSegments >= count - offset) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawCurve3 (graphics, pen, points, count, offset, numOfSegments, tension); case GraphicsBackEndMetafile: return metafile_DrawCurve3 (graphics, pen, points, count, offset, numOfSegments, tension); default: return GenericError; } } GpStatus GdipDrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension) { /* draw lines if tension = 0 */ if (tension == 0) return GdipDrawLinesI (graphics, pen, points, count); if (!graphics || !pen || !points || numOfSegments < 1) return InvalidParameter; /* we need 3 points for the first curve, 2 more for each curves */ /* and it's possible to use a point prior to the offset (to calculate) */ if ((offset == 0) && (numOfSegments == 1) && (count < 3)) return InvalidParameter; else if (numOfSegments >= count - offset) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_DrawCurve3I (graphics, pen, points, count, offset, numOfSegments, tension); case GraphicsBackEndMetafile: return metafile_DrawCurve3I (graphics, pen, points, count, offset, numOfSegments, tension); default: return GenericError; } } /* * Fills */ GpStatus GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { if (!graphics || !brush) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillEllipse (graphics, brush, x, y, width, height); case GraphicsBackEndMetafile: return metafile_FillEllipse (graphics, brush, x, y, width, height); default: return GenericError; } } GpStatus GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) { if (!graphics || !brush) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillEllipseI (graphics, brush, x, y, width, height); case GraphicsBackEndMetafile: return metafile_FillEllipseI (graphics, brush, x, y, width, height); default: return GenericError; } } GpStatus GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { if (!graphics || !brush) return InvalidParameter; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((width < 0) || (height < 0)) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillRectangle (graphics, brush, x, y, width, height); case GraphicsBackEndMetafile: return metafile_FillRectangle (graphics, brush, x, y, width, height); default: return GenericError; } } GpStatus GdipFillRectangleI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) { if (!graphics || !brush) return InvalidParameter; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((width < 0) || (height < 0)) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillRectangleI (graphics, brush, x, y, width, height); case GraphicsBackEndMetafile: return metafile_FillRectangleI (graphics, brush, x, y, width, height); default: return GenericError; } } GpStatus GdipFillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) { if (!graphics || !brush || !rects || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillRectangles (graphics, brush, rects, count); case GraphicsBackEndMetafile: return metafile_FillRectangles (graphics, brush, rects, count); default: return GenericError; } } GpStatus GdipFillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) { if (!graphics || !brush || !rects || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillRectanglesI (graphics, brush, rects, count); case GraphicsBackEndMetafile: return metafile_FillRectanglesI (graphics, brush, rects, count); default: return GenericError; } } GpStatus GdipFillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { if (!graphics || !brush) return InvalidParameter; /* We don't do anything, if sweep angle is zero. */ if (sweepAngle == 0) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillPie (graphics, brush, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_FillPie (graphics, brush, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipFillPieI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height, float startAngle, float sweepAngle) { if (!graphics || !brush) return InvalidParameter; /* We don't do anything, if sweep angle is zero. */ if (sweepAngle == 0) return Ok; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillPieI (graphics, brush, x, y, width, height, startAngle, sweepAngle); case GraphicsBackEndMetafile: return metafile_FillPieI (graphics, brush, x, y, width, height, startAngle, sweepAngle); default: return GenericError; } } GpStatus GdipFillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) { if (!graphics || !brush || !path) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillPath (graphics, brush, path); case GraphicsBackEndMetafile: return metafile_FillPath (graphics, brush, path); default: return GenericError; } } GpStatus GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode) { if (!graphics || !brush || !points) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillPolygon (graphics, brush, points, count, fillMode); case GraphicsBackEndMetafile: return metafile_FillPolygon (graphics, brush, points, count, fillMode); default: return GenericError; } } GpStatus GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode) { if (!graphics || !brush || !points) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillPolygonI (graphics, brush, points, count, fillMode); case GraphicsBackEndMetafile: return metafile_FillPolygonI (graphics, brush, points, count, fillMode); default: return GenericError; } } GpStatus GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count) { return GdipFillPolygon (graphics, brush, points, count, FillModeAlternate); } GpStatus GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count) { return GdipFillPolygonI (graphics, brush, points, count, FillModeAlternate); } GpStatus GdipFillClosedCurve (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count) { return GdipFillClosedCurve2 (graphics, brush, points, count, 0.5f); } GpStatus GdipFillClosedCurveI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count) { return GdipFillClosedCurve2I (graphics, brush, points, count, 0.5f); } GpStatus GdipFillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension) { /* when tension is 0, the edges are straight lines */ if (tension == 0) return GdipFillPolygon2 (graphics, brush, points, count); if (!graphics || !brush || !points || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillClosedCurve2 (graphics, brush, points, count, tension); case GraphicsBackEndMetafile: return metafile_FillClosedCurve2 (graphics, brush, points, count, tension); default: return GenericError; } } GpStatus GdipFillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension) { /* when tension is 0, the edges are straight lines */ if (tension == 0) return GdipFillPolygon2I (graphics, brush, points, count); if (!graphics || !brush || !points || count <= 0) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillClosedCurve2I (graphics, brush, points, count, tension); case GraphicsBackEndMetafile: return metafile_FillClosedCurve2I (graphics, brush, points, count, tension); default: return GenericError; } } GpStatus GdipFillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) { if (!graphics || !brush || !region) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_FillRegion (graphics, brush, region); case GraphicsBackEndMetafile: return metafile_FillRegion (graphics, brush, region); default: return GenericError; } } GpStatus GdipSetRenderingOrigin (GpGraphics *graphics, int x, int y) { if (!graphics) return InvalidParameter; graphics->render_origin_x = x; graphics->render_origin_y = y; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: return metafile_SetRenderingOrigin (graphics, x, y); default: return GenericError; } } GpStatus GdipGetRenderingOrigin (GpGraphics *graphics, int *x, int *y) { if (!graphics || !x || !y) return InvalidParameter; *x = graphics->render_origin_x; *y = graphics->render_origin_y; return Ok; } GpStatus GdipGetDpiX (GpGraphics *graphics, float *dpi) { if (!graphics || !dpi) return InvalidParameter; *dpi = graphics->dpi_x; return Ok; } GpStatus GdipGetDpiY (GpGraphics *graphics, float *dpi) { if (!graphics || !dpi) return InvalidParameter; *dpi = graphics->dpi_y; return Ok; } GpStatus GdipGraphicsClear (GpGraphics *graphics, ARGB color) { if (!graphics) return InvalidParameter; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_GraphicsClear (graphics, color); case GraphicsBackEndMetafile: return metafile_GraphicsClear (graphics, color); default: return GenericError; } } GpStatus GdipSetInterpolationMode (GpGraphics *graphics, InterpolationMode interpolationMode) { if (!graphics) return InvalidParameter; graphics->interpolation = interpolationMode; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: return metafile_SetInterpolationMode (graphics, interpolationMode); default: return GenericError; } } GpStatus GdipGetInterpolationMode (GpGraphics *graphics, InterpolationMode *imode) { if (!graphics || !imode) return InvalidParameter; *imode = graphics->interpolation; return Ok; } GpStatus GdipSetTextRenderingHint (GpGraphics *graphics, TextRenderingHint mode) { if (!graphics) return InvalidParameter; graphics->text_mode = mode; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: return metafile_SetTextRenderingHint (graphics, mode); default: return GenericError; } } GpStatus GdipGetTextRenderingHint (GpGraphics *graphics, TextRenderingHint *mode) { if (!graphics || !mode) return InvalidParameter; *mode = graphics->text_mode; return Ok; } /* MonoTODO - pixel offset mode isn't supported */ GpStatus GdipSetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode pixelOffsetMode) { if (!graphics || (pixelOffsetMode == PixelOffsetModeInvalid)) return InvalidParameter; graphics->pixel_mode = pixelOffsetMode; switch (graphics->backend) { case GraphicsBackEndCairo: /* FIXME: changing pixel mode affects other properties (e.g. the visible clip bounds) */ return Ok; case GraphicsBackEndMetafile: return metafile_SetPixelOffsetMode (graphics, pixelOffsetMode); default: return GenericError; } } /* MonoTODO - pixel offset mode isn't supported */ GpStatus GdipGetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode) { if (!graphics || !pixelOffsetMode) return InvalidParameter; *pixelOffsetMode = graphics->pixel_mode; return Ok; } /* MonoTODO - text contrast isn't supported */ GpStatus GdipSetTextContrast (GpGraphics *graphics, UINT contrast) { /** The gamma correction value must be between 0 and 12. * The default value is 4. */ if (!graphics || contrast < 0 || contrast > 12) return InvalidParameter; graphics->text_contrast = contrast; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: return metafile_SetTextContrast (graphics, contrast); default: return GenericError; } } /* MonoTODO - text contrast isn't supported */ GpStatus GdipGetTextContrast (GpGraphics *graphics, UINT *contrast) { if (!graphics || !contrast) return InvalidParameter; *contrast = graphics->text_contrast; return Ok; } GpStatus GdipSetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) { if (!graphics) return InvalidParameter; graphics->draw_mode = mode; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_SetSmoothingMode (graphics, mode); case GraphicsBackEndMetafile: return metafile_SetSmoothingMode (graphics, mode); default: return GenericError; } } GpStatus GdipGetSmoothingMode (GpGraphics *graphics, SmoothingMode *mode) { if (!graphics || !mode) return InvalidParameter; *mode = graphics->draw_mode; return Ok; } /* MonoTODO - dstrect, srcrect and unit support isn't implemented */ GpStatus GdipBeginContainer (GpGraphics *graphics, GDIPCONST GpRectF* dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state) { if (!graphics || !dstrect || !srcrect || (unit < UnitPixel) || (unit > UnitMillimeter)) return InvalidParameter; return GdipBeginContainer2 (graphics, state); } GpStatus GdipBeginContainer2 (GpGraphics *graphics, GraphicsContainer* state) { GpStatus status; if (!graphics || !state) return InvalidParameter; status = GdipSaveGraphics (graphics, state); if (status == Ok) { /* reset most properties to defaults after saving them */ gdip_graphics_reset (graphics); /* copy the current effective matrix as the preivous matrix */ gdip_cairo_matrix_copy (&graphics->previous_matrix, graphics->copy_of_ctm); } return status; } /* MonoTODO - depends on incomplete GdipBeginContainer */ GpStatus GdipBeginContainerI (GpGraphics *graphics, GDIPCONST GpRect* dstrect, GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state) { GpRectF dr, sr; if (!dstrect || !srcrect) return InvalidParameter; dr.X = dstrect->X; dr.Y = dstrect->Y; dr.Width = dstrect->Width; dr.Height = dstrect->Height; sr.X = srcrect->X; sr.Y = srcrect->Y; sr.Width = srcrect->Width; sr.Height = srcrect->Height; return GdipBeginContainer (graphics, &dr, &sr, unit, state); } GpStatus GdipEndContainer (GpGraphics *graphics, GraphicsContainer state) { if (!graphics) return InvalidParameter; return GdipRestoreGraphics (graphics, state); } GpStatus GdipFlush (GpGraphics *graphics, GpFlushIntention intention) { cairo_surface_t* surface; if (!graphics) return InvalidParameter; surface = cairo_get_target (graphics->ct); cairo_surface_flush (surface); #ifdef CAIRO_HAS_QUARTZ_SURFACE if (graphics->type == gtOSXDrawable) { CGRect rect; rect.origin.x = 0; rect.origin.y = 0; rect.size.width = graphics->bounds.Width; rect.size.height = graphics->bounds.Height; void *image = CGBitmapContextCreateImage (cairo_quartz_surface_get_cg_context (surface)); CGContextDrawImage (graphics->cg_context, rect, image); CGImageRelease (image); } #endif return Ok; } GpStatus GdipSetClipGraphics (GpGraphics *graphics, GpGraphics *srcgraphics, CombineMode combineMode) { if (!graphics || !srcgraphics) return InvalidParameter; return GdipSetClipRegion (graphics, srcgraphics->clip, combineMode); } GpStatus GdipSetClipRect (GpGraphics *graphics, float x, float y, float width, float height, CombineMode combineMode) { GpStatus status; GpRectF rect; GpRegion *region = NULL; if (!graphics) return InvalidParameter; rect.X = x; rect.Y = y; rect.Width = width; rect.Height = height; status = GdipCreateRegionRect (&rect, ®ion); if (status != Ok) goto cleanup; /* if the matrix is empty, avoid region transformation */ if (!gdip_is_matrix_empty (graphics->clip_matrix)) { cairo_matrix_t inverted; gdip_cairo_matrix_copy (&inverted, graphics->clip_matrix); cairo_matrix_invert (&inverted); GdipTransformRegion (region, &inverted); } status = GdipCombineRegionRegion (graphics->clip, region, combineMode); if (status != Ok) goto cleanup; switch (graphics->backend) { case GraphicsBackEndCairo: /* adjust cairo clipping according to graphics->clip */ status = cairo_SetGraphicsClip (graphics); break; case GraphicsBackEndMetafile: status = metafile_SetClipRect (graphics, x, y, width, height, combineMode); break; default: status = GenericError; break; } cleanup: if (region) GdipDeleteRegion (region); return status; } GpStatus GdipSetClipRectI (GpGraphics *graphics, int x, int y, int width, int height, CombineMode combineMode) { return GdipSetClipRect (graphics, x, y, width, height, combineMode); } GpStatus GdipSetClipPath (GpGraphics *graphics, GpPath *path, CombineMode combineMode) { GpStatus status; if (!graphics || !path) return InvalidParameter; status = GdipCombineRegionPath (graphics->clip, path, combineMode); if (status != Ok) return status; switch (graphics->backend) { case GraphicsBackEndCairo: /* adjust cairo clipping according to graphics->clip */ return cairo_SetGraphicsClip (graphics); case GraphicsBackEndMetafile: return metafile_SetClipPath (graphics, path, combineMode); default: return GenericError; } } GpStatus GdipSetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode combineMode) { GpStatus status; GpRegion *work; if (!graphics || !region) return InvalidParameter; /* if the matrix is empty, avoid region cloning and transform */ if (gdip_is_matrix_empty (graphics->clip_matrix)) { work = region; } else { cairo_matrix_t inverted; gdip_cairo_matrix_copy (&inverted, graphics->clip_matrix); cairo_matrix_invert (&inverted); GdipCloneRegion (region, &work); GdipTransformRegion (work, &inverted); } status = GdipCombineRegionRegion (graphics->clip, work, combineMode); if (status != Ok) goto cleanup; switch (graphics->backend) { case GraphicsBackEndCairo: /* adjust cairo clipping according to graphics->clip */ status = cairo_SetGraphicsClip (graphics); break; case GraphicsBackEndMetafile: status = metafile_SetClipRegion (graphics, region, combineMode); break; default: status = GenericError; break; } cleanup: if (work != region) GdipDeleteRegion (work); return status; } /* Note: not exposed in System.Drawing.dll */ GpStatus GdipSetClipHrgn (GpGraphics *graphics, void *hRgn, CombineMode combineMode) { GpStatus status; if (!graphics) return InvalidParameter; if (hRgn) { status = GdipSetClipRegion (graphics, (GpRegion*)hRgn, combineMode); } else { /* hRng == NULL means an infinite region */ GpRegion *work; status = GdipCreateRegion (&work); if (status == Ok) { status = GdipSetClipRegion (graphics, work, combineMode); GdipDeleteRegion (work); } } return status; } GpStatus GdipResetClip (GpGraphics *graphics) { if (!graphics) return InvalidParameter; GdipSetInfinite (graphics->clip); cairo_matrix_init_identity (graphics->clip_matrix); switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_ResetClip (graphics); case GraphicsBackEndMetafile: return metafile_ResetClip (graphics); default: return GenericError; } } GpStatus GdipTranslateClip (GpGraphics *graphics, float dx, float dy) { GpStatus status; if (!graphics) return InvalidParameter; status = GdipTranslateRegion (graphics->clip, dx, dy); if (status != Ok) return status; switch (graphics->backend) { case GraphicsBackEndCairo: /* adjust cairo clipping according to graphics->clip */ return cairo_SetGraphicsClip (graphics); case GraphicsBackEndMetafile: return metafile_TranslateClip (graphics, dx, dy); default: return GenericError; } } GpStatus GdipTranslateClipI (GpGraphics *graphics, int dx, int dy) { return GdipTranslateClip (graphics, dx, dy); } GpStatus GdipGetClip (GpGraphics *graphics, GpRegion *region) { if (!graphics || !region) return InvalidParameter; gdip_clear_region (region); gdip_copy_region (graphics->clip, region); if (gdip_is_matrix_empty (graphics->clip_matrix)) return Ok; return GdipTransformRegion (region, graphics->clip_matrix); } GpStatus GdipGetClipBounds (GpGraphics *graphics, GpRectF *rect) { GpStatus status; GpRegion *work; if (!graphics || !rect) return InvalidParameter; /* if the matrix is empty, avoid region cloning and transform */ if (gdip_is_matrix_empty (graphics->clip_matrix)) { work = graphics->clip; } else { GdipCloneRegion (graphics->clip, &work); GdipTransformRegion (work, graphics->clip_matrix); } status = GdipGetRegionBounds (work, graphics, rect); if (work != graphics->clip) GdipDeleteRegion (work); return status; } GpStatus GdipGetClipBoundsI (GpGraphics *graphics, GpRect *rect) { GpRectF rectF; GpStatus status; if (!graphics || !rect) return InvalidParameter; status = GdipGetRegionBounds (graphics->clip, graphics, &rectF); if (status != Ok) return status; rect->X = rectF.X; rect->Y = rectF.Y; rect->Width = rectF.Width; rect->Height = rectF.Height; return Ok; } GpStatus GdipIsClipEmpty (GpGraphics *graphics, BOOL *result) { if (!graphics) return InvalidParameter; return GdipIsEmptyRegion (graphics->clip, graphics, result); } GpStatus GdipSetVisibleClip_linux (GpGraphics *graphics, GpRect *rect) { if (!graphics || !rect) return InvalidParameter; graphics->bounds.X = rect->X; graphics->bounds.Y = rect->Y; graphics->bounds.Width = rect->Width; graphics->bounds.Height = rect->Height; return Ok; } GpStatus GdipGetVisibleClipBounds (GpGraphics *graphics, GpRectF *rect) { if (!graphics || !rect) return InvalidParameter; if (!gdip_is_InfiniteRegion (graphics->clip)) { GpRectF clipbound; GpStatus status = GdipGetClipBounds (graphics, &clipbound); if (status != Ok) return status; /* intersect clipping with bounds (for clips bigger than the graphics) */ rect->X = (clipbound.X > graphics->bounds.X) ? clipbound.X : graphics->bounds.X; rect->Y = (clipbound.Y > graphics->bounds.Y) ? clipbound.Y : graphics->bounds.Y; rect->Width = (((clipbound.X + clipbound.Width) < (graphics->bounds.X + graphics->bounds.Width)) ? (clipbound.X + clipbound.Width) : (graphics->bounds.X + graphics->bounds.Width)) - rect->X; rect->Height = (((clipbound.Y + clipbound.Height) < (graphics->bounds.Y + graphics->bounds.Height)) ? (clipbound.Y + clipbound.Height) : (graphics->bounds.Y + graphics->bounds.Height)) - rect->Y; } else { rect->X = graphics->bounds.X; rect->Y = graphics->bounds.Y; rect->Width = graphics->bounds.Width; rect->Height = graphics->bounds.Height; } return Ok; } GpStatus GdipGetVisibleClipBoundsI (GpGraphics *graphics, GpRect *rect) { GpStatus status; GpRectF rectF; if (!graphics || !rect) return InvalidParameter; status = GdipGetVisibleClipBounds (graphics, &rectF); if (status != Ok) return status; rect->X = rectF.X; rect->Y = rectF.Y; rect->Width = rectF.Width; rect->Height = rectF.Height; return Ok; } GpStatus GdipIsVisibleClipEmpty (GpGraphics *graphics, BOOL *result) { if (!graphics || !result) return InvalidParameter; *result = (graphics->bounds.Width == 0 || graphics->bounds.Height == 0); return Ok; } GpStatus GdipIsVisiblePoint (GpGraphics *graphics, float x, float y, BOOL *result) { GpRectF rectF; if (!graphics || !result) return InvalidParameter; rectF.X = graphics->bounds.X; rectF.Y = graphics->bounds.Y; rectF.Width = graphics->bounds.Width; rectF.Height = graphics->bounds.Height; *result = gdip_is_Point_in_RectF_inclusive (x, y, &rectF); return Ok; } GpStatus GdipIsVisiblePointI (GpGraphics *graphics, int x, int y, BOOL *result) { return GdipIsVisiblePoint (graphics, x, y, result); } GpStatus GdipIsVisibleRect (GpGraphics *graphics, float x, float y, float width, float height, BOOL *result) { BOOL found = FALSE; float posy, posx; GpRectF recthit, boundsF; if (!graphics || !result) return InvalidParameter; if (width ==0 || height ==0) { *result = FALSE; return Ok; } boundsF.X = graphics->bounds.X; boundsF.Y = graphics->bounds.Y; boundsF.Width = graphics->bounds.Width; boundsF.Height = graphics->bounds.Height; recthit.X = x; recthit.Y = y; recthit.Width = width; recthit.Height = height; /* Any point of intersection ?*/ for (posy = 0; posy < recthit.Height+1; posy++) { for (posx = 0; posx < recthit.Width +1; posx++) { if (gdip_is_Point_in_RectF_inclusive (recthit.X + posx , recthit.Y + posy, &boundsF) == TRUE) { found = TRUE; break; } } } *result = found; return Ok; } GpStatus GdipIsVisibleRectI (GpGraphics *graphics, int x, int y, int width, int height, BOOL *result) { return GdipIsVisibleRect (graphics, x, y, width, height, result); } GpStatus GdipSetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) { if (!graphics) return InvalidParameter; graphics->composite_mode = compositingMode; switch (graphics->backend) { case GraphicsBackEndCairo: return cairo_SetCompositingMode (graphics, compositingMode); case GraphicsBackEndMetafile: return metafile_SetCompositingMode (graphics, compositingMode); default: return GenericError; } } GpStatus GdipGetCompositingMode (GpGraphics *graphics, CompositingMode *compositingMode) { if (!graphics || !compositingMode) return InvalidParameter; *compositingMode = graphics->composite_mode; return Ok; } GpStatus GdipSetCompositingQuality (GpGraphics *graphics, CompositingQuality compositingQuality) { if (!graphics) return InvalidParameter; graphics->composite_quality = compositingQuality; switch (graphics->backend) { case GraphicsBackEndCairo: /* In Cairo there is no way of setting this, always use high quality */ return Ok; case GraphicsBackEndMetafile: return metafile_SetCompositingQuality (graphics, compositingQuality); default: return GenericError; } } GpStatus GdipGetCompositingQuality (GpGraphics *graphics, CompositingQuality *compositingQuality) { if (!graphics || !compositingQuality) return InvalidParameter; *compositingQuality = graphics->composite_quality; return Ok; } GpStatus GdipGetNearestColor (GpGraphics *graphics, ARGB *argb) { return Ok; } GpStatus GdipSetPageScale (GpGraphics *graphics, float scale) { if (!graphics) return InvalidParameter; graphics->scale = scale; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: /* page unit and scale are in the same EMF+ record */ return metafile_SetPageTransform (graphics, graphics->page_unit, scale); default: return GenericError; } } GpStatus GdipGetPageScale (GpGraphics *graphics, float *scale) { if (!graphics | !scale) return InvalidParameter; *scale = graphics->scale; return Ok; } GpStatus GdipSetPageUnit (GpGraphics *graphics, GpUnit unit) { if (!graphics) return InvalidParameter; graphics->page_unit = unit; switch (graphics->backend) { case GraphicsBackEndCairo: return Ok; case GraphicsBackEndMetafile: /* page unit and scale are in the same EMF+ record */ return metafile_SetPageTransform (graphics, unit, graphics->scale); default: return GenericError; } } GpStatus GdipGetPageUnit (GpGraphics *graphics, GpUnit *unit) { if (!graphics || !unit) return InvalidParameter; *unit = graphics->page_unit; return Ok; } GpStatus GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPointF *points, int count) { static int called = 0; if (!called) { printf("NOT IMPLEMENTED YET:GdipTransformPoints (GpGraphics *graphics, GpCoordinateSpace destSpace %d, GpCoordinateSpace srcSpace %d, GpPointF *points, int count %d)\n", destSpace, srcSpace, count); } /* return NotImplemented; */ return Ok; } GpStatus GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, int count) { static int called = 0; if (!called) { printf("NOT IMPLEMENTED YET:GdipTransformPointsI (GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, int count)\n"); } /* return NotImplemented; */ return Ok; } libgdiplus-4.2/src/region-private.h0000664000175000017500000000471612377405421014350 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __REGION_PRIVATE_H__ #define __REGION_PRIVATE_H__ #include "gdiplus-private.h" #include "matrix-private.h" #include "region-bitmap.h" #include "region-path-tree.h" /* In the integer world infinity has limited bounds ;-) */ #define REGION_INFINITE_POSITION -4194304 #define REGION_INFINITE_LENGTH 8388608 typedef enum { RegionTypeEmpty = 0, RegionTypeRect = 1, RegionTypeRectF = 2, RegionTypePath = 3 } RegionType; struct _Region { guint32 type; int cnt; GpRectF* rects; GpPathTree* tree; GpRegionBitmap* bitmap; }; BOOL gdip_is_InfiniteRegion (GpRegion *region) GDIP_INTERNAL; BOOL gdip_is_Point_in_RectF_inclusive (float x, float y, GpRectF* rect) GDIP_INTERNAL; void gdip_clear_region (GpRegion *region) GDIP_INTERNAL; void gdip_copy_region (GpRegion *source, GpRegion *dest) GDIP_INTERNAL; #include "region.h" #endif libgdiplus-4.2/src/graphics-path.c0000664000175000017500000014467712402012514014137 00000000000000/* * graphics-path.c * * Copyright (C) 2003-2007, Novell Inc. (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Duncan Mak (duncan@ximian.com) * Ravindra (rkumar@novell.com) * Sebastien Pouliot */ #include "graphics-path-private.h" #include "matrix-private.h" #include "font-private.h" #include "graphics-cairo-private.h" #ifdef USE_PANGO_RENDERING #include "text-pango-private.h" #endif static GArray * array_to_g_array (const GpPointF *pt, int length) { GArray *p = g_array_sized_new (FALSE, TRUE, sizeof (GpPointF), length); g_array_append_vals (p, pt, length); return p; } static GpPointF * g_array_to_array (GArray *p) { int length = p->len; GpPointF *pts = (GpPointF *) GdipAlloc (sizeof (GpPointF) * length); if (!pts) return NULL; memcpy (pts, p->data, p->len * sizeof (GpPointF)); return pts; } static BYTE * g_byte_array_to_array (GByteArray *p) { int length = p->len; BYTE *types = (BYTE*) GdipAlloc (sizeof (BYTE) * length); if (!types) return NULL; memcpy (types, p->data, p->len * sizeof (BYTE)); return types; } static GByteArray * array_to_g_byte_array (const BYTE *types, int count) { GByteArray *p = g_byte_array_sized_new (count); g_byte_array_append (p, types, count); return p; } /* return TRUE if the specified path has (at least one) curves, FALSE otherwise */ BOOL gdip_path_has_curve (GpPath *path) { int i; if (!path) return FALSE; for (i = 0; i < path->count; i++) { if (g_array_index (path->types, BYTE, i) == PathPointTypeBezier) return TRUE; } return FALSE; } /* * Return the correct point type when adding a new shape to the path. */ static PathPointType gdip_get_first_point_type (GpPath *path) { PathPointType type; /* check for a new figure flag or an empty path */ if (path->start_new_fig || (path->count == 0)) return PathPointTypeStart; /* check if the previous point is a closure */ type = g_array_index (path->types, BYTE, path->count - 1); if (type & PathPointTypeCloseSubpath) return PathPointTypeStart; else return PathPointTypeLine; } static void append (GpPath *path, float x, float y, PathPointType type, BOOL compress) { BYTE t = (BYTE) type; GpPointF pt; /* in some case we're allowed to compress identical points */ if (compress && (path->count > 0)) { /* points (X, Y) must be identical */ GpPointF lastPoint = g_array_index (path->points, GpPointF, path->count - 1); if ((lastPoint.X == x) && (lastPoint.Y == y)) { /* types need not be identical but must handle closed subpaths */ PathPointType last_type = g_array_index (path->types, BYTE, path->count - 1); if ((last_type & PathPointTypeCloseSubpath) != PathPointTypeCloseSubpath) return; } } if (path->start_new_fig) t = PathPointTypeStart; /* if we closed a subpath, then start new figure and append */ else if (path->count > 0) { type = g_array_index (path->types, BYTE, path->count - 1); if (type & PathPointTypeCloseSubpath) t = PathPointTypeStart; } pt.X = x; pt.Y = y; g_array_append_val (path->points, pt); g_byte_array_append (path->types, &t, 1); path->count++; path->start_new_fig = FALSE; } static void append_point (GpPath *path, GpPointF pt, PathPointType type, BOOL compress) { append (path, pt.X, pt.Y, type, compress); } static void append_bezier (GpPath *path, float x1, float y1, float x2, float y2, float x3, float y3) { append (path, x1, y1, PathPointTypeBezier3, FALSE); append (path, x2, y2, PathPointTypeBezier3, FALSE); append (path, x3, y3, PathPointTypeBezier3, FALSE); } static void append_curve (GpPath *path, const GpPointF *points, GpPointF *tangents, int offset, int length, _CurveType type) { int i; PathPointType ptype = ((type == CURVE_CLOSE) || (path->count == 0)) ? PathPointTypeStart : PathPointTypeLine; append_point (path, points [offset], ptype, TRUE); for (i = offset; i < offset + length; i++) { int j = i + 1; double x1 = points [i].X + tangents [i].X; double y1 = points [i].Y + tangents [i].Y; double x2 = points [j].X - tangents [j].X; double y2 = points [j].Y - tangents [j].Y; double x3 = points [j].X; double y3 = points [j].Y; append_bezier (path, x1, y1, x2, y2, x3, y3); } if (type == CURVE_CLOSE) { /* complete (close) the curve using the first point */ double x1 = points [i].X + tangents [i].X; double y1 = points [i].Y + tangents [i].Y; double x2 = points [0].X - tangents [0].X; double y2 = points [0].Y - tangents [0].Y; double x3 = points [0].X; double y3 = points [0].Y; append_bezier (path, x1, y1, x2, y2, x3, y3); GdipClosePathFigure (path); } } /* coverity[+alloc : arg-*1] */ GpStatus GdipCreatePath (FillMode fillMode, GpPath **path) { if (!path) return InvalidParameter; *path = (GpPath *) GdipAlloc (sizeof (GpPath)); if (!*path) return OutOfMemory; (*path)->fill_mode = fillMode; (*path)->points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); (*path)->types = g_byte_array_new (); (*path)->count = 0; (*path)->start_new_fig = TRUE; return Ok; } /* coverity[+alloc : arg-*4] */ GpStatus GdipCreatePath2 (const GpPointF *points, const BYTE *types, int count, FillMode fillMode, GpPath **path) { GArray *pts; GByteArray *t; if (!path || !points || !types || (count < 0)) return InvalidParameter; /* FIXME: Check whether path types are valid before adding them. MS does * some checking and does not use the points passed in, if they look * invalid. Some cases are like last type being PathPointTypeStart or * PathPointTypeCloseSubpath etc. */ pts = array_to_g_array (points, count); if (!pts) return OutOfMemory; t = array_to_g_byte_array (types, count); *path = (GpPath *) GdipAlloc (sizeof (GpPath)); if (!*path) return OutOfMemory; (*path)->fill_mode = fillMode; (*path)->count = count; (*path)->points = pts; (*path)->types = t; return Ok; } /* coverity[+alloc : arg-*4] */ GpStatus GdipCreatePath2I (const GpPoint *points, const BYTE *types, int count, FillMode fillMode, GpPath **path) { GpPointF *pt; GpStatus s; if (!points || !types || !path) return InvalidParameter; pt = convert_points (points, count); if (!pt) return OutOfMemory; s = GdipCreatePath2 (pt, types, count, fillMode, path); GdipFree (pt); return s; } /* coverity[+alloc : arg-*1] */ GpStatus GdipClonePath (GpPath *path, GpPath **clonePath) { int i; BYTE type; GpPointF point; if (!path || !clonePath) return InvalidParameter; *clonePath = (GpPath *) GdipAlloc (sizeof (GpPath)); if (!*clonePath) return OutOfMemory; (*clonePath)->fill_mode = path->fill_mode; (*clonePath)->count = path->count; (*clonePath)->points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); (*clonePath)->types = g_byte_array_new (); for (i = 0; i < path->count; i++) { point = g_array_index (path->points, GpPointF, i); type = g_array_index (path->types, BYTE, i); g_array_append_val ((*clonePath)->points, point); g_byte_array_append ((*clonePath)->types, &type, 1); } (*clonePath)->start_new_fig = path->start_new_fig; return Ok; } GpStatus GdipDeletePath (GpPath *path) { if (path == NULL) return InvalidParameter; if (path->points != NULL) g_array_free (path->points, TRUE); path->points = NULL; if (path->types != NULL) g_byte_array_free (path->types, TRUE); path->types = NULL; GdipFree (path); return Ok; } GpStatus GdipResetPath (GpPath *path) { if (path == NULL) return InvalidParameter; if (path->points != NULL) g_array_free (path->points, TRUE); if (path->types != NULL) g_byte_array_free (path->types, TRUE); path->count = 0; path->points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); path->types = g_byte_array_new (); path->fill_mode = FillModeAlternate; path->start_new_fig = TRUE; return Ok; } GpStatus GdipGetPointCount (GpPath *path, int *count) { if (!path || !count) return InvalidParameter; *count = path->count; return Ok; } GpStatus GdipGetPathTypes (GpPath *path, BYTE *types, int count) { int i; if (!path || !types || (count < 1)) return InvalidParameter; if (count > path->count) count = path->count; for (i = 0; i < count; i++) types [i] = path->types->data [i]; return Ok; } GpStatus GdipGetPathPoints (GpPath *path, GpPointF *points, int count) { int i; if (!path || !points || (count < 1)) return InvalidParameter; if (count > path->count) count = path->count; for (i = 0; i < count; i++) { GpPointF point = g_array_index (path->points, GpPointF, i); points [i].X = point.X; points [i].Y = point.Y; } return Ok; } GpStatus GdipGetPathPointsI (GpPath *path, GpPoint *points, int count) { int i; if (!path || !points || (count < 1)) return InvalidParameter; for (i = 0; i < count; i++) { GpPoint point = g_array_index (path->points, GpPoint, i); points [i].X = (int) point.X; points [i].Y = (int) point.Y; } return Ok; } GpStatus GdipGetPathFillMode (GpPath *path, FillMode *fillMode) { if (!path || !fillMode) return InvalidParameter; *fillMode = path->fill_mode; return Ok; } GpStatus GdipSetPathFillMode (GpPath *path, FillMode fillMode) { if (!path) return InvalidParameter; path->fill_mode = fillMode; return Ok; } GpStatus GdipGetPathData (GpPath *path, GpPathData *pathData) { if (!path || !pathData) return InvalidParameter; pathData->Points = g_array_to_array (path->points); if (!pathData->Points) return OutOfMemory; pathData->Types = g_byte_array_to_array (path->types); if (!pathData->Types) { GdipFree (pathData->Points); pathData->Points = NULL; return OutOfMemory; } /* don't return the count unless we have the data */ pathData->Count = path->count; return Ok; } GpStatus GdipStartPathFigure (GpPath *path) { if (!path) return InvalidParameter; path->start_new_fig = TRUE; return Ok; } GpStatus GdipClosePathFigure (GpPath *path) { if (!path) return InvalidParameter; if (path->count > 0) { BYTE *last = &g_array_index (path->types, BYTE, path->count - 1); *last |= PathPointTypeCloseSubpath; } path->start_new_fig = TRUE; return Ok; } GpStatus GdipClosePathFigures (GpPath *path) { int index = 0; BYTE currentType; BYTE lastType; GByteArray *oldTypes; if (!path) return InvalidParameter; /* first point is not closed */ if (path->count <= 1) return Ok; oldTypes = path->types; path->types = g_byte_array_new (); lastType = g_array_index (oldTypes, BYTE, index); index++; for (index = 1; index < path->count; index++) { currentType = g_array_index (oldTypes, BYTE, index); /* we dont close on the first point */ if ((currentType == PathPointTypeStart) && (index > 1)) { lastType |= PathPointTypeCloseSubpath; g_byte_array_append (path->types, &lastType, 1); } else g_byte_array_append (path->types, &lastType, 1); lastType = currentType; } /* close at the end */ lastType |= PathPointTypeCloseSubpath; g_byte_array_append (path->types, &lastType, 1); path->start_new_fig = TRUE; g_byte_array_free (oldTypes, TRUE); return Ok; } GpStatus GdipSetPathMarker (GpPath *path) { BYTE current; if (!path) return InvalidParameter; if (path->count == 0) return Ok; current = g_array_index (path->types, BYTE, path->count - 1); g_byte_array_remove_index (path->types, path->count - 1); current |= PathPointTypePathMarker; g_byte_array_append (path->types, ¤t, 1); return Ok; } GpStatus GdipClearPathMarkers (GpPath *path) { int i; BYTE current; GByteArray *cleared; if (!path) return InvalidParameter; /* shortcut to avoid allocations */ if (path->count == 0) return Ok; cleared = g_byte_array_new (); for (i = 0; i < path->count; i++) { current = g_array_index (path->types, BYTE, i); /* take out the marker if there is one */ if (current & PathPointTypePathMarker) current &= ~PathPointTypePathMarker; g_byte_array_append (cleared, ¤t, 1); } /* replace the existing with the cleared array */ g_byte_array_free (path->types, TRUE); path->types = cleared; return Ok; } /* * Append old_types[start, end] to new_types, adjusting flags. */ static void reverse_subpath_adjust_flags (int start, int end, GByteArray *old_types, GByteArray *new_types, BOOL *prev_had_marker) { BYTE t, prev_first, prev_last; int i; /* Copy all but PathPointTypeStart */ if (end != start) g_byte_array_append (new_types, old_types->data + start + 1, end - start); /* Append PathPointTypeStart */ t = PathPointTypeStart; g_byte_array_append (new_types, &t, 1); g_assert (new_types->len == end + 1); prev_first = g_array_index (old_types, BYTE, start); prev_last = g_array_index (old_types, BYTE, end); /* Remove potential flags from our future start point */ if (end != start) new_types->data[end - 1] &= PathPointTypePathTypeMask; /* Set the flags on our to-be-last point */ if (prev_last & PathPointTypeDashMode) new_types->data[start] |= PathPointTypeDashMode; if (prev_last & PathPointTypeCloseSubpath) new_types->data[start] |= PathPointTypeCloseSubpath; /* * Swap markers */ for (i = start + 1; i < end; i++) { if (g_array_index (old_types, BYTE, i - 1) & PathPointTypePathMarker) new_types->data[i] |= PathPointTypePathMarker; else new_types->data[i] &= ~PathPointTypePathMarker; } /* If the last point of the previous subpath had a marker, we inherit it */ if (*prev_had_marker) new_types->data[start] |= PathPointTypePathMarker; else new_types->data[start] &= ~PathPointTypePathMarker; *prev_had_marker = ((prev_last & PathPointTypePathMarker) == PathPointTypePathMarker); } GpStatus GdipReversePath (GpPath *path) { int length, i; GArray *points; GByteArray *types; int start = 0; BOOL prev_had_marker = FALSE; if (!path) return InvalidParameter; length = path->count; /* shortcut */ if (length <= 1) return Ok; /* PathTypes reversal */ /* First adjust the flags for each subpath */ types = g_byte_array_sized_new (length); if (!types) return OutOfMemory; for (i = 1; i < length; i++) { BYTE t = g_array_index (path->types, BYTE, i); if ((t & PathPointTypePathTypeMask) == PathPointTypeStart) { reverse_subpath_adjust_flags (start, i - 1, path->types, types, &prev_had_marker); start = i; } } if (start < length - 1) reverse_subpath_adjust_flags (start, length - 1, path->types, types, &prev_had_marker); /* Then reverse the resulting array */ for (i = 0; i < (length >> 1); i++) { BYTE *a = &g_array_index (types, BYTE, i); BYTE *b = &g_array_index (types, BYTE, length - i - 1); BYTE temp = *a; *a = *b; *b = temp; } g_byte_array_free (path->types, TRUE); path->types = types; /* PathPoints reversal * note: if length is odd then the middle point doesn't need to switch side */ for (i = 0; i < (length >> 1); i++) { GpPointF *first = &g_array_index (path->points, GpPointF, i); GpPointF *last = &g_array_index (path->points, GpPointF, length - i - 1); GpPointF temp; temp.X = first->X; temp.Y = first->Y; first->X = last->X; first->Y = last->Y; last->X = temp.X; last->Y = temp.Y; } return Ok; } GpStatus GdipGetPathLastPoint (GpPath *path, GpPointF *lastPoint) { if (!path || !lastPoint || (path->count <= 0)) return InvalidParameter; *lastPoint = g_array_index (path->points, GpPointF, path->count - 1); return Ok; } GpStatus GdipAddPathLine (GpPath *path, float x1, float y1, float x2, float y2) { if (!path) return InvalidParameter; /* only the first point can be compressed (i.e. removed if identical to previous) */ append (path, x1, y1, PathPointTypeLine, TRUE); append (path, x2, y2, PathPointTypeLine, FALSE); return Ok; } GpStatus GdipAddPathLine2 (GpPath *path, const GpPointF *points, int count) { int i; GpPointF *tmp; if (!path || !points || (count < 0)) return InvalidParameter; /* only the first point can be compressed (i.e. removed if identical to previous) */ for (i = 0, tmp = (GpPointF*) points; i < count; i++, tmp++) append (path, tmp->X, tmp->Y, PathPointTypeLine, (i == 0)); return Ok; } static void append_arc (GpPath *path, BOOL start, float x, float y, float width, float height, float startAngle, float endAngle) { float delta, bcp; double sin_alpha, sin_beta, cos_alpha, cos_beta; float rx = width / 2; float ry = height / 2; /* center */ float cx = x + rx; float cy = y + ry; /* angles in radians */ float alpha = startAngle * PI / 180; float beta = endAngle * PI / 180; /* adjust angles for ellipses */ alpha = atan2 (rx * sin (alpha), ry * cos (alpha)); beta = atan2 (rx * sin (beta), ry * cos (beta)); if (fabs (beta - alpha) > M_PI){ if (beta > alpha) beta -= 2 * PI; else alpha -= 2 * PI; } delta = beta - alpha; // http://www.stillhq.com/ctpfaq/2001/comp.text.pdf-faq-2001-04.txt (section 2.13) bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta / 2); sin_alpha = sin (alpha); sin_beta = sin (beta); cos_alpha = cos (alpha); cos_beta = cos (beta); /* move to the starting point if we're not continuing a curve */ if (start) { /* starting point */ double sx = cx + rx * cos_alpha; double sy = cy + ry * sin_alpha; append (path, sx, sy, PathPointTypeLine, FALSE); } append_bezier (path, cx + rx * (cos_alpha - bcp * sin_alpha), cy + ry * (sin_alpha + bcp * cos_alpha), cx + rx * (cos_beta + bcp * sin_beta), cy + ry * (sin_beta - bcp * cos_beta), cx + rx * cos_beta, cy + ry * sin_beta); } static void append_arcs (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle) { int i; float drawn = 0; int increment; float endAngle; BOOL enough = FALSE; if (fabs (sweepAngle) >= 360) { GdipAddPathEllipse (path, x, y, width, height); return; } endAngle = startAngle + sweepAngle; increment = (endAngle < startAngle) ? -90 : 90; /* i is the number of sub-arcs drawn, each sub-arc can be at most 90 degrees.*/ /* there can be no more then 4 subarcs, ie. 90 + 90 + 90 + (something less than 90) */ for (i = 0; i < 4; i++) { float current = startAngle + drawn; float additional; if (enough) return; additional = endAngle - current; /* otherwise, add the remainder */ if (fabs (additional) > 90) { additional = increment; } else { /* a near zero value will introduce bad artefact in the drawing (#78999) */ if (gdip_near_zero (additional)) return; enough = TRUE; } append_arc (path, (i == 0), /* only move to the starting pt in the 1st iteration */ x, y, width, height, /* bounding rectangle */ current, current + additional); drawn += additional; } } GpStatus GdipAddPathArc (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle) { if (!path) return InvalidParameter; /* draw the arcs */ append_arcs (path, x, y, width, height, startAngle, sweepAngle); return Ok; } GpStatus GdipAddPathBezier (GpPath *path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { if (!path) return InvalidParameter; append (path, x1, y1, PathPointTypeLine, TRUE); append_bezier (path, x2, y2, x3, y3, x4, y4); return Ok; } GpStatus GdipAddPathBeziers (GpPath *path, const GpPointF *points, int count) { int i; GpPointF *tmp = (GpPointF *) points; if (!path || !points) return InvalidParameter; /* first bezier requires 4 points, other 3 more points */ if ((count < 4) || ((count % 3) != 1)) return InvalidParameter; append_point (path, *tmp, PathPointTypeLine, TRUE); tmp++; for (i = 1; i < count; i++, tmp++) append_point (path, *tmp, PathPointTypeBezier3, FALSE); return Ok; } GpStatus GdipAddPathCurve (GpPath *path, const GpPointF *points, int count) { return GdipAddPathCurve2 (path, points, count, 0.5); } GpStatus GdipAddPathCurve2 (GpPath *path, const GpPointF *points, int count, float tension) { GpPointF *tangents; /* special case, here we support a curve with 2 points */ if (!path || !points || (count < 2)) return InvalidParameter; tangents = gdip_open_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; append_curve (path, points, tangents, 0, count - 1, CURVE_OPEN); GdipFree (tangents); return Ok; } GpStatus GdipAddPathCurve3 (GpPath *path, const GpPointF *points, int count, int offset, int numberOfSegments, float tension) { GpPointF *tangents; if (!path || !points || (numberOfSegments < 1)) return InvalidParameter; /* we need 3 points for the first curve, 2 more for each curves */ /* and it's possible to use a point prior to the offset (to calculate) */ if ((offset == 0) && (numberOfSegments == 1) && (count < 3)) return InvalidParameter; else if (numberOfSegments >= count - offset) return InvalidParameter; tangents = gdip_open_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; append_curve (path, points, tangents, offset, numberOfSegments, CURVE_OPEN); GdipFree (tangents); return Ok; } GpStatus GdipAddPathClosedCurve (GpPath *path, const GpPointF *points, int count) { return GdipAddPathClosedCurve2 (path, points, count, 0.5); } GpStatus GdipAddPathClosedCurve2 (GpPath *path, const GpPointF *points, int count, float tension) { GpPointF *tangents; if (!path || !points || (count < 3)) return InvalidParameter; tangents = gdip_closed_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; append_curve (path, points, tangents, 0, count - 1, CURVE_CLOSE); /* close the path */ GdipClosePathFigure (path); GdipFree (tangents); return Ok; } GpStatus GdipAddPathRectangle (GpPath *path, float x, float y, float width, float height) { if (!path) return InvalidParameter; if ((width == 0.0) || (height == 0.0)) return Ok; append (path, x, y, PathPointTypeStart, FALSE); append (path, x + width, y, PathPointTypeLine, FALSE); append (path, x + width, y + height, PathPointTypeLine, FALSE); append (path, x, y + height, PathPointTypeLine | PathPointTypeCloseSubpath, FALSE); return Ok; } GpStatus GdipAddPathRectangles (GpPath *path, const GpRectF *rects, int count) { int i; if (!path || !rects) return InvalidParameter; for (i = 0; i < count; i++) { float x = rects[i].X; float y = rects[i].Y; float width = rects[i].Width; float height = rects[i].Height; GdipAddPathRectangle (path, x, y, width, height); } return Ok; } GpStatus GdipAddPathEllipse (GpPath *path, float x, float y, float width, float height) { double rx = width / 2; double ry = height / 2; double cx = x + rx; double cy = y + ry; if (!path) return InvalidParameter; /* origin */ append (path, cx + rx, cy, PathPointTypeStart, FALSE); /* quadrant I */ append_bezier (path, cx + rx, cy - C1 * ry, cx + C1 * rx, cy - ry, cx, cy - ry); /* quadrant II */ append_bezier (path, cx - C1 * rx, cy - ry, cx - rx, cy - C1 * ry, cx - rx, cy); /* quadrant III */ append_bezier (path, cx - rx, cy + C1 * ry, cx - C1 * rx, cy + ry, cx, cy + ry); /* quadrant IV */ append_bezier (path, cx + C1 * rx, cy + ry, cx + rx, cy + C1 * ry, cx + rx, cy); /* close the path */ GdipClosePathFigure (path); return Ok; } GpStatus GdipAddPathPie (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle) { float sin_alpha, cos_alpha; float rx = width / 2; float ry = height / 2; /* center */ int cx = x + rx; int cy = y + ry; /* angles in radians */ float alpha = startAngle * PI / 180; /* adjust angle for ellipses */ alpha = atan2 (rx * sin (alpha), ry * cos (alpha)); sin_alpha = sin (alpha); cos_alpha = cos (alpha); if (!path) return InvalidParameter; /* move to center */ append (path, cx, cy, PathPointTypeStart, FALSE); /* draw pie edge */ if (fabs (sweepAngle) < 360) append (path, cx + rx * cos_alpha, cy + ry * sin_alpha, PathPointTypeLine, FALSE); /* draw the arcs */ append_arcs (path, x, y, width, height, startAngle, sweepAngle); /* draw pie edge */ if (fabs (sweepAngle) < 360) append (path, cx, cy, PathPointTypeLine, FALSE); /* close the path */ return GdipClosePathFigure (path); } GpStatus GdipAddPathPolygon (GpPath *path, const GpPointF *points, int count) { int i; GpPointF *tmp = (GpPointF *) points; if (!path || !points || (count < 3)) return InvalidParameter; /* note: polygon points are never compressed (i.e. removed if identical) */ append_point (path, *tmp, PathPointTypeStart, FALSE); tmp ++; for (i = 1; i < count; i++, tmp++) append_point (path, *tmp, PathPointTypeLine, FALSE); /* * Add a line from the last point back to the first point if * they're not the same */ if (points [0].X != points [count - 1].X && points [0].Y != points [count - 1].Y) append_point (path, points [0], PathPointTypeLine, FALSE); /* close the path */ return GdipClosePathFigure (path); } GpStatus GdipAddPathPath (GpPath *path, GDIPCONST GpPath *addingPath, BOOL connect) { int i, length; PathPointType first; GpPointF *pts; BYTE *types; if (!path || !addingPath) return InvalidParameter; length = addingPath->count; if (length < 1) return Ok; pts = gdip_calloc (sizeof (GpPointF), length); if (!pts) return OutOfMemory; types = gdip_calloc (sizeof (BYTE), length); if (!types) { GdipFree (pts); return OutOfMemory; } GdipGetPathPoints ((GpPath*)addingPath, pts, length); GdipGetPathTypes ((GpPath*)addingPath, types, length); /* We can connect only open figures. If first figure is closed * it can't be connected. */ first = connect ? gdip_get_first_point_type (path) : PathPointTypeStart; append_point (path, pts [0], first, FALSE); for (i = 1; i < length; i++) append_point (path, pts [i], types [i], FALSE); GdipFree(pts); GdipFree(types); return Ok; } /* MonoTODO - deal with layoutRect, format... */ GpStatus GdipAddPathString (GpPath *path, GDIPCONST WCHAR *string, int length, GDIPCONST GpFontFamily *family, int style, float emSize, GDIPCONST GpRectF *layoutRect, GDIPCONST GpStringFormat *format) { cairo_surface_t *cs; cairo_t *cr; cairo_path_t *cp; cairo_text_extents_t extents; cairo_matrix_t matrix; GpFont *font = NULL; GpStatus status; BYTE *utf8 = NULL; if (length == 0) return Ok; if (length < 0) return InvalidParameter; cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1); if (cairo_surface_status (cs) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (cs); return OutOfMemory; } cr = cairo_create (cs); if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { cairo_destroy (cr); cairo_surface_destroy (cs); return OutOfMemory; } utf8 = (BYTE*) ucs2_to_utf8 ((const gunichar2 *)string, -1); if (!utf8) { cairo_destroy (cr); cairo_surface_destroy (cs); return OutOfMemory; } status = GdipCreateFont (family, emSize, style, UnitPixel, &font); if (status != Ok) { if (font) GdipDeleteFont (font); GdipFree (utf8); cairo_destroy (cr); cairo_surface_destroy (cs); return status; } if (layoutRect) cairo_move_to (cr, layoutRect->X, layoutRect->Y + font->sizeInPixels); #ifdef USE_PANGO_RENDERING { GpRectF box; PangoLayout* layout; cairo_save (cr); layout = gdip_pango_setup_layout (cr, string, length, font, layoutRect, &box, format); pango_cairo_layout_path (cr, layout); g_object_unref (layout); cairo_restore (cr); } #else cairo_set_font_face (cr, gdip_get_cairo_font_face (font)); cairo_set_font_size (cr, font->sizeInPixels); /* TODO - deal with layoutRect, format... ideally we would be calling a subset of GdipDrawString that already does everything *and* preserve the whole path */ cairo_text_path (cr, (const char*)utf8); #endif /* get the font data from the cairo path and translate it as a gdi+ path */ cp = cairo_copy_path (cr); if (cp) { int i; for (i=0; i < cp->num_data; i += cp->data[i].header.length) { PathPointType type = PathPointTypeStart; cairo_path_data_t *data = &cp->data[i]; if ((i < cp->num_data - 1) && (data->header.type == CAIRO_PATH_CLOSE_PATH)) type |= PathPointTypeCloseSubpath; switch (data->header.type) { case CAIRO_PATH_MOVE_TO: append (path, data[1].point.x, data[1].point.y, type, FALSE); break; case CAIRO_PATH_LINE_TO: append (path, data[1].point.x, data[1].point.y, type | PathPointTypeLine, FALSE); break; case CAIRO_PATH_CURVE_TO: append (path, data[1].point.x, data[1].point.y, PathPointTypeBezier, FALSE); append (path, data[2].point.x, data[2].point.y, PathPointTypeBezier, FALSE); append (path, data[3].point.x, data[3].point.y, type | PathPointTypeBezier, FALSE); break; case CAIRO_PATH_CLOSE_PATH: break; } } cairo_path_destroy (cp); } if (font) { GdipDeleteFont (font); } GdipFree (utf8); cairo_destroy (cr); cairo_surface_destroy (cs); return Ok; } /* MonoTODO - same limitations as GdipAddString */ GpStatus GdipAddPathStringI (GpPath *path, GDIPCONST WCHAR *string, int length, GDIPCONST GpFontFamily *family, int style, float emSize, GDIPCONST GpRect *layoutRect, GDIPCONST GpStringFormat *format) { GpRectF *r = NULL; GpRectF rect; if (layoutRect) { rect.X = layoutRect->X; rect.Y = layoutRect->Y; rect.Width = layoutRect->Width; rect.Height = layoutRect->Height; r = ▭ } return GdipAddPathString (path, string, length, family, style, emSize, r, format); } GpStatus GdipAddPathLineI (GpPath *path, int x1, int y1, int x2, int y2) { return GdipAddPathLine (path, x1, y1, x2, y2); } GpStatus GdipAddPathLine2I (GpPath* path, const GpPoint *points, int count) { GpPoint *tmp; int i; if (!path || !points || (count < 0)) return InvalidParameter; /* only the first point can be compressed (i.e. removed if identical to previous) */ for (i = 0, tmp = (GpPoint*) points; i < count; i++, tmp++) append (path, tmp->X, tmp->Y, PathPointTypeLine, (i == 0)); return Ok; } GpStatus GdipAddPathArcI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle) { return GdipAddPathArc (path, x, y, width, height, startAngle, sweepAngle); } GpStatus GdipAddPathBezierI (GpPath *path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { return GdipAddPathBezier (path, x1, y1, x2, y2, x3, y3, x4, y4); } GpStatus GdipAddPathBeziersI (GpPath *path, const GpPoint *points, int count) { GpPoint *tmp; int i; if (!path || !points) return InvalidParameter; /* first bezier requires 4 points, other 3 more points */ if ((count < 4) || ((count % 3) != 1)) return InvalidParameter; tmp = (GpPoint*) points; append (path, tmp->X, tmp->Y, PathPointTypeLine, TRUE); tmp++; for (i = 1; i < count; i++, tmp++) append (path, tmp->X, tmp->Y, PathPointTypeBezier3, FALSE); return Ok; } GpStatus GdipAddPathCurveI (GpPath *path, const GpPoint *points, int count) { return GdipAddPathCurve2I (path, points, count, 0.5); } GpStatus GdipAddPathCurve2I (GpPath *path, const GpPoint *points, int count, float tension) { GpPointF *pt; GpStatus s; if (!points) return InvalidParameter; pt = convert_points (points, count); if (!pt) return OutOfMemory; /* here we must deal/accept curve with 2 points, GdipAddPathCurve3I doesn't */ s = GdipAddPathCurve2 (path, pt, count, tension); GdipFree (pt); return s; } GpStatus GdipAddPathCurve3I (GpPath *path, const GpPoint *points, int count, int offset, int numberOfSegments, float tension) { GpPointF *pt; GpStatus s; if (!points) return InvalidParameter; pt = convert_points (points, count); if (!pt) return OutOfMemory; s = GdipAddPathCurve3 (path, pt, count, offset, numberOfSegments, tension); GdipFree (pt); return s; } GpStatus GdipAddPathClosedCurveI (GpPath *path, const GpPoint *points, int count) { return GdipAddPathClosedCurve2I (path, points, count, 0.5); } GpStatus GdipAddPathClosedCurve2I (GpPath *path, const GpPoint *points, int count, float tension) { GpPointF *pt; GpStatus s; if (!path || !points) return InvalidParameter; pt = convert_points (points, count); if (!pt) return OutOfMemory; s = GdipAddPathClosedCurve2 (path, pt, count, tension); GdipFree (pt); return s; } GpStatus GdipAddPathRectangleI (GpPath *path, int x, int y, int width, int height) { return GdipAddPathRectangle (path, x, y, width, height); } GpStatus GdipAddPathRectanglesI (GpPath *path, const GpRect *rects, int count) { int i; if (!path || !rects) return InvalidParameter; for (i = 0; i < count; i++) { float x = (float) rects[i].X; float y = (float) rects[i].Y; float width = (float) rects[i].Width; float height = (float) rects[i].Height; GdipAddPathRectangle (path, x, y, width, height); } return Ok; } GpStatus GdipAddPathEllipseI (GpPath *path, int x, int y, int width, int height) { return GdipAddPathEllipse (path, x, y, width, height); } GpStatus GdipAddPathPieI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle) { return GdipAddPathPie (path, x, y, width, height, startAngle, sweepAngle); } GpStatus GdipAddPathPolygonI (GpPath *path, const GpPoint *points, int count) { int i; GpPoint *tmp; if (!path || !points || (count < 3)) return InvalidParameter; /* note: polygon points are never compressed (i.e. removed if identical) */ tmp = (GpPoint *) points; append (path, tmp->X, tmp->Y, PathPointTypeStart, FALSE); tmp++; for (i = 1; i < count; i++, tmp++) append (path, tmp->X, tmp->Y, PathPointTypeLine, FALSE); /* * Add a line from the last point back to the first point if * they're not the same */ if (points [0].X != points [count - 1].X && points [0].Y != points [count - 1].Y) append (path, points [0].X, points [0].Y, PathPointTypeLine, FALSE); /* close the path */ return GdipClosePathFigure (path); } /* nr_curve_flatten comes from Sodipodi's libnr (public domain) available from http://www.sodipodi.com/ */ /* Mono changes: converted to float (from double), added recursion limit, use GArray */ static BOOL nr_curve_flatten (float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float flatness, int level, GArray *points) { float dx1_0, dy1_0, dx2_0, dy2_0, dx3_0, dy3_0, dx2_3, dy2_3, d3_0_2; float s1_q, t1_q, s2_q, t2_q, v2_q; float f2, f2_q; float x00t, y00t, x0tt, y0tt, xttt, yttt, x1tt, y1tt, x11t, y11t; dx1_0 = x1 - x0; dy1_0 = y1 - y0; dx2_0 = x2 - x0; dy2_0 = y2 - y0; dx3_0 = x3 - x0; dy3_0 = y3 - y0; dx2_3 = x3 - x2; dy2_3 = y3 - y2; f2 = flatness; d3_0_2 = dx3_0 * dx3_0 + dy3_0 * dy3_0; if (d3_0_2 < f2) { float d1_0_2, d2_0_2; d1_0_2 = dx1_0 * dx1_0 + dy1_0 * dy1_0; d2_0_2 = dx2_0 * dx2_0 + dy2_0 * dy2_0; if ((d1_0_2 < f2) && (d2_0_2 < f2)) { goto nosubdivide; } else { goto subdivide; } } f2_q = f2 * d3_0_2; s1_q = dx1_0 * dx3_0 + dy1_0 * dy3_0; t1_q = dy1_0 * dx3_0 - dx1_0 * dy3_0; s2_q = dx2_0 * dx3_0 + dy2_0 * dy3_0; t2_q = dy2_0 * dx3_0 - dx2_0 * dy3_0; v2_q = dx2_3 * dx3_0 + dy2_3 * dy3_0; if ((t1_q * t1_q) > f2_q) goto subdivide; if ((t2_q * t2_q) > f2_q) goto subdivide; if ((s1_q < 0.0) && ((s1_q * s1_q) > f2_q)) goto subdivide; if ((v2_q < 0.0) && ((v2_q * v2_q) > f2_q)) goto subdivide; if (s1_q >= s2_q) goto subdivide; nosubdivide: { GpPointF pt; pt.X = x3; pt.Y = y3; g_array_append_val (points, pt); return TRUE; } subdivide: /* things gets *VERY* memory intensive without a limit */ if (level >= FLATTEN_RECURSION_LIMIT) return FALSE; x00t = (x0 + x1) * 0.5; y00t = (y0 + y1) * 0.5; x0tt = (x0 + 2 * x1 + x2) * 0.25; y0tt = (y0 + 2 * y1 + y2) * 0.25; x1tt = (x1 + 2 * x2 + x3) * 0.25; y1tt = (y1 + 2 * y2 + y3) * 0.25; x11t = (x2 + x3) * 0.5; y11t = (y2 + y3) * 0.5; xttt = (x0tt + x1tt) * 0.5; yttt = (y0tt + y1tt) * 0.5; if (!nr_curve_flatten (x0, y0, x00t, y00t, x0tt, y0tt, xttt, yttt, flatness, level+1, points)) return FALSE; if (!nr_curve_flatten (xttt, yttt, x1tt, y1tt, x11t, y11t, x3, y3, flatness, level+1, points)) return FALSE; return TRUE; } static BOOL gdip_convert_bezier_to_lines (GpPath *path, int index, float flatness, GArray *flat_points, GByteArray *flat_types) { GArray *points; GpPointF start, first, second, end; GpPointF pt; BYTE type; int i; if ((index <= 0) || (index + 2 >= path->count)) return FALSE; /* bad path data */ start = g_array_index (path->points, GpPointF, index - 1); first = g_array_index (path->points, GpPointF, index); second = g_array_index (path->points, GpPointF, index + 1); end = g_array_index (path->points, GpPointF, index + 2); /* we can't add points directly to the original list as we could end up with too much recursion */ points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); if (!nr_curve_flatten (start.X, start.Y, first.X, first.Y, second.X, second.Y, end.X, end.Y, flatness, 0, points)) { /* curved path is too complex (i.e. would result in too many points) to render as a polygon */ g_array_free (points, TRUE); return FALSE; } /* recursion was within limits, append the result to the original supplied list */ if (points->len > 0) { g_array_append_val (flat_points, g_array_index (points, GpPointF, 0)); type = PathPointTypeLine; g_byte_array_append (flat_types, &type, 1); } /* always PathPointTypeLine */ type = PathPointTypeLine; for (i = 1; i < points->len; i++) { pt = g_array_index (points, GpPointF, i); g_array_append_val (flat_points, pt); g_byte_array_append (flat_types, &type, 1); } g_array_free (points, TRUE); return TRUE; } GpStatus GdipFlattenPath (GpPath *path, GpMatrix *matrix, float flatness) { GpStatus status = Ok; GArray *points; GByteArray *types; int i; if (!path) return InvalidParameter; /* apply matrix before flattening (as there's less points at this stage) */ if (matrix) { status = GdipTransformPath (path, matrix); if (status != Ok) return status; } /* if no bezier are present then the path doesn't need to be flattened */ if (!gdip_path_has_curve (path)) return status; points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); types = g_byte_array_new (); /* Iterate the current path and replace each bezier with multiple lines */ for (i = 0; i < path->count; i++) { GpPointF point = g_array_index (path->points, GpPointF, i); BYTE type = g_array_index (path->types, BYTE, i); /* PathPointTypeBezier3 has the same value as PathPointTypeBezier */ if ((type & PathPointTypeBezier) == PathPointTypeBezier) { if (!gdip_convert_bezier_to_lines (path, i, fabs (flatness), points, types)) { /* uho, too much recursion - do not pass go, do not collect 200$ */ GpPointF pt; /* free the the partial flat */ g_array_free (points, TRUE); g_byte_array_free (types, TRUE); /* mimic MS behaviour when recursion becomes a problem */ /* note: it's not really an empty rectangle as the last point isn't closing */ points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); types = g_byte_array_new (); pt.X = pt.Y = 0; type = PathPointTypeStart; g_array_append_val (points, pt); g_byte_array_append (types, &type, 1); type = PathPointTypeLine; g_array_append_val (points, pt); g_byte_array_append (types, &type, 1); g_array_append_val (points, pt); g_byte_array_append (types, &type, 1); g_array_append_val (points, pt); g_byte_array_append (types, &type, 1); break; } /* beziers have 4 points: the previous one, the current and the next two */ i += 2; } else { /* no change required, just copy the point */ g_array_append_val (points, point); g_byte_array_append (types, &type, 1); } } /* free original path points and types */ if (path->points != NULL) g_array_free (path->points, TRUE); if (path->types != NULL) g_byte_array_free (path->types, TRUE); /* transfer new path informations */ path->points = points; path->types = types; path->count = points->len; /* note: no error code is given for excessive recursion */ return Ok; } static GpStatus gdip_prepare_path (GpPath *path, GpMatrix *matrix, float flatness) { /* convert any curve into lines */ if (gdip_path_has_curve (path)) { /* this will apply the matrix too (before flattening) */ return GdipFlattenPath (path, matrix, flatness); } else if (!gdip_is_matrix_empty (matrix)) { /* no curve, but we still have a matrix to apply... */ return GdipTransformPath (path, matrix); } /* no preparation required */ return Ok; } /* MonoTODO - doesn't seems to be exposed in System.Drawing.dll */ GpStatus GdipWindingModeOutline (GpPath *path, GpMatrix *matrix, float flatness) { GpStatus status; if (!path) return InvalidParameter; /* quick out */ if (path->count == 0) return Ok; status = gdip_prepare_path (path, matrix, flatness); if (status != Ok) return status; /* TODO */ return NotImplemented; } /* MonoTODO */ GpStatus GdipWidenPath (GpPath *nativePath, GpPen *pen, GpMatrix *matrix, float flatness) { static int called = 0; GpStatus status; if (!nativePath || !pen) return InvalidParameter; /* (0) is deal within System.Drawing */ /* (1) for compatibility with MS GDI+ (reported as FDBK49685) */ if (nativePath->count <= 1) return OutOfMemory; status = gdip_prepare_path (nativePath, matrix, flatness); if (status != Ok) return status; /* TODO inner path (same number of points as the prepared path) */ /* TODO outer path (twice the number of points as the prepared path) */ if (!called) { g_warning ("NOT IMPLEMENTED: GdipWidenPath"); called = 1; } return Ok; } /* MonoTODO */ GpStatus GdipWarpPath (GpPath *path, GpMatrix *matrix, const GpPointF *points, int count, float srcx, float srcy, float srcwidth, float srcheight, WarpMode warpMode, float flatness) { static int called = 0; GpStatus status; if (!path || !points || (count < 1)) return InvalidParameter; /* quick out */ if (path->count == 0) return Ok; /* an invalid warp mode resets the current path */ /* a path with a single point will reset it too */ if (((warpMode != WarpModePerspective) && (warpMode != WarpModeBilinear)) || (path->count == 1)) return GdipResetPath (path); status = gdip_prepare_path (path, matrix, flatness); if (status != Ok) return status; /* TODO */ if (!called) { g_warning ("NOT IMPLEMENTED: GdipWarpPath"); called = 1; } return Ok; } GpStatus GdipTransformPath (GpPath* path, GpMatrix *matrix) { PointF *points; int count; GpStatus s; if (!path) return InvalidParameter; count = path->count; if (count == 0) return Ok; /* GdipTransformMatrixPoints would fail */ /* avoid allocation/free/calculation for null/identity matrix */ if (gdip_is_matrix_empty (matrix)) return Ok; points = g_array_to_array (path->points); if (!points) return OutOfMemory; s = GdipTransformMatrixPoints (matrix, points, count); path->points = array_to_g_array (points, count); GdipFree (points); if (!path->points) return OutOfMemory; return s; } GpStatus GdipGetPathWorldBounds (GpPath *path, GpRectF *bounds, const GpMatrix *matrix, const GpPen *pen) { GpStatus status; GpPath *workpath = NULL; if (!path || !bounds) return InvalidParameter; if (path->count < 1) { /* special case #1 - Empty */ bounds->X = 0.0f; bounds->Y = 0.0f; bounds->Width = 0.0f; bounds->Height = 0.0f; return Ok; } status = GdipClonePath (path, &workpath); if (status != Ok) { if (workpath) GdipDeletePath (workpath); return status; } /* We don't need a very precise flat value to get the bounds (GDI+ isn't, big time) - * however flattening helps by removing curves, making the rest of the algorithm a * lot simpler. */ /* note: only the matrix is applied if no curves are present in the path */ status = GdipFlattenPath (workpath, (GpMatrix*)matrix, 25.0f); if (status == Ok) { int i; GpPointF points; points = g_array_index (workpath->points, GpPointF, 0); bounds->X = points.X; /* keep minimum X here */ bounds->Y = points.Y; /* keep minimum Y here */ if (workpath->count == 1) { /* special case #2 - Only one element */ bounds->Width = 0.0f; bounds->Height = 0.0f; GdipDeletePath (workpath); return Ok; } bounds->Width = points.X; /* keep maximum X here */ bounds->Height = points.Y; /* keep maximum Y here */ for (i = 1; i < workpath->count; i++) { points = g_array_index (workpath->points, GpPointF, i); if (points.X < bounds->X) bounds->X = points.X; if (points.Y < bounds->Y) bounds->Y = points.Y; if (points.X > bounds->Width) bounds->Width = points.X; if (points.Y > bounds->Height) bounds->Height = points.Y; } /* convert maximum values (width/height) as length */ bounds->Width -= bounds->X; bounds->Height -= bounds->Y; if (pen) { /* in calculation the pen's width is at least 1.0 */ float width = (pen->width < 1.0f) ? 1.0f : pen->width; float halfw = (width / 2); bounds->X -= halfw; bounds->Y -= halfw; bounds->Width += width; bounds->Height += width; } } GdipDeletePath (workpath); return status; } GpStatus GdipGetPathWorldBoundsI (GpPath *path, GpRect *bounds, const GpMatrix *matrix, const GpPen *pen) { GpRectF rect; GpStatus status; if (!path || !bounds) return InvalidParameter; status = GdipGetPathWorldBounds (path, &rect, matrix, pen); if (status != Ok) return status; bounds->X = (int) rect.X; bounds->Y = (int) rect.Y; bounds->Width = (int) rect.Width; bounds->Height = (int) rect.Height; return Ok; } GpStatus GdipIsVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, BOOL *result) { GpStatus status = Ok; cairo_surface_t* s = NULL; GpGraphics *g; GpUnit page_unit = UnitPixel; if (!path || !result) return InvalidParameter; if (graphics) { g = graphics; cairo_save (g->ct); page_unit = g->page_unit; } else { /* create a temporary context */ s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1); g = gdip_graphics_new (s); } cairo_new_path (g->ct); /* unit tests shows that PageUnit isn't consireded (well x, y are probably considered to be the same unit format ) */ g->page_unit = UnitPixel; status = gdip_plot_path (g, path, FALSE); if (status == Ok) { cairo_set_fill_rule (g->ct, gdip_convert_fill_mode (path->fill_mode)); cairo_set_antialias (g->ct, CAIRO_ANTIALIAS_NONE); *result = cairo_in_fill (g->ct, x + 1.0 /* CAIRO_AA_OFFSET_X */, y + CAIRO_AA_OFFSET_Y); } else { *result = FALSE; } if (graphics) { /* restore GpGraphics to original state */ cairo_restore (graphics->ct); g->page_unit = page_unit; } else { /* delete temporary context */ cairo_surface_destroy (s); GdipDeleteGraphics (g); } return status; } GpStatus GdipIsVisiblePathPointI (GpPath *path, int x, int y, GpGraphics *graphics, BOOL *result) { return GdipIsVisiblePathPoint (path, x, y, graphics, result); } GpStatus GdipIsOutlineVisiblePathPoint (GpPath *path, float x, float y, GpPen *pen, GpGraphics *graphics, BOOL *result) { GpStatus status = Ok; cairo_surface_t* s = NULL; GpGraphics *g; GpUnit page_unit = UnitPixel; if (!path || !pen || !result) return InvalidParameter; if (graphics) { g = graphics; cairo_save (graphics->ct); page_unit = g->page_unit; } else { /* create a temporary context */ s = cairo_image_surface_create (CAIRO_FORMAT_A1, 1, 1); g = gdip_graphics_new (s); } cairo_new_path (g->ct); /* unit tests shows that PageUnit isn't consireded (well x, y are probably considered to be the same unit format ) */ g->page_unit = UnitPixel; status = gdip_plot_path (g, path, FALSE); if (status == Ok) { /* we must fight around cairo AA */ cairo_set_antialias (g->ct, CAIRO_ANTIALIAS_NONE); cairo_set_line_width (g->ct, pen->width - CAIRO_AA_OFFSET_Y); *result = cairo_in_stroke (g->ct, x, y); } else { *result = FALSE; } if (graphics) { /* restore GpGraphics to original state */ cairo_restore (graphics->ct); g->page_unit = page_unit; } else { /* delete temporary context */ cairo_surface_destroy (s); GdipDeleteGraphics (g); } return status; } GpStatus GdipIsOutlineVisiblePathPointI (GpPath *path, int x, int y, GpPen *pen, GpGraphics *graphics, BOOL *result) { return GdipIsOutlineVisiblePathPoint (path, x, y, pen, graphics, result); } libgdiplus-4.2/src/hatchbrush-private.h0000664000175000017500000000423712377405421015216 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __HATCHBRUSH_PRIVATE__ #define __HATCHBRUSH_PRIVATE__ #include "brush-private.h" #define HATCH_SIZE 7 #define LINE_WIDTH 1 #define gdip_hatch_get_width(hbr) (hatches_const[hbr->hatchStyle][0]) #define gdip_hatch_get_height(hbr) (hatches_const[hbr->hatchStyle][1]) #define gdip_hatch_get_line_width(hbr) (hatches_const[hbr->hatchStyle][2]) #define gdip_cairo_pixel(ct,x,y) cairo_rectangle (ct, x, y, 1, 1) typedef struct _Hatch { GpBrush base; GpHatchStyle hatchStyle; ARGB foreColor; ARGB backColor; cairo_pattern_t *pattern; } Hatch; #include "hatchbrush.h" #endif libgdiplus-4.2/src/region-bitmap.c0000664000175000017500000007766012377405421014155 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "region-private.h" #include "graphics-path-private.h" #if FALSE /* * Debugging helpers */ static void display32 (BYTE *shape, int width, int height) { int i, j; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { printf ("%s", (shape [(i*width + j) * 4] == 0) ? "." : "X"); } printf ("\n"); } printf ("\n"); } void display (char* message, GpRegionBitmap *bitmap) { int i = 0, j = 0, k; printf ("\n%s\n\tbitmap X: %d, Y: %d, Width: %d, Height %d, Mask %p\n", message, bitmap->X, bitmap->Y, bitmap->Width, bitmap->Height, bitmap->Mask); if (!bitmap->Mask) return; while (i < SHAPE_SIZE(bitmap)) { BYTE b = bitmap->Mask [i++]; for (k = 0; k < 8; k++) { if (j++ == bitmap->Width) { j = 1; printf ("\n"); } printf ("%s", ((b & (1 << k)) == 0) ? "." : "X"); } } printf ("\n"); } #endif /* Helpers */ /* * rect_union: * @bitmap1: a GpRegionBitmap * @bitmap2: a GpRegionBitmap * @rect: a pointer to a GpRect * * Calculate a rectangle, @rect, that contains both @bitmap1 and @bitmap2 * rectangles. */ static void rect_union (GpRegionBitmap *bitmap1, GpRegionBitmap *bitmap2, GpRect *rect) { int max_x_1 = bitmap1->X + bitmap1->Width; int max_x_2 = bitmap2->X + bitmap2->Width; int max_y_1 = bitmap1->Y + bitmap1->Height; int max_y_2 = bitmap2->Y + bitmap2->Height; rect->X = (bitmap1->X < bitmap2->X) ? bitmap1->X : bitmap2->X; rect->Y = (bitmap1->Y < bitmap2->Y) ? bitmap1->Y : bitmap2->Y; rect->Width = ((max_x_1 > max_x_2) ? max_x_1 : max_x_2) - rect->X; rect->Height = ((max_y_1 > max_y_2) ? max_y_1 : max_y_2) - rect->Y; } /* * rect_intersect: * @bitmap1: a GpRegionBitmap * @bitmap2: a GpRegionBitmap * @rect: a pointer to a GpRect * * Calculate a rectangle, @rect, that represent the area shared by both * @bitmap1 and @bitmap2 rectangles. */ static void rect_intersect (GpRegionBitmap *bitmap1, GpRegionBitmap *bitmap2, GpRect *rect) { rect->X = (bitmap1->X > bitmap2->X) ? bitmap1->X : bitmap2->X; rect->Y = (bitmap1->Y > bitmap2->Y) ? bitmap1->Y : bitmap2->Y; rect->Width = (((bitmap1->X + bitmap1->Width) < (bitmap2->X + bitmap2->Width)) ? (bitmap1->X + bitmap1->Width) : (bitmap2->X + bitmap2->Width)) - rect->X; rect->Height = (((bitmap1->Y + bitmap1->Height) < (bitmap2->Y + bitmap2->Height)) ? (bitmap1->Y + bitmap1->Height) : (bitmap2->Y + bitmap2->Height)) - rect->Y; } /* * rect_adjust_horizontal: * @x: a pointer to an integer * @width: a pointer to an integer * * Adjust the @x and @width values so that they both are multiples of eight * and still encompass, at least, the same data as their original value. */ static void rect_adjust_horizontal (int *x, int *width) { /* ensure that X is a multiple of 8 */ int i = (*x & 7); if (i > 0) { /* reduce X to be a multiple of 8*/ *x -= i; /* but keep the "true" Width constant */ *width += i; } /* ensure that Width is a multiple of 8 */ i = (*width & 7); if (i > 0) { *width += (8 - i); } } /* * alloc_bitmap_memory: * @size: the size of the required allocation * @clear: a BOOL * * Allocate the alpha (1bpp) memory required for storing a bitmap and return * a pointer to this memory. @clear decides if the memory will be zeroized * after being allocated. NULL can be returned if too much memory is * requested (very large region) or if the memory couldn't be allocated (low * memory). */ static BYTE* alloc_bitmap_memory (int size, BOOL clear) { BYTE *buffer; if ((size < 1) || (size > REGION_MAX_BITMAP_SIZE)) { g_warning ("Requested %d bytes. Maximum size for region is %d bytes.", size, REGION_MAX_BITMAP_SIZE); return NULL; } buffer = (BYTE*) GdipAlloc (size); if (clear) memset (buffer, 0, size); return buffer; } /* * alloc_bitmap_with_buffer: * @x: an integer representing the X coordinate of the bitmap * @y: an integer representing the Y coordinate of the bitmap * @width: an integer representing the Width of the bitmap * @height: an integer representing the Height of the bitmap * @buffer: a byte array of the bitmap data * * Allocate and return a new GpRegionBitmap structure using the supplied * @buffer. * * Notes: * - The allocated structure must be freed using gdip_region_bitmap_free. * - The bitmap @x and @width MUST BE multiple of 8. * - The supplied @buffer MUST match the supplied width and height parameters. */ static GpRegionBitmap* alloc_bitmap_with_buffer (int x, int y, int width, int height, BYTE *buffer) { GpRegionBitmap *result = (GpRegionBitmap*) GdipAlloc (sizeof (GpRegionBitmap)); result->X = x; result->Y = y; result->Width = width; result->Height = height; result->Mask = buffer; result->reduced = FALSE; /* bitmap size isn't optimal wrt contents */ return result; } /* * alloc_bitmap: * @x: an integer representing the X coordinate of the bitmap * @y: an integer representing the Y coordinate of the bitmap * @width: an integer representing the Width of the bitmap * @height: an integer representing the Height of the bitmap * * Allocate and return a new GpRegionBitmap structure. * * Notes: * - The allocated structure must be freed using gdip_region_bitmap_free. * - The bitmap @x and @width will be adjusted to a multiple of 8. */ static GpRegionBitmap* alloc_bitmap (int x, int y, int width, int height) { BYTE *buffer; int size; /* ensure X and Width are multiple of 8 */ rect_adjust_horizontal (&x, &width); size = (width * height >> 3); /* 1 bit per pixel */ buffer = alloc_bitmap_memory (size, TRUE); return alloc_bitmap_with_buffer (x, y, width, height, buffer); } /* * alloc_merged_bitmap: * @bitmap1: a GpRegionBitmap * @bitmap2: a GpRegionBitmap * * Allocate and return a new GpRegionBitmap that covers the total area * (single rectangle) of both @bitmap1 and @bitmap2. * * Notes: * - The allocated structure must be freed using gdip_region_bitmap_free. */ static GpRegionBitmap* alloc_merged_bitmap (GpRegionBitmap *bitmap1, GpRegionBitmap *bitmap2) { GpRect rect; rect_union (bitmap1, bitmap2, &rect); return alloc_bitmap (rect.X, rect.Y, rect.Width, rect.Height); } /* * alloc_intersected_bitmap: * @bitmap1: a GpRegionBitmap * @bitmap2: a GpRegionBitmap * * Allocate and return a new GpRegionBitmap that covers only the shared * rectangle area of both @bitmap1 and @bitmap2. * * Notes: * - The allocated structure must be freed using gdip_region_bitmap_free. * - The bitmap width will be adjusted to a multiple of 8. */ static GpRegionBitmap* alloc_intersected_bitmap (GpRegionBitmap *bitmap1, GpRegionBitmap *bitmap2) { GpRect rect; rect_intersect (bitmap1, bitmap2, &rect); return alloc_bitmap (rect.X, rect.Y, rect.Width, rect.Height); } /* * gdip_region_bitmap_clone: * @bitmap: a GpRegionBitmap * * Allocate and return new GpRegionBitmap containing a copy of @bitmap. * * Note: the allocated structure must be freed using gdip_region_bitmap_free. */ GpRegionBitmap* gdip_region_bitmap_clone (GpRegionBitmap *bitmap) { BYTE *buffer; int size = (bitmap->Width * bitmap->Height >> 3); /* 1 bit per pixel */ if (size > 0) { buffer = alloc_bitmap_memory (size, FALSE); if (buffer) memcpy (buffer, bitmap->Mask, size); } else { buffer = NULL; } return alloc_bitmap_with_buffer (bitmap->X, bitmap->Y, bitmap->Width, bitmap->Height, buffer); } /* * empty_bitmap: * @bitmap: a GpRegionBitmap * * Clear and, if required, free the mask of @bitmap. Note that the allocated * GpRegionBitmap structure MUST still be freed using gdip_region_bitmap_free. */ static void empty_bitmap (GpRegionBitmap *bitmap) { bitmap->X = 0; bitmap->Y = 0; bitmap->Width = 0; bitmap->Height = 0; if (bitmap->Mask) { GdipFree (bitmap->Mask); bitmap->Mask = NULL; } } /* * gdip_region_bitmap_free: * @bitmap: a GpRegionBitmap * * Free the region bitmap @bitmap. */ void gdip_region_bitmap_free (GpRegionBitmap *bitmap) { empty_bitmap (bitmap); GdipFree (bitmap); } /* * reduce: * @source: a byte array containing the 32bpp bitmap * @width: the width of the bitmap * @height: the height of the bitmap * @dest: a byte array for the reduced (1bpp) bitmap * * Reduce a 32bpp bitmap @source into a 1bbp bitmap @dest. */ static void reduce (BYTE* source, int width, int height, BYTE *dest) { int i, j, n = 0, value = 0; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { int pos = (i * width + j) * 4; BYTE combine = source [pos] | source [pos + 1] | source [pos + 2] | source [pos + 3]; if (combine != 0) value |= 128; if (++n == 8) { *dest++ = value; n = 0; value = 0; } else { value >>= 1; } } } } /* * gdip_region_bitmap_apply_alpha: * @bitmap: a GpBitmap (not a GpRegionBitmap!) * @alpha: a GpRegionBitmap * * Apply the alpha bits (from @alpha) to a ARGB32 (or RGB24) @bitmap. */ void gdip_region_bitmap_apply_alpha (GpBitmap *bitmap, GpRegionBitmap *alpha) { int x, y, p = 0, n = 3; /* FIXME - is it endian safe ? */ for (y = 0; y < alpha->Height; y++) { for (x = 0; x < alpha->Width; x += 8) { // ARGB32 bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x01) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x02) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x04) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x08) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x10) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x20) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x40) ? 0xFF : 0x00; n += 4; bitmap->active_bitmap->scan0 [n] = (alpha->Mask [p] & 0x80) ? 0xFF : 0x00; n += 4; p++; } } } /* * gdip_region_bitmap_from_tree: * @tree: a GpPathTree * * Return a new GpRegionBitmap containing the bitmap recomposed from the * @tree. * * Note: the allocated structure must be freed using gdip_region_bitmap_free. */ static GpRegionBitmap* gdip_region_bitmap_from_tree (GpPathTree *tree) { GpRegionBitmap *result; if (!tree) return NULL; /* each item has... */ if (tree->path) { /* (a) only a path (the most common case) */ result = gdip_region_bitmap_from_path (tree->path); } else { /* (b) two items with an binary operation */ GpRegionBitmap *bitmap1 = gdip_region_bitmap_from_tree (tree->branch1); GpRegionBitmap *bitmap2 = gdip_region_bitmap_from_tree (tree->branch2); result = gdip_region_bitmap_combine (bitmap1, bitmap2, tree->mode); if (bitmap1) gdip_region_bitmap_free (bitmap1); if (bitmap2) gdip_region_bitmap_free (bitmap2); } return result; } /* * gdip_region_bitmap_ensure: * @region: a GpRegion * * Ensure the @region bitmap is available (as it isn't created until it is * actually needed). */ void gdip_region_bitmap_ensure (GpRegion *region) { /* we already have the bitmap */ if (region->bitmap) return; /* redraw the bitmap from the original path + all other operations/paths */ region->bitmap = gdip_region_bitmap_from_tree (region->tree); } /* * gdip_region_bitmap_invalidate: * @region: a GpRegion * * Invalidate (and free) the bitmap (if any) associated with @region. The * bitmap will need to be re-created before begin used. */ void gdip_region_bitmap_invalidate (GpRegion *region) { /* it's possible that the bitmap hasn't yet been created (e.g. if a rectangle region has just been converted to a path region) */ if (!region->bitmap) return; empty_bitmap (region->bitmap); region->bitmap = NULL; } /* * gdip_region_bitmap_from_path: * @path: a GpPath * * Return a new GpRegionBitmap containing the bitmap representing the @path. * NULL will be returned if the bitmap cannot be created (e.g. too big). * * Note: the allocated structure must be freed using gdip_region_bitmap_free. */ GpRegionBitmap* gdip_region_bitmap_from_path (GpPath *path) { GpRect bounds; GpRegionBitmap *bitmap; BYTE* buffer; int i, idx, stride; int length = path->count; unsigned long size; cairo_surface_t *surface = NULL; cairo_t *cr = NULL; /* empty path == empty bitmap */ if (length == 0) return alloc_bitmap_with_buffer (0, 0, 0, 0, NULL); /* get the limits of the bitmap we need to allocate */ if (GdipGetPathWorldBoundsI (path, &bounds, NULL, NULL) != Ok) return NULL; /* ensure X and Width are multiple of 8 */ rect_adjust_horizontal (&bounds.X, &bounds.Width); /* an empty width or height is valid, even if no bitmap can be produced */ if ((bounds.Width == 0) || (bounds.Height == 0)) return alloc_bitmap_with_buffer (bounds.X, bounds.Y, bounds.Width, bounds.Height, NULL); /* replay the path list and the operations to reconstruct the bitmap */ stride = bounds.Width * 4; /* RGBA -> 32 bpp, 4 Bbp */ size = stride * bounds.Height; /* here the memory is allocated for a ARGB bitmap - so 32 times bigger than our normal alpha bitmap */ if ((size < 1) || (size > REGION_MAX_BITMAP_SIZE << 5)) { g_warning ("Path conversion requested %d bytes (%d x %d). Maximum size is %d bytes.", size, bounds.Width, bounds.Height, REGION_MAX_BITMAP_SIZE << 5); return NULL; } buffer = (BYTE*) GdipAlloc (size); if (!buffer) return NULL; memset (buffer, 0, size); surface = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32, bounds.Width, bounds.Height, stride); cr = cairo_create (surface); idx = 0; for (i = 0; i < length; ++i) { GpPointF pt = g_array_index (path->points, GpPointF, i); BYTE type = g_array_index (path->types, BYTE, i); GpPointF pts [3]; /* mask the bits so that we get only the type value not the other flags */ switch (type & PathPointTypePathTypeMask) { case PathPointTypeStart: cairo_move_to (cr, pt.X - bounds.X, pt.Y - bounds.Y); break; case PathPointTypeLine: cairo_line_to (cr, pt.X - bounds.X, pt.Y - bounds.Y); break; case PathPointTypeBezier: /* make sure we only add at most 3 points to pts */ if (idx < 3) { pts [idx] = pt; idx ++; } /* once we've added 3 pts, we can draw the curve */ if (idx == 3) { cairo_curve_to (cr, pts [0].X - bounds.X, pts [0].Y - bounds.Y, pts [1].X - bounds.X, pts [1].Y - bounds.Y, pts [2].X - bounds.X, pts [2].Y - bounds.Y); idx = 0; } break; } /* close the subpath */ if (type & PathPointTypeCloseSubpath) cairo_close_path (cr); } cairo_clip (cr); cairo_set_source_rgba (cr, 1, 1, 1, 1); cairo_paint (cr); cairo_destroy (cr); cairo_surface_destroy (surface); bitmap = alloc_bitmap (bounds.X, bounds.Y, bounds.Width, bounds.Height); reduce (buffer, bounds.Width, bounds.Height, bitmap->Mask); GdipFree (buffer); return bitmap; } /* * gdip_region_bitmap_get_smallest_rect: * @bitmap: a GpRegionBitmap * @rect: a pointer to a GpRect * * Return the minimal used space in the bitmap inside @rect. */ void gdip_region_bitmap_get_smallest_rect (GpRegionBitmap *bitmap, GpRect *rect) { int first_y = bitmap->Height + 1; /* empty (top) lines */ int last_y = -1; /* empty (bottom) lines */ int first_x = bitmap->Width + 1; /* empty (left) columns */ int last_x = -1; /* empty (right) columns */ int i = 0; int original_size = SHAPE_SIZE(bitmap); int old_width_byte = bitmap->Width >> 3; int x = 0, y = 0; while (i < original_size) { if (bitmap->Mask [i++] != 0) { if (x < first_x) first_x = x; if (x > last_x) last_x = x; if (y < first_y) first_y = y; if (y > last_y) last_y = y; } if (++x == old_width_byte) { x = 0; y++; } } /* did we found some bits ? */ if ((last_x == -1) && (last_y == -1) && (first_x == bitmap->Width + 1) && (first_y == bitmap->Height + 1)) { rect->X = rect->Y = rect->Width = rect->Height = 0; } else { // convert to pixel values rect->X = bitmap->X + (first_x << 3); rect->Y = bitmap->Y + first_y; rect->Width = abs (((last_x + 1) << 3) - first_x); rect->Height = last_y - first_y + 1; } } /* * is_worth_shrinking: * @original_size: the original size of a bitmap * @new_size: the _potential_ new size of the bitmap (if shrinked) * * Decide if the current bitmap, based on it's current size, is worth * shrinking to a lesser size. * * Note: Many binary operations (e.g. intersection) can greatly reduce the * size of the final bitmap. */ static BOOL is_worth_shrinking (int original_size, int new_size) { /* FIXME - we can do better than checking if we "save" 4kb */ return ((original_size - new_size) > 4096); } /* * gdip_region_bitmap_shrink: * @bitmap: a GpRegionBitmap * @always_shrink: a BOOL * * Shrink the @bitmap if either @always_shrink is TRUE, or if it is decided * to be worth the CPU time (see is_worth_shrinking). * * Reducing the bitmap size permit (a) to reduce the memory footprint and * (b) makes it more likely to apply certain optimizations using rectangle * intersections. * * Notes: * 1. we don't call this after an union (because the result will never be * smaller) but other operations can result in a smaller bitmap. * 2. we keep the bitmap width in multiple of 8 - it's simpler and faster */ void gdip_region_bitmap_shrink (GpRegionBitmap *bitmap, BOOL always_shrink) { int original_size, new_size; BOOL can_be_reduced; GpRect rect; /* bitmap (a) was already shrinked, or (b) is empty */ if (bitmap->reduced || !bitmap->Mask) return; gdip_region_bitmap_get_smallest_rect (bitmap, &rect); if ((rect.Width == 0) || (rect.Height == 0)) { /* no, the the bitmap is empty */ empty_bitmap (bitmap); return; } /* ensure X and Width are multiple of 8 */ rect_adjust_horizontal (&rect.X, &rect.Width); original_size = SHAPE_SIZE(bitmap); new_size = (rect.Height * rect.Width) >> 3; /* bits->bytes */ can_be_reduced = (new_size < original_size); /* shrink if: * a. the caller asked for it (and there is a size change) * b. the caller didn't ask for it but "we" decided it's worth it */ if ((always_shrink && can_be_reduced) || is_worth_shrinking (original_size, new_size)) { /* reallocate a new bitmap buffer */ BYTE *new_mask = alloc_bitmap_memory (new_size, FALSE); int new_width, new_height; int x, y; int old_width_byte, new_width_byte; BYTE* newline = NULL; BYTE* oldline = NULL; if (!new_mask) return; new_width = rect.Width; new_height = rect.Height; old_width_byte = bitmap->Width >> 3; new_width_byte = new_width >> 3; newline = new_mask; oldline = bitmap->Mask + ((rect.Y - bitmap->Y) * old_width_byte) + ((rect.X - bitmap->X) >> 3); /* copy the interesting portion in the new bitmap */ for (y = 0; y < new_height; y++) { memcpy (newline, oldline, new_width_byte); newline += new_width_byte; oldline += old_width_byte; } /* replace current data */ bitmap->X = rect.X; bitmap->Y = rect.Y; bitmap->Width = rect.Width; bitmap->Height = rect.Height; GdipFree (bitmap->Mask); bitmap->Mask = new_mask; bitmap->reduced = TRUE; } } /* * is_point_visible: * @bitmap: a GpRegionBitmap * @x: the horizontal position * @y: the vertical position * * Return TRUE if the @x,@y point is set on the bitmap. * * Note: No bounds check are done this internal shared function. */ static BOOL is_point_visible (GpRegionBitmap *bitmap, int x, int y) { int pixel, pos, mask; /* is the pixel set ? */ x -= bitmap->X; y -= bitmap->Y; pixel = (y * bitmap->Width + x); pos = (pixel >> 3); mask = (pixel & 7); return ((bitmap->Mask [pos] & (1 << mask)) != 0); } /* * gdip_region_bitmap_is_point_visible: * @bitmap: a GpRegionBitmap * @x: the horizontal position * @y: the vertical position * * Return TRUE if the @x,@y point is set on the bitmap. * * Note: Using a bitmap reduce the precision to integers. */ BOOL gdip_region_bitmap_is_point_visible (GpRegionBitmap *bitmap, int x, int y) { /* is this an empty bitmap ? */ if ((bitmap->Width == 0) || (bitmap->Height == 0)) return FALSE; /* is the point inside the bitmap ? */ if ((x < bitmap->X) || (x >= bitmap->X + bitmap->Width)) return FALSE; if ((y < bitmap->Y) || (y >= bitmap->Y + bitmap->Height)) return FALSE; return is_point_visible (bitmap, x, y); } /* * gdip_region_bitmap_is_point_visible: * @bitmap: a GpRegionBitmap * @rect: a pointer to a GpRect * * Return TRUE is _any_ part of @rect is inside the region. */ BOOL gdip_region_bitmap_is_rect_visible (GpRegionBitmap *bitmap, GpRect *rect) { int x, y; /* is this an empty bitmap ? */ if ((bitmap->Width == 0) || (bitmap->Height == 0)) return FALSE; /* quick intersection checks */ if (bitmap->X < rect->X + rect->Width) return FALSE; if (bitmap->X + bitmap->Width > rect->X) return FALSE; if (bitmap->Y < rect->Y + rect->Height) return FALSE; if (bitmap->Y + bitmap->Height > rect->Y) return FALSE; /* TODO - optimize */ for (y = rect->Y; y < rect->Y + rect->Height; y++) { for (x = rect->X; x < rect->X + rect->Width; x++) { if (is_point_visible (bitmap, x, y)) return TRUE; } } return FALSE; } /* * get_buffer_pos: * @shape: a GpRegionBitmap * @x: the horizontal position * @y: the vertical position * * Return the index, inside the @shape buffer, corresponding to the @x,@y * point. */ static int get_buffer_pos (GpRegionBitmap *shape, int x, int y) { /* check for out of bounds */ if ((x < shape->X) || (x >= shape->X + shape->Width)) return -1; if ((y < shape->Y) || (y >= shape->Y + shape->Height)) return -1; x -= shape->X; y -= shape->Y; return ((y * shape->Width + x) >> 3); } /* * get_byte: * @shape: a GpRegionBitmap * @x: the horizontal position * @y: the vertical position * * Return the byte, from the @shape buffer, corresponding to the @x,@y point. * Note that this byte contains 8 pixels. */ static int get_byte (GpRegionBitmap *shape, int x, int y) { /* out of bounds == empty (no pixel) */ int pos = get_buffer_pos (shape, x, y); return (pos == -1) ? 0 : shape->Mask [pos]; } /* * Process a single line for gdip_region_bitmap_get_scans. */ static BOOL process_line (GpRegionBitmap *bitmap, int y, int *x, int *w) { int pos = *x; *x = -1; *w = -1; while (pos < bitmap->X + bitmap->Width) { BOOL visible = gdip_region_bitmap_is_point_visible (bitmap, pos, y); if (*x == -1) { if (visible) { *x += pos + 1; } } else { if (!visible) { *w = pos - *x; return TRUE; } } pos++; } /* end of line - have we started a rect ? */ if (*x != -1) { *w = pos - *x; return TRUE; } return FALSE; } /* * gdip_region_bitmap_get_scans: * @bitmap: a GpRegionBitmap * @rect: a pointer to an array of GpRectF * @count: the number of GpRectF in the array * * Convert the scan lines of the bitmap into an array of GpRectF. The return * value represents the actual number of GpRectF entries that were generated. */ int gdip_region_bitmap_get_scans (GpRegionBitmap *bitmap, GpRectF *rect, int count) { GpRect actual; int x, y, w; int n = 0; actual.X = REGION_INFINITE_POSITION; actual.Width = REGION_INFINITE_LENGTH; /* for each line in the bitmap */ for (y = bitmap->Y; y < bitmap->Y + bitmap->Height; y++) { /* until we processed the whole line */ x = bitmap->X; while (process_line (bitmap, y, &x, &w)) { /* FIXME - we only look at the last rectangle but we could check all rectangles in the previous line (and retain perfect rendering with, possibly, less rectangle. We could also allow non exact match for X and Width (e.g. +/- 1 pixel). MS doesn't seems to return perfect rectangles for all shapes. */ /* if position (X) and Width are identical to previous rectangle */ if ((x == actual.X) && (w == actual.Width)) { /* then augment it's Height by one */ if (rect && (n > 0)) { rect [n - 1].Height++; } } else { actual.X = x; actual.Y = y; actual.Width = w; actual.Height = 1; if (rect && (n < count)) { rect [n].X = actual.X; rect [n].Y = actual.Y; rect [n].Width = actual.Width; rect [n].Height = actual.Height; } n++; } /* continue on the same line */ x += w + 1; } } return n; } /* * Binary operators helper functions */ /* * bitmap_intersect: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * This function checks if the rectangle containing @shape1 intersect with * the rectangle containing @shape2. It is used to optimize certain code * path in the binary operations. */ static BOOL bitmap_intersect (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { return ((shape1->X < shape2->X + shape2->Width) && (shape1->X + shape1->Width > shape2->X) && (shape1->Y < shape2->Y + shape2->Height) && (shape1->Y + shape1->Height > shape2->Y)); } /* * gdip_region_bitmap_compare: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * This function checks if the data inside @shape1 is identical to the data * inside @shape2 - even if their respective rectangles are different. */ BOOL gdip_region_bitmap_compare (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRect rect; int x, y; /* if the rectangles containing shape1 and shape2 DO NOT intersect, then there is no possible intersection */ if (!bitmap_intersect (shape1, shape2)) return FALSE; rect_union (shape1, shape2, &rect); for (y = rect.Y; y < rect.Y + rect.Height; y++) { for (x = rect.X; x < rect.X + rect.Width; x += 8) { if (get_byte (shape1, x, y) != get_byte (shape2, x, y)) return FALSE; } } return TRUE; } /* * Binary operators on bitmap regions * * Notes * - All operations requires the bitmap x origin and it's width to be multiple * of 8. */ /* * gdip_region_bitmap_union: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * Return a new bitmap containing the union of the two specified region * bitmaps. */ static GpRegionBitmap* gdip_region_bitmap_union (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRegionBitmap *op = alloc_merged_bitmap (shape1, shape2); int x, y; for (y = op->Y; y < op->Y + op->Height; y++) { int p = get_buffer_pos (op, op->X, y); for (x = op->X; x < op->X + op->Width; x += 8) { op->Mask [p++] = get_byte (shape1, x, y) | get_byte (shape2, x, y); } } /* no need to call reduce_bitmap (it will never shrink, unless the original bitmap were oversized) */ return op; } /* * gdip_region_bitmap_intersection: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * Return a new bitmap containing the intersection of the two specified region * bitmaps. */ static GpRegionBitmap* gdip_region_bitmap_intersection (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRegionBitmap *op; int x, y; /* if the rectangles containing shape1 and shape2 DO NOT intersect, then there is no possible intersection */ if (!bitmap_intersect (shape1, shape2)) return alloc_bitmap_with_buffer (0, 0, 0, 0, NULL); /* the bitmap size cannot be bigger than a rectangle intersection of both bitmaps */ op = alloc_intersected_bitmap (shape1, shape2); for (y = op->Y; y < op->Y + op->Height; y++) { int p = get_buffer_pos (op, op->X, y); for (x = op->X; x < op->X + op->Width; x += 8) { op->Mask [p++] = get_byte (shape1, x, y) & get_byte (shape2, x, y); } } /* reduce bitmap size - if it make sense */ gdip_region_bitmap_shrink (op, FALSE); return op; } /* * gdip_region_bitmap_exclude: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * Return a new bitmap containing the first shape minus the second shape. */ static GpRegionBitmap* gdip_region_bitmap_exclude (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRegionBitmap *op; int x, y; /* if the rectangles containing shape1 and shape2 DO NOT intersect, then the result is identical shape1 */ if (!bitmap_intersect (shape1, shape2)) return gdip_region_bitmap_clone (shape1); /* the new bitmap size cannot be bigger than shape1 */ op = alloc_bitmap (shape1->X, shape1->Y, shape1->Width, shape1->Height); for (y = op->Y; y < op->Y + op->Height; y++) { int p = get_buffer_pos (op, op->X, y); for (x = op->X; x < op->X + op->Width; x += 8) { BYTE b1 = get_byte (shape1, x, y); op->Mask [p++] = b1 - (b1 & get_byte (shape2, x, y)); } } /* reduce bitmap size - if it make sense */ gdip_region_bitmap_shrink (op, FALSE); return op; } /* * gdip_region_bitmap_complement: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * Return a new bitmap containing the second shape minus the first shape. */ static GpRegionBitmap* gdip_region_bitmap_complement (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRegionBitmap *op; int x, y; /* if the rectangles containing shape1 and shape2 DO NOT intersect, then the result is identical shape2 */ if (!bitmap_intersect (shape1, shape2)) return gdip_region_bitmap_clone (shape2); /* the new bitmap size cannot be bigger than shape2 */ op = alloc_bitmap (shape2->X, shape2->Y, shape2->Width, shape2->Height); for (y = op->Y; y < op->Y + op->Height; y++) { int p = get_buffer_pos (op, op->X, y); for (x = op->X; x < op->X + op->Width; x += 8) { BYTE b2 = get_byte (shape2, x, y); op->Mask [p++] = b2 - (b2 & get_byte (shape1, x, y)); } } /* reduce bitmap size - if it make sense */ gdip_region_bitmap_shrink (op, FALSE); return op; } /* * gdip_region_bitmap_xor: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * * Return a new bitmap containing the exclusive-or of the two specified region * bitmaps. */ static GpRegionBitmap* gdip_region_bitmap_xor (GpRegionBitmap *shape1, GpRegionBitmap *shape2) { GpRegionBitmap *op; int x, y; /* if the rectangles containing shape1 and shape2 DO NOT intersect, then the result is identical an union of shape1 and shape2. Code is almost similar but no reduction is required for an union. */ if (!bitmap_intersect (shape1, shape2)) return gdip_region_bitmap_union (shape1, shape2); /* the new bitmap is potentially as big as the two merged bitmaps */ op = alloc_merged_bitmap (shape1, shape2); for (y = op->Y; y < op->Y + op->Height; y++) { int p = get_buffer_pos (op, op->X, y); for (x = op->X; x < op->X + op->Width; x += 8) { op->Mask [p++] = get_byte (shape1, x, y) ^ get_byte (shape2, x, y); } } /* reduce bitmap size - if it make sense */ gdip_region_bitmap_shrink (op, FALSE); return op; } /* * gdip_region_bitmap_combine: * @shape1: a GpRegionBitmap * @shape2: a GpRegionBitmap * @combineMode: the binary operator to apply between the two shapes * * Return a new GpRegionBitmap containing a new bitmap resulting from applying * the @combineMode to @shape1 and @shape2 bitmaps. */ GpRegionBitmap* gdip_region_bitmap_combine (GpRegionBitmap *bitmap1, GpRegionBitmap* bitmap2, CombineMode combineMode) { GpRegionBitmap *result = NULL; if (!bitmap1 || !bitmap2) return NULL; switch (combineMode) { case CombineModeComplement: return gdip_region_bitmap_complement (bitmap1, bitmap2); case CombineModeExclude: return gdip_region_bitmap_exclude (bitmap1, bitmap2); case CombineModeIntersect: return gdip_region_bitmap_intersection (bitmap1, bitmap2); case CombineModeUnion: return gdip_region_bitmap_union (bitmap1, bitmap2); case CombineModeXor: return gdip_region_bitmap_xor (bitmap1, bitmap2); default: g_warning ("Unkown combine mode specified (%d)", combineMode); return NULL; } } libgdiplus-4.2/src/pen.c0000664000175000017500000006152612377405421012174 00000000000000/* * pen.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2006 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine(pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Ravindra (rkumar@novell.com) * */ #include "pen-private.h" #include "solidbrush-private.h" #include "matrix-private.h" #include "graphics-private.h" #include "customlinecap-private.h" static void gdip_pen_init (GpPen *pen) { pen->color = 0; pen->brush = 0; pen->own_brush = FALSE; pen->width = 1; pen->miter_limit = 10; pen->line_join = LineJoinMiter; pen->dash_style = DashStyleSolid; pen->line_cap = LineCapFlat; pen->end_cap = LineCapFlat; /* ignored, Cairo only support a single start/end line cap */ pen->dash_cap = DashCapFlat; /* ignored */ pen->mode = PenAlignmentCenter; pen->dash_offset = 0; pen->dash_count = 0; pen->own_dash_array = FALSE; pen->dash_array = NULL; pen->compound_count = 0; pen->compound_array = NULL; pen->unit = UnitWorld; pen->changed = TRUE; pen->custom_start_cap = NULL; pen->custom_end_cap = NULL; cairo_matrix_init_identity (&pen->matrix); } static GpPen* gdip_pen_new (void) { GpPen *result = (GpPen *) GdipAlloc (sizeof (GpPen)); if (result) gdip_pen_init (result); return result; } static cairo_line_join_t convert_line_join (GpLineJoin join) { switch (join) { case LineJoinMiter: return CAIRO_LINE_JOIN_MITER; case LineJoinBevel: return CAIRO_LINE_JOIN_BEVEL; case LineJoinRound: return CAIRO_LINE_JOIN_ROUND; case LineJoinMiterClipped: default: return CAIRO_LINE_JOIN_MITER; } } static cairo_line_cap_t convert_line_cap (GpPen *pen) { switch (pen->line_cap) { /* HACK - this keeps SWF (mostly) happy with results very similar to GDI+ * (under those specific cases) and also keeps the pen's functionalities * on par with GDI+ */ case LineCapFlat: if (pen->dash_array || (pen->width > 1.0)) return CAIRO_LINE_CAP_BUTT; else return CAIRO_LINE_CAP_SQUARE; case LineCapSquare: return CAIRO_LINE_CAP_SQUARE; case LineCapRound: return CAIRO_LINE_CAP_ROUND; case LineCapTriangle: case LineCapNoAnchor: case LineCapSquareAnchor: case LineCapRoundAnchor: case LineCapDiamondAnchor: case LineCapArrowAnchor: case LineCapCustom: default: return CAIRO_LINE_CAP_BUTT; } } static double * convert_dash_array (float *f, double width, int count) { double *retval = GdipAlloc (sizeof (double) * count); int i; for (i = 0; i < count; i++) { retval[i] = (double) f[i] * width; } return retval; } GpStatus gdip_pen_setup (GpGraphics *graphics, GpPen *pen) { GpStatus status; cairo_matrix_t product; double widthx; if (!graphics || !pen) return InvalidParameter; status = gdip_brush_setup (graphics, pen->brush); if (status != Ok) return status; cairo_matrix_init_identity (&product); /* Here we use product of pen->matrix and graphics->copy_of_ctm. * This gives us absolute results with respect to graphics. We * do following irrespective of the pen->changed state since graphics * has its own matrix and we need to multiply that with pen->matrix * every time we perform stroke operations. Graphics matrix gets * reset to its own state after stroking. */ cairo_matrix_multiply (&product, &pen->matrix, graphics->copy_of_ctm); /* Pen scaling by 0 are supported by MS GDI+ but would error in Cairo, see bug #338233 */ if (gdip_near_zero (product.xx) || gdip_near_zero (product.yy)) { /* *both* X and Y are affected if either is 0 */ product.xx = product.yy = 0.0001f; } cairo_set_matrix (graphics->ct, &product); /* Don't need to setup, if pen is the same as the cached pen and * it is not changed. Just comparing pointers may not be sufficient * to say that the pens are same. It is possible to have different * pen on the same memory, but probability is very low. We would * need a function to check the equality of the pens in that case. */ if (pen == graphics->last_pen && !pen->changed) return Ok; if (pen->width < 1.0) { /* we draw a pixel wide line if width is < 1.0 */ double widthy = 1.0; widthx = 1.0; cairo_device_to_user_distance (graphics->ct, &widthx, &widthy); } else { widthx = (double) pen->width; } cairo_set_line_width (graphics->ct, widthx); cairo_set_miter_limit (graphics->ct, (double) pen->miter_limit); cairo_set_line_join (graphics->ct, convert_line_join (pen->line_join)); cairo_set_line_cap (graphics->ct, convert_line_cap (pen)); if (pen->dash_count > 0) { double *dash_array; /* note: pen->width may be different from what was used to call cairo_set_line_width, e.g. 0.0 (#78742) */ dash_array = convert_dash_array (pen->dash_array, widthx, pen->dash_count); cairo_set_dash (graphics->ct, dash_array, pen->dash_count, pen->dash_offset); GdipFree (dash_array); } else /* Clear the dashes, if set in previous calls */ cairo_set_dash (graphics->ct, NULL, 0, 0); /* We are done with using all the changes in the pen. */ pen->changed = FALSE; graphics->last_pen = pen; return gdip_get_status (cairo_status (graphics->ct)); } GpStatus gdip_pen_draw_custom_start_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) { if (!graphics || !pen) return InvalidParameter; if (pen->custom_start_cap) { /* Draw the end cap */ gdip_linecap_draw (graphics, pen, pen->custom_start_cap, x1, y1, x2, y2); } return gdip_get_status (cairo_status (graphics->ct)); } GpStatus gdip_pen_draw_custom_end_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) { if (!graphics || !pen) return InvalidParameter; if (pen->custom_end_cap) { /* Draw the end cap */ gdip_linecap_draw (graphics, pen, pen->custom_end_cap, x1, y1, x2, y2); } return gdip_get_status (cairo_status (graphics->ct)); } // coverity[+alloc : arg-*3] GpStatus GdipCreatePen1 (ARGB argb, float width, GpUnit unit, GpPen **pen) { GpStatus s; GpSolidFill *solidBrush = NULL; GpPen *result; if (!pen) return InvalidParameter; *pen = result = gdip_pen_new (); if (!result) return OutOfMemory; result->color = argb; /* FIXME: do unit conversion when setting width */ result->width = width; s = GdipCreateSolidFill (argb, &solidBrush); if (s != Ok) { if (solidBrush) GdipDeleteBrush ((GpBrush*) solidBrush); GdipFree (result); *pen = NULL; return s; } result->brush = (GpBrush*) solidBrush; result->own_brush = TRUE; return Ok; } // coverity[+alloc : arg-*3] GpStatus GdipCreatePen2 (GpBrush *brush, float width, GpUnit unit, GpPen **pen) { ARGB color; GpStatus s; GpBrushType type; GpPen *result; if (!brush || !pen) return InvalidParameter; *pen = result = gdip_pen_new (); if (!result) return OutOfMemory; /* FIXME: do unit conversion when setting width */ result->width = width; /* the user supplied brush can be disposed, we must clone it to ensure * it's valid when we need to set the pen */ s = GdipCloneBrush (brush, &result->brush); if (s != Ok) { GdipFree (result); *pen = NULL; return s; } result->own_brush = TRUE; s = GdipGetBrushType (brush, &type); if (s != Ok) { GdipFree (result); *pen = NULL; return s; } switch (type) { case BrushTypeSolidColor: s = GdipGetSolidFillColor ((GpSolidFill*) brush, &color); if (s != Ok) { GdipFree (result); *pen = NULL; return s; } result->color = color; *pen = result; return Ok; case BrushTypeHatchFill: case BrushTypeTextureFill: case BrushTypePathGradient: case BrushTypeLinearGradient: *pen = result; return Ok; default: GdipFree (result); *pen = NULL; return GenericError; } } static float * clone_dash_array (float *clone, float *array, int size) { int i; for (i = 0; i < size; i++) clone [i] = array [i]; return clone; } // coverity[+alloc : arg-*1] GpStatus GdipClonePen (GpPen *pen, GpPen **clonepen) { GpPen *result; float *dashes; /* copy off pen->dash_array */ float *compound_array = NULL; /* copy off pen->compound_array */ GpCustomLineCap *custom_start_cap = NULL; GpCustomLineCap *custom_end_cap = NULL; if (!pen || !clonepen) return InvalidParameter; /* we make a copy of dash array only if it is owned by pen, i.e. it is not * our global array. */ if (pen->dash_count > 0 && pen->own_dash_array) { dashes = (float *) GdipAlloc (pen->dash_count * sizeof (float)); if (!dashes) return OutOfMemory; clone_dash_array (dashes, pen->dash_array, pen->dash_count); } else dashes = pen->dash_array; if (pen->compound_count > 0) { compound_array = (float *) GdipAlloc (pen->compound_count * sizeof (float)); if (compound_array == NULL) { if (pen->dash_count > 0) GdipFree (dashes); return OutOfMemory; } clone_dash_array (compound_array, pen->compound_array, pen->compound_count); } if (pen->custom_start_cap != NULL) { GpStatus status = GdipCloneCustomLineCap (pen->custom_start_cap, &custom_start_cap); if (status != Ok) { if (custom_start_cap) GdipDeleteCustomLineCap (custom_start_cap); if (compound_array != NULL) GdipFree (compound_array); if (pen->dash_count > 0) GdipFree (dashes); return OutOfMemory; } } if (pen->custom_end_cap != NULL) { GpStatus status = GdipCloneCustomLineCap (pen->custom_end_cap, &custom_end_cap); if (status != Ok) { if (custom_end_cap) GdipDeleteCustomLineCap (custom_end_cap); if (custom_start_cap) GdipDeleteCustomLineCap (custom_start_cap); if (compound_array != NULL) GdipFree (compound_array); if (pen->dash_count > 0) GdipFree (dashes); return OutOfMemory; } } result = gdip_pen_new (); if (result == NULL) { if (pen->dash_count > 0) GdipFree (dashes); if (pen->compound_count > 0) GdipFree (compound_array); return OutOfMemory; } if (pen->own_brush) { GpSolidFill* solidBrush; GpSolidFill* oldbrush = (GpSolidFill*)pen->brush; GdipCreateSolidFill (oldbrush->color, &solidBrush); result->brush = (GpBrush*) solidBrush; } else { result->brush = pen->brush; } result->own_brush = pen->own_brush; result->color = pen->color; result->width = pen->width; result->miter_limit = pen->miter_limit; result->line_join = pen->line_join; result->dash_style = pen->dash_style; result->line_cap = pen->line_cap; result->end_cap = pen->end_cap; result->mode = pen->mode; result->dash_offset = pen->dash_offset; result->dash_count = pen->dash_count; result->own_dash_array = pen->own_dash_array; result->dash_array = dashes; result->compound_count = pen->compound_count; result->compound_array = compound_array; result->unit = pen->unit; gdip_cairo_matrix_copy (&result->matrix, &pen->matrix); result->changed = pen->changed; result->custom_start_cap = custom_start_cap; result->custom_end_cap = custom_end_cap; *clonepen = result; return Ok; } GpStatus GdipDeletePen (GpPen *pen) { if (!pen) return InvalidParameter; if (pen->dash_count != 0 && pen->own_dash_array) { GdipFree (pen->dash_array); pen->dash_count = 0; pen->dash_array = NULL; } if (pen->own_brush && pen->brush) { GdipDeleteBrush (pen->brush); pen->brush = NULL; } if (pen->compound_count != 0) { GdipFree (pen->compound_array); pen->compound_array = NULL; pen->compound_count = 0; } if (pen->custom_start_cap != NULL) { GdipDeleteCustomLineCap (pen->custom_start_cap); pen->custom_start_cap = NULL; } if (pen->custom_end_cap != NULL) { GdipDeleteCustomLineCap (pen->custom_end_cap); pen->custom_end_cap = NULL; } GdipFree (pen); return Ok; } GpStatus GdipSetPenWidth (GpPen *pen, float width) { if (!pen) return InvalidParameter; pen->width = width; pen->changed = TRUE; return Ok; } GpStatus GdipGetPenWidth (GpPen *pen, float *width) { if (!pen || !width) return InvalidParameter; *width = pen->width; return Ok; } GpStatus GdipSetPenBrushFill (GpPen *pen, GpBrush *brush) { GpStatus s; ARGB color; GpBrushType type; if (!pen || !brush) return InvalidParameter; s = GdipGetBrushType (brush, &type); if (s != Ok) return s; if (type == BrushTypeSolidColor) { s = GdipGetSolidFillColor ((GpSolidFill*) brush, &color); if (s != Ok) return s; pen->color = color; } else pen->color = 0; if (pen->own_brush && pen->brush) GdipDeleteBrush (pen->brush); pen->brush = brush; pen->changed = TRUE; pen->own_brush = FALSE; return Ok; } GpStatus GdipGetPenBrushFill (GpPen *pen, GpBrush **brush) { if (!pen) return InvalidParameter; return GdipCloneBrush (pen->brush, brush); } GpStatus GdipGetPenFillType (GpPen *pen, GpPenType *type) { if (!pen || !type) return InvalidParameter; if (pen->brush != NULL) return GdipGetBrushType (pen->brush, (GpBrushType *) type); *type = PenTypeSolidColor; return Ok; } GpStatus GdipSetPenColor (GpPen *pen, ARGB argb) { if (!pen) return InvalidParameter; pen->changed = pen->changed ? TRUE : (pen->color != argb); pen->color = argb; if (pen->changed && pen->brush && (pen->brush->vtable->type == BrushTypeSolidColor)) return GdipSetSolidFillColor ((GpSolidFill*)pen->brush, argb); return Ok; } GpStatus GdipGetPenColor (GpPen *pen, ARGB *argb) { if (!pen || !argb) return InvalidParameter; *argb = pen->color; return Ok; } GpStatus GdipSetPenMiterLimit (GpPen *pen, float miterLimit) { if (!pen) return InvalidParameter; if (miterLimit < 1.0f) miterLimit = 1.0f; pen->changed = pen->changed ? TRUE : (pen->miter_limit != miterLimit); pen->miter_limit = miterLimit; return Ok; } GpStatus GdipGetPenMiterLimit (GpPen *pen, float *miterLimit) { if (!pen || !miterLimit) return InvalidParameter; *miterLimit = pen->miter_limit; return Ok; } GpStatus GdipSetPenLineJoin (GpPen *pen, GpLineJoin lineJoin) { if (!pen) return InvalidParameter; pen->changed = pen->changed ? TRUE : (pen->line_join != lineJoin); pen->line_join = lineJoin; return Ok; } GpStatus GdipGetPenLineJoin (GpPen *pen, GpLineJoin *lineJoin) { if (!pen || !lineJoin) return InvalidParameter; *lineJoin = pen->line_join; return Ok; } GpStatus GdipSetPenLineCap197819 (GpPen *pen, GpLineCap startCap, GpLineCap endCap, GpDashCap dashCap) { if (!pen) return InvalidParameter; /* FIXME: * Cairo supports only one cap for a line. We use startcap for that. * Use end cap and dash cap when Cairo supports different caps for the * line ends and dashcap. */ pen->line_cap = startCap; pen->end_cap = endCap; /* any invalid value is changed to DashCapFlat */ if ((dashCap == DashCapRound) || (dashCap == DashCapTriangle)) pen->dash_cap = dashCap; else pen->dash_cap = DashCapFlat; /* default */ pen->changed = TRUE; return Ok; } GpStatus GdipSetPenMode (GpPen *pen, GpPenAlignment penMode) { if (!pen) return InvalidParameter; pen->changed = pen->changed ? TRUE : (penMode != pen->mode); pen->mode = penMode; return Ok; } GpStatus GdipGetPenMode (GpPen *pen, GpPenAlignment *penMode) { if (!pen || !penMode) return InvalidParameter; *penMode = pen->mode; return Ok; } GpStatus GdipGetPenUnit (GpPen *pen, GpUnit *unit) { if (!pen || !unit) return InvalidParameter; *unit = pen->unit; return Ok; } GpStatus GdipSetPenUnit (GpPen *pen, GpUnit unit) { if (!pen) return InvalidParameter; pen->unit = unit; pen->changed = TRUE; return Ok; } GpStatus GdipSetPenTransform (GpPen *pen, GpMatrix *matrix) { GpStatus status; BOOL invertible; if (!pen || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; gdip_cairo_matrix_copy (&pen->matrix, matrix); pen->changed = TRUE; return Ok; } GpStatus GdipGetPenTransform (GpPen *pen, GpMatrix *matrix) { if (!pen || !matrix) return InvalidParameter; gdip_cairo_matrix_copy(matrix, &pen->matrix); return Ok; } GpStatus GdipResetPenTransform (GpPen *pen) { if (!pen) return InvalidParameter; cairo_matrix_init_identity (&pen->matrix); pen->changed = TRUE; return Ok; } GpStatus GdipMultiplyPenTransform (GpPen *pen, GpMatrix *matrix, GpMatrixOrder order) { GpStatus status; BOOL invertible; if (!pen || !matrix) return InvalidParameter; /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; /* invalid GpMatrixOrder values are computed as MatrixOrderAppend (i.e. no error) */ if (order != MatrixOrderPrepend) order = MatrixOrderAppend; status = GdipMultiplyMatrix (&pen->matrix, matrix, order); if (status == Ok) pen->changed = TRUE; return status; } GpStatus GdipTranslatePenTransform (GpPen *pen, float dx, float dy, GpMatrixOrder order) { GpStatus status; if (!pen) return InvalidParameter; status = GdipTranslateMatrix (&pen->matrix, dx, dy, order); if (status == Ok) pen->changed = TRUE; return status; } GpStatus GdipScalePenTransform (GpPen *pen, float sx, float sy, GpMatrixOrder order) { GpStatus status; if (!pen) return InvalidParameter; status = GdipScaleMatrix (&pen->matrix, sx, sy, order); if (status == Ok) pen->changed = TRUE; return status; } GpStatus GdipRotatePenTransform (GpPen *pen, float angle, GpMatrixOrder order) { GpStatus status; if (!pen) return InvalidParameter; status = GdipRotateMatrix (&pen->matrix, angle, order); if (status == Ok) pen->changed = TRUE; return status; } GpStatus GdipGetPenDashStyle (GpPen *pen, GpDashStyle *dashStyle) { if (!pen || !dashStyle) return InvalidParameter; *dashStyle = pen->dash_style; return Ok; } static float Dot [] = { 1.0, 1.0 }; static float Dash [] = { 3.0, 1.0 }; static float DashDot [] = { 3.0, 1.0, 1.0, 1.0 }; static float DashDotDot [] = { 3.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; GpStatus GdipSetPenDashStyle (GpPen *pen, GpDashStyle dashStyle) { if (!pen) return InvalidParameter; switch (dashStyle) { case DashStyleSolid: pen->dash_array = NULL; pen->dash_count = 0; break; case DashStyleDashDot: pen->dash_array = DashDot; pen->dash_count = 4; break; case DashStyleDashDotDot: pen->dash_array = DashDotDot; pen->dash_count = 6; break; case DashStyleDot: pen->dash_array = Dot; pen->dash_count = 2; break; case DashStyleDash: pen->dash_array = Dash; pen->dash_count = 2; break; case DashStyleCustom: /* we keep the current assigned value when switching to Custom */ /* other special stuff happens in System.Drawing (but not here) */ break; default: return GenericError; } pen->dash_style = dashStyle; pen->changed = TRUE; return Ok; } GpStatus GdipGetPenDashOffset (GpPen *pen, float *offset) { if (!pen || !offset) return InvalidParameter; *offset = pen->dash_offset; return Ok; } GpStatus GdipSetPenDashOffset (GpPen *pen, float offset) { if (!pen) return InvalidParameter; pen->dash_offset = offset; pen->changed = TRUE; return Ok; } GpStatus GdipGetPenDashCount (GpPen *pen, int *count) { if (!pen || !count) return InvalidParameter; *count = pen->dash_count; return Ok; } /* * This is the DashPattern property in Pen. */ GpStatus GdipGetPenDashArray (GpPen *pen, float *dash, int count) { if (!pen || !dash) return InvalidParameter; if (count == 0) return OutOfMemory; if (count != pen->dash_count) return InvalidParameter; memcpy (dash, pen->dash_array, count * sizeof (float)); return Ok; } GpStatus GdipSetPenDashArray (GpPen *pen, GDIPCONST float *dash, int count) { float *dash_array; if (!pen || !dash || (count <= 0)) return InvalidParameter; if (pen->dash_count != count || pen->own_dash_array == FALSE) { dash_array = (float *) GdipAlloc (count * sizeof (float)); if (!dash_array) return OutOfMemory; /* free the existing values, if we own them */ if (pen->dash_count != 0 && pen->own_dash_array == TRUE) GdipFree (pen->dash_array); pen->dash_array = dash_array; pen->dash_count = count; pen->own_dash_array = TRUE; } memcpy (pen->dash_array, dash, pen->dash_count * sizeof (float)); pen->dash_style = DashStyleCustom; pen->changed = TRUE; return Ok; } /* * MonoTODO: Find out what the difference is between CompoundArray and DashArray */ GpStatus GdipGetPenCompoundCount (GpPen *pen, int *count) { if (!pen || !count) return InvalidParameter; *count = pen->compound_count; return Ok; } GpStatus GdipSetPenCompoundArray (GpPen *pen, const float *compound, int count) { float *compound_array; if (!pen || !compound || (count <= 0)) return InvalidParameter; if (pen->compound_count != count) { compound_array = (float *) GdipAlloc (count * sizeof (float)); if (!compound_array) return OutOfMemory; /* free the existing values */ if (pen->compound_count != 0) GdipFree (pen->compound_array); pen->compound_array = compound_array; pen->compound_count = count; } memcpy (pen->compound_array, compound, pen->compound_count * sizeof (float)); return Ok; } GpStatus GdipGetPenCompoundArray (GpPen *pen, float *compound, int count) { if (!pen || !compound || (count != pen->compound_count)) return InvalidParameter; memcpy (compound, pen->compound_array, count * sizeof (float)); return Ok; } GpStatus GdipSetPenStartCap (GpPen *pen, GpLineCap startCap) { if (!pen) return InvalidParameter; pen->line_cap = startCap; pen->changed = TRUE; return Ok; } GpStatus GdipGetPenStartCap (GpPen *pen, GpLineCap *startCap) { if (!pen || !startCap) return InvalidParameter; *startCap = pen->line_cap; return Ok; } /* MonoTODO - ignored (always same as start cap) */ GpStatus GdipSetPenEndCap (GpPen *pen, GpLineCap endCap) { if (!pen) return InvalidParameter; /* * This is currently ignored, as Cairo does not support * having a different start and end Cap */ pen->end_cap = endCap; pen->changed = TRUE; return Ok; } /* MonoTODO - ignored (always same as start cap) */ GpStatus GdipGetPenEndCap (GpPen *pen, GpLineCap *endCap) { if (!pen || !endCap) return InvalidParameter; *endCap = pen->end_cap; return Ok; } /* MonoTODO - ignored */ GpStatus GdipSetPenDashCap197819 (GpPen *pen, GpDashCap dashCap) { if (!pen) return InvalidParameter; pen->dash_cap = dashCap; return Ok; } /* MonoTODO - ignored */ GpStatus GdipGetPenDashCap197819 (GpPen *pen, GpDashCap *dashCap) { if (!pen || !dashCap) return InvalidParameter; *dashCap = pen->dash_cap; return Ok; } GpStatus GdipSetPenCustomStartCap (GpPen *pen, GpCustomLineCap *customCap) { if (!pen) return InvalidParameter; return GdipCloneCustomLineCap (customCap, &pen->custom_start_cap); } GpStatus GdipGetPenCustomStartCap (GpPen *pen, GpCustomLineCap **customCap) { if (!pen || !customCap) return InvalidParameter; return GdipCloneCustomLineCap (pen->custom_start_cap, customCap); } GpStatus GdipSetPenCustomEndCap (GpPen *pen, GpCustomLineCap *customCap) { if (!pen) return InvalidParameter; return GdipCloneCustomLineCap (customCap, &pen->custom_end_cap); } GpStatus GdipGetPenCustomEndCap (GpPen *pen, GpCustomLineCap **customCap) { if (!pen || !customCap) return InvalidParameter; return GdipCloneCustomLineCap (pen->custom_end_cap, customCap); } libgdiplus-4.2/src/matrix.c0000664000175000017500000002447712377405421012722 00000000000000/** * matrix.c * * Copyright (C) Novell, Inc. 2003-2004, 2007. * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: Duncan Mak (duncan@ximian.com) * * **/ #include "matrix-private.h" /* GDI+ matrix takes 6 elements arranged in 3 rows by 2 columns. The identity matrix is [1, 0] [1, 0, 0] [0, 1] that is a simplification of [0, 1, 0] [0, 0] [0, 0, 1] Point v1, v2 Matrix: [m11, m12] [m21, m22] [m31, m32] Calcutation of X, Y using the previous matrix X = v1 * m11 + v2 * m12 + m31 Y = v1 * m21 + v2 * m22 + m32 M31 and M32 are used to do matrix translations */ /* private functions */ /* * In System.Drawing it is often impossible to specify a 'null' matrix. * Instead we supply an empty matrix (i.e. new Matrix ()). However this * "empty" matrix can cause a lot of extra calculation in libgdiplus * (e.g. invalidating the bitmap) unless we consider it as a special case. */ BOOL gdip_is_matrix_empty (GpMatrix* matrix) { if (!matrix) return TRUE; /* compare the matrix elements with the empty (no-op) version */ return (gdip_near_one (matrix->xx) && gdip_near_zero (matrix->yx) && gdip_near_zero (matrix->xy) && gdip_near_one (matrix->yy) && gdip_near_zero (matrix->x0) && gdip_near_zero (matrix->y0)); } BOOL gdip_is_matrix_a_translation (GpMatrix *matrix) { if (!matrix) return TRUE; return ((matrix->xx == 1.0f) && (matrix->yx == 0.0f) && (matrix->xy == 0.0f) && (matrix->yy == 1.0f)); } /* this helper function avoid GpMatrix allocation and reduce code duplication */ GpStatus gdip_matrix_init_from_rect_3points (GpMatrix *matrix, const GpRectF *rect, const GpPointF *dstplg) { GpPointF *p, *p0, *p1, *p2; double m11, m12, m21, m22; if (!matrix || !rect || !dstplg) return InvalidParameter; if ((rect->Width == 0) || (rect->Height == 0)) return OutOfMemory; p = (GpPointF*) dstplg; p0 = p++; p1 = p++; p2 = p; m11 = (p1->X - p0->X) / rect->Width; m12 = (p1->Y - p0->Y) / rect->Width; m21 = (p2->X - p0->X) / rect->Height; m22 = (p2->Y - p0->Y) / rect->Height; cairo_matrix_init (matrix, m11, m12, m21, m22, p0->X, p0->Y); cairo_matrix_translate (matrix, -rect->X, -rect->Y); return Ok; } /* public (exported) functions */ // coverity[+alloc : arg-*0] GpStatus GdipCreateMatrix (GpMatrix **matrix) { GpMatrix *result; if (!matrix) return InvalidParameter; result = GdipAlloc (sizeof (GpMatrix)); if (!result) return OutOfMemory; cairo_matrix_init_identity (result); *matrix = result; return Ok; } // coverity[+alloc : arg-*6] GpStatus GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, GpMatrix **matrix) { GpMatrix *result; if (!matrix) return InvalidParameter; result = GdipAlloc (sizeof (GpMatrix)); if (!result) return OutOfMemory; cairo_matrix_init (result, m11, m12, m21, m22, dx, dy); *matrix = result; return Ok; } // coverity[+alloc : arg-*2] GpStatus GdipCreateMatrix3 (const GpRectF *rect, const GpPointF *dstplg, GpMatrix **matrix) { GpMatrix *result; GpStatus status; if (!rect || !dstplg || !matrix) return InvalidParameter; result = GdipAlloc (sizeof (GpMatrix)); if (!result) return OutOfMemory; status = gdip_matrix_init_from_rect_3points (result, rect, dstplg); if (status == Ok) *matrix = result; else GdipFree (result); return status; } // coverity[+alloc : arg-*2] GpStatus GdipCreateMatrix3I (const GpRect *rect, const GpPoint *dstplg, GpMatrix **matrix) { GpRectF r; GpPointF pts[3]; if (!rect || !dstplg || !matrix) return InvalidParameter; r.X = rect->X; r.Y = rect->Y; r.Width = rect->Width; r.Height = rect->Height; pts [0].X = dstplg [0].X; pts [0].Y = dstplg [0].Y; pts [1].X = dstplg [1].X; pts [1].Y = dstplg [1].Y; pts [2].X = dstplg [2].X; pts [2].Y = dstplg [2].Y; return GdipCreateMatrix3 (&r, (GpPointF*)&pts, matrix); } // coverity[+alloc : arg-*1] GpStatus GdipCloneMatrix (GpMatrix *matrix, GpMatrix **cloneMatrix) { GpMatrix *result; if (!matrix || !cloneMatrix) return InvalidParameter; result = GdipAlloc (sizeof (GpMatrix)); if (!result) return OutOfMemory; gdip_cairo_matrix_copy (result, matrix); *cloneMatrix = result; return Ok; } GpStatus GdipDeleteMatrix (GpMatrix *matrix) { if (!matrix) return InvalidParameter; GdipFree (matrix); return Ok; } GpStatus GdipSetMatrixElements (GpMatrix *matrix, float m11, float m12, float m21, float m22, float dx, float dy) { if (!matrix) return InvalidParameter; cairo_matrix_init (matrix, m11, m12, m21, m22, dx, dy); return Ok; } GpStatus GdipGetMatrixElements (GpMatrix *matrix, float *matrixOut) { if (!matrix || !matrixOut) return InvalidParameter; matrixOut[0] = (float) matrix->xx; matrixOut[1] = (float) matrix->yx; matrixOut[2] = (float) matrix->xy; matrixOut[3] = (float) matrix->yy; matrixOut[4] = (float) matrix->x0; matrixOut[5] = (float) matrix->y0; return Ok; } GpStatus GdipMultiplyMatrix (GpMatrix *matrix, GpMatrix *matrix2, GpMatrixOrder order) { if (!matrix || !matrix2) return InvalidParameter; if (order == MatrixOrderAppend) cairo_matrix_multiply (matrix, matrix, matrix2); else if (order == MatrixOrderPrepend) cairo_matrix_multiply (matrix, matrix2, matrix); else return InvalidParameter; return Ok; } GpStatus GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order) { cairo_matrix_t tmp; GpStatus s; cairo_matrix_init (&tmp, 1, 0, 0, 1, offsetX, offsetY); s = GdipMultiplyMatrix (matrix, &tmp, order); return s; } GpStatus GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order) { GpMatrix tmp; GpStatus s; cairo_matrix_init (&tmp, scaleX, 0, 0, scaleY, 0, 0); s = GdipMultiplyMatrix (matrix, &tmp, order); return s; } GpStatus GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order) { cairo_matrix_t tmp; GpStatus s; float rad = angle * DEGTORAD; cairo_matrix_init (&tmp, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0); s = GdipMultiplyMatrix (matrix, &tmp, order); return s; } GpStatus GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order) { cairo_matrix_t tmp; GpStatus s; cairo_matrix_init (&tmp, 1, shearY, shearX, 1, 0, 0); s = GdipMultiplyMatrix (matrix, &tmp, order); return s; } GpStatus GdipInvertMatrix (GpMatrix *matrix) { if (!matrix) return InvalidParameter; return gdip_get_status ( cairo_matrix_invert (matrix)); } GpStatus GdipTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count) { int i; if (!matrix || !pts || (count < 1)) return InvalidParameter; for (i = 0; i < count; i++, pts++) { double x = pts->X; double y = pts->Y; cairo_matrix_transform_point (matrix, &x, &y); pts->X = (float) x; pts->Y = (float) y; } return Ok; } GpStatus GdipTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count) { int i; if (!matrix || !pts || (count < 1)) return InvalidParameter; for (i = 0; i < count; i++, pts++) { double x = pts->X; double y = pts->Y; cairo_matrix_transform_point (matrix, &x, &y); pts->X = (int) x; pts->Y = (int) y; } return Ok; } GpStatus GdipVectorTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count) { int i; if (!matrix || !pts || (count < 1)) return InvalidParameter; for (i = 0; i < count; i++, pts++) { double x = pts->X; double y = pts->Y; cairo_matrix_transform_distance (matrix, &x, &y); pts->X = (float) x; pts->Y = (float) y; } return Ok; } GpStatus GdipVectorTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count) { int i; if (!matrix || !pts || (count < 1)) return InvalidParameter; for (i = 0; i < count; i++, pts++) { double x = pts->X; double y = pts->Y; cairo_matrix_transform_distance (matrix, &x, &y); pts->X = (int) x; pts->Y = (int) y; } return Ok; } GpStatus GdipIsMatrixInvertible (GpMatrix *matrix, BOOL *result) { cairo_status_t status; cairo_matrix_t copy; if (!matrix || !result) return InvalidParameter; gdip_cairo_matrix_copy (©, matrix); status = cairo_matrix_invert (©); *result = (status != CAIRO_STATUS_INVALID_MATRIX); return Ok; } GpStatus GdipIsMatrixIdentity (GpMatrix *matrix, BOOL *result) { if (!matrix || !result) return InvalidParameter; /* note: we CAN'T use GdipIsMatrixEqual - as the precision is different */ *result = gdip_is_matrix_empty (matrix); return Ok; } GpStatus GdipIsMatrixEqual (GpMatrix *matrix, GpMatrix *matrix2, BOOL *result) { if (!matrix || !matrix2 || !result) return InvalidParameter; *result = ((matrix->xx == matrix2->xx) && (matrix->yx == matrix2->yx) && (matrix->xy == matrix2->xy) && (matrix->yy == matrix2->yy) && (matrix->x0 == matrix2->x0) && (matrix->y0 == matrix2->y0)); return Ok; } libgdiplus-4.2/src/graphics-metafile-private.h0000664000175000017500000002070712377405421016447 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __GRAPHICS_METAFILE_PRIVATE_H__ #define __GRAPHICS_METAFILE_PRIVATE_H__ #include "gdiplus-private.h" #include "matrix-private.h" GpStatus metafile_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_DrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_DrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) GDIP_INTERNAL; GpStatus metafile_DrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) GDIP_INTERNAL; GpStatus metafile_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus metafile_DrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus metafile_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension) GDIP_INTERNAL; GpStatus metafile_DrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension) GDIP_INTERNAL; GpStatus metafile_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension) GDIP_INTERNAL; GpStatus metafile_FillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension) GDIP_INTERNAL; GpStatus metafile_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension) GDIP_INTERNAL; GpStatus metafile_DrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension) GDIP_INTERNAL; GpStatus metafile_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus metafile_DrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus metafile_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus metafile_FillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus metafile_DrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) GDIP_INTERNAL; GpStatus metafile_DrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2) GDIP_INTERNAL; GpStatus metafile_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus metafile_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus metafile_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus metafile_DrawRectangleI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus metafile_FillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL; GpStatus metafile_FillRectangleI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) GDIP_INTERNAL; GpStatus metafile_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; GpStatus metafile_DrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL; GpStatus metafile_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; GpStatus metafile_FillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL; GpStatus metafile_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) GDIP_INTERNAL; GpStatus metafile_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) GDIP_INTERNAL; GpStatus metafile_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_DrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_FillPieI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height, float startAngle, float sweepAngle) GDIP_INTERNAL; GpStatus metafile_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; GpStatus metafile_DrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL; GpStatus metafile_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode) GDIP_INTERNAL; GpStatus metafile_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode) GDIP_INTERNAL; GpStatus metafile_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) GDIP_INTERNAL; GpStatus metafile_GraphicsClear (GpGraphics *graphics, ARGB color) GDIP_INTERNAL; GpStatus metafile_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) GDIP_INTERNAL; GpStatus metafile_SetCompositingQuality (GpGraphics *graphics, CompositingQuality compositingQuality) GDIP_INTERNAL; GpStatus metafile_SetInterpolationMode (GpGraphics *graphics, InterpolationMode interpolationMode) GDIP_INTERNAL; GpStatus metafile_SetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode pixelOffsetMode) GDIP_INTERNAL; GpStatus metafile_SetRenderingOrigin (GpGraphics *graphics, int x, int y) GDIP_INTERNAL; GpStatus metafile_SetPageTransform (GpGraphics *graphics, GpUnit unit, float scale) GDIP_INTERNAL; GpStatus metafile_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) GDIP_INTERNAL; GpStatus metafile_SetTextContrast (GpGraphics *graphics, UINT contrast) GDIP_INTERNAL; GpStatus metafile_SetTextRenderingHint (GpGraphics *graphics, TextRenderingHint mode) GDIP_INTERNAL; GpStatus metafile_ResetClip (GpGraphics *graphics) GDIP_INTERNAL; GpStatus metafile_SetClipPath (GpGraphics *graphics, GpPath *path, CombineMode combineMode) GDIP_INTERNAL; GpStatus metafile_SetClipRect (GpGraphics *graphics, float x, float y, float width, float height, CombineMode combineMode) GDIP_INTERNAL; GpStatus metafile_SetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode combineMode) GDIP_INTERNAL; GpStatus metafile_TranslateClip (GpGraphics *graphics, float dx, float dy) GDIP_INTERNAL; GpStatus metafile_ResetWorldTransform (GpGraphics *graphics) GDIP_INTERNAL; GpStatus metafile_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) GDIP_INTERNAL; GpStatus metafile_MultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order) GDIP_INTERNAL; GpStatus metafile_RotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order) GDIP_INTERNAL; GpStatus metafile_ScaleWorldTransform (GpGraphics *graphics, float sx, float sy, GpMatrixOrder order) GDIP_INTERNAL; GpStatus metafile_TranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order) GDIP_INTERNAL; #endif libgdiplus-4.2/src/customlinecap.c0000664000175000017500000002554512377405421014261 00000000000000/* * customlinecap.c * * Copyright (C) Novell, Inc. 2003-2004. * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: * Ravindra (rkumar@novell.com) * * Copyright (C) 2004 Novell, Inc. http://www.novell.com */ #include "customlinecap-private.h" #include "graphics-path-private.h" #include "graphics-private.h" #include "graphics-cairo-private.h" static GpStatus gdip_custom_linecap_setup (GpGraphics *graphics, GpCustomLineCap *cap); static GpStatus gdip_custom_linecap_clone_cap (GpCustomLineCap *cap, GpCustomLineCap **clonedCap); static GpStatus gdip_custom_linecap_destroy (GpCustomLineCap *cap); static GpStatus gdip_custom_linecap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *cap, float x, float y, float otherend_x, float otherend_y); /* * we have a single copy of vtable for * all instances of custom linecap. */ static CapClass vtable = { CustomLineCapTypeDefault, gdip_custom_linecap_setup, gdip_custom_linecap_clone_cap, gdip_custom_linecap_destroy, gdip_custom_linecap_draw }; void gdip_custom_linecap_init (GpCustomLineCap *cap, CapClass *vt) { cap->vtable = vt; cap->base_cap = LineCapFlat; cap->start_cap = LineCapFlat; cap->end_cap = LineCapFlat; cap->stroke_join = LineJoinMiter; cap->base_inset = 0.0; /* LAMESPEC: Default value is documented as 1.0, but actually it is 0.0 */ cap->width_scale = 0.0; cap->fill_path = NULL; cap->stroke_path = NULL; } static GpCustomLineCap* gdip_custom_linecap_new (void) { GpCustomLineCap *result = (GpCustomLineCap *) GdipAlloc (sizeof (GpCustomLineCap)); if (result) gdip_custom_linecap_init (result, &vtable); return result; } GpStatus gdip_custom_linecap_clone_cap (GpCustomLineCap *cap, GpCustomLineCap **clonedCap) { GpCustomLineCap *newcap; GpPath *fillpath = NULL, *strokepath = NULL; if (!cap || !clonedCap) return InvalidParameter; newcap = (GpCustomLineCap *) GdipAlloc (sizeof (GpCustomLineCap)); if (!newcap) return OutOfMemory; newcap->vtable = cap->vtable; newcap->base_cap = cap->base_cap; newcap->start_cap = cap->start_cap; newcap->end_cap = cap->end_cap; newcap->stroke_join = cap->stroke_join; newcap->base_inset = cap->base_inset; newcap->width_scale = cap->width_scale; if (cap->fill_path) { if (GdipClonePath (cap->fill_path, &fillpath) != Ok) { if (fillpath != NULL) GdipFree (fillpath); GdipFree (newcap); return OutOfMemory; } } newcap->fill_path = fillpath; if (cap->stroke_path) { if (GdipClonePath (cap->stroke_path, &strokepath) != Ok) { if (strokepath != NULL) GdipFree (strokepath); GdipFree (fillpath); GdipFree (newcap); return OutOfMemory; } } newcap->stroke_path = strokepath; *clonedCap = newcap; return Ok; } GpStatus gdip_custom_linecap_destroy (GpCustomLineCap *cap) { if (!cap) return InvalidParameter; if (cap->fill_path) { GdipDeletePath (cap->fill_path); cap->fill_path = NULL; } if (cap->stroke_path) { GdipDeletePath (cap->stroke_path); cap->stroke_path = NULL; } GdipFree (cap); return Ok; } /* MonoTODO: Implement this function when cairo supports cairo_stroke_path API */ static GpStatus gdip_custom_linecap_setup (GpGraphics *graphics, GpCustomLineCap *customCap) { if (!graphics || !customCap) return InvalidParameter; return NotImplemented; } double gdip_custom_linecap_angle (float x, float y, float otherend_x, float otherend_y) { float slope; double angle; if (x == otherend_x) { slope = 0; if (y < otherend_y) { angle = PI; } else { angle = PI * 2; } } else if (y == otherend_y) { slope = 0; if (x < otherend_x) { angle = PI/2; } else { angle = PI/-2; } } else { if (y < otherend_y) { slope = (otherend_y - y) / (otherend_x - x); if (x < otherend_x) { angle = PI/2; } else { angle = PI/-2; } } else { slope = (otherend_x - x) / (y - otherend_y); angle = 0; } } angle += atan (slope); return angle; } GpStatus gdip_custom_linecap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *customCap, float x, float y, float otherend_x, float otherend_y) { double angle; int points; int i, idx = 0; float penwidth; if (!graphics || !pen || !customCap) return InvalidParameter; penwidth = pen->width; angle = gdip_custom_linecap_angle (x, y, otherend_x, otherend_y); cairo_save (graphics->ct); /* FIXME: handle base_inset (including set/get!) */ cairo_translate (graphics->ct, x, y); cairo_rotate (graphics->ct, angle); if (customCap->stroke_path) { GpPath *path = customCap->stroke_path; points = path->count; for (i = 0; i < points; i++) { /* Adapted from gdip_plot_path() */ GpPointF point = g_array_index (path->points, GpPointF, i); BYTE type = g_array_index (path->types, BYTE, i); GpPointF pts [3]; /* mask the bits so that we get only the type value not the other flags */ switch (type & PathPointTypePathTypeMask) { case PathPointTypeStart: gdip_cairo_move_to (graphics, point.X * penwidth, point.Y * penwidth, TRUE, TRUE); break; case PathPointTypeLine: gdip_cairo_line_to (graphics, point.X * penwidth, point.Y * penwidth, TRUE, TRUE); break; case PathPointTypeBezier: /* make sure we only add at most 3 points to pts */ if (idx < 3) { pts [idx] = point; idx ++; } /* once we've added 3 pts, we can draw the curve */ if (idx == 3) { gdip_cairo_curve_to (graphics, pts[0].X * penwidth, pts[0].Y * penwidth, pts[1].X * penwidth, pts[1].Y * penwidth, pts[2].X * penwidth, pts[2].Y * penwidth, TRUE, TRUE); idx = 0; } break; default: g_warning ("Unknown PathPointType %d", type); return NotImplemented; } /* close the subpath */ if (type & PathPointTypeCloseSubpath) { cairo_close_path (graphics->ct); } } gdip_pen_setup (graphics, pen); cairo_stroke (graphics->ct); cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); } /* FIXME: handle fill_path */ cairo_restore (graphics->ct); return gdip_get_status (cairo_status (graphics->ct)); } /* this setup function gets called from pen */ GpStatus gdip_linecap_setup (GpGraphics *graphics, GpCustomLineCap *customCap) { if (!graphics || !customCap) return InvalidParameter; return customCap->vtable->setup (graphics, customCap); } /* this draw function gets called from pen */ GpStatus gdip_linecap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *customCap, float x, float y, float otherend_x, float otherend_y) { if (!graphics || !pen || !customCap) return InvalidParameter; return customCap->vtable->draw (graphics, pen, customCap, x, y, otherend_x, otherend_y); } /* CustomLineCap functions */ // coverity[+alloc : arg-*4] GpStatus GdipCreateCustomLineCap (GpPath *fillPath, GpPath *strokePath, GpLineCap baseCap, float baseInset, GpCustomLineCap **customCap) { GpCustomLineCap *cap; GpPath *fillpath_clone = NULL, *strokepath_clone = NULL; if ((!fillPath && !strokePath) || !customCap) return InvalidParameter; cap = gdip_custom_linecap_new (); if (!cap) return OutOfMemory; if (fillPath) { if (GdipClonePath (fillPath, &fillpath_clone) != Ok) { if (fillpath_clone != NULL) GdipFree (fillpath_clone); GdipFree (cap); return OutOfMemory; } } cap->fill_path = fillpath_clone; if (strokePath) { if (GdipClonePath (strokePath, &strokepath_clone) != Ok) { if (strokepath_clone != NULL) GdipFree (strokepath_clone); GdipFree (fillpath_clone); GdipFree (cap); return OutOfMemory; } } cap->stroke_path = strokepath_clone; cap->base_cap = baseCap; cap->base_inset = baseInset; *customCap = cap; return Ok; } GpStatus GdipDeleteCustomLineCap (GpCustomLineCap *customCap) { if (!customCap) return InvalidParameter; return customCap->vtable->destroy (customCap); } GpStatus GdipCloneCustomLineCap (GpCustomLineCap *customCap, GpCustomLineCap **clonedCap) { if (!customCap || !clonedCap) return InvalidParameter; return customCap->vtable->clone_cap (customCap, clonedCap); } GpStatus GdipSetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap startCap, GpLineCap endCap) { if (!customCap) return InvalidParameter; customCap->start_cap = startCap; customCap->end_cap = endCap; return Ok; } GpStatus GdipGetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap *startCap, GpLineCap *endCap) { if (!customCap || !startCap || !endCap) return InvalidParameter; *(startCap) = customCap->start_cap; *(endCap) = customCap->end_cap; return Ok; } GpStatus GdipSetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin lineJoin) { if (!customCap) return InvalidParameter; customCap->stroke_join = lineJoin; return Ok; } GpStatus GdipGetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin *lineJoin) { if (!customCap || !lineJoin) return InvalidParameter; *(lineJoin) = customCap->stroke_join; return Ok; } GpStatus GdipSetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap baseCap) { if (!customCap) return InvalidParameter; customCap->base_cap = baseCap; return Ok; } GpStatus GdipGetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap *baseCap) { if (!customCap || !baseCap) return InvalidParameter; *(baseCap) = customCap->base_cap; return Ok; } GpStatus GdipSetCustomLineCapBaseInset (GpCustomLineCap *customCap, float inset) { if (!customCap) return InvalidParameter; customCap->base_inset = inset; return Ok; } GpStatus GdipGetCustomLineCapBaseInset (GpCustomLineCap *customCap, float *inset) { if (!customCap || !inset) return InvalidParameter; *(inset) = customCap->base_inset; return Ok; } GpStatus GdipSetCustomLineCapWidthScale (GpCustomLineCap *customCap, float widthScale) { if (!customCap) return InvalidParameter; customCap->width_scale = widthScale; return Ok; } GpStatus GdipGetCustomLineCapWidthScale (GpCustomLineCap *customCap, float *widthScale) { if (!customCap || !widthScale) return InvalidParameter; *(widthScale) = customCap->width_scale; return Ok; } libgdiplus-4.2/src/icocodec.c0000664000175000017500000002462212377405421013156 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "gdiplus-private.h" #include "icocodec.h" GUID gdip_ico_image_format_guid = {0xb96b3cb5U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; /* Codecinfo related data*/ static ImageCodecInfo ico_codec; static const WCHAR ico_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'I', 'C', 'O', 0}; /* Built-in ICO */ static const WCHAR ico_extension[] = {'*','.','I', 'C', 'O', 0}; /* *.ICO */ static const WCHAR ico_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'x', '-', 'i', 'c', 'o', 'n', 0}; /* image/x-icon */ static const WCHAR ico_format[] = {'I', 'C', 'O', 0}; /* ICO */ static const BYTE ico_sig_pattern[] = { 0x00, 0x00, 0x01, 0x00 }; static const BYTE ico_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF }; ImageCodecInfo* gdip_getcodecinfo_ico () { ico_codec.Clsid = (CLSID) { 0x557cf407, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; ico_codec.FormatID = gdip_ico_image_format_guid; ico_codec.CodecName = (const WCHAR*) ico_codecname; ico_codec.DllName = NULL; ico_codec.FormatDescription = (const WCHAR*) ico_format; ico_codec.FilenameExtension = (const WCHAR*) ico_extension; ico_codec.MimeType = (const WCHAR*) ico_mimetype; ico_codec.Flags = ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; ico_codec.Version = 1; ico_codec.SigCount = 1; ico_codec.SigSize = 4; ico_codec.SigPattern = ico_sig_pattern; ico_codec.SigMask = ico_sig_mask; return &ico_codec; } static BYTE get_ico_data (BYTE *data, int x, int y, int bpp, int line_length) { BYTE result = 0; BYTE *line_data = data + y * line_length; switch (bpp) { case 1: result = (line_data [x >> 3] >> (7 - (x & 7))) & 0x01; break; case 4: result = line_data [x >> 1]; if ((x & 1) == 1) result &= 0x0F; else result >>= 4; break; case 8: result = line_data [x]; break; } return result; } static BOOL read_ICONDIRENTRY (void *pointer, ICONDIRENTRY *entry, ImageSource source, BOOL decode) { if (gdip_read_ico_data (pointer, (void*)entry, sizeof (ICONDIRENTRY), source) != sizeof (ICONDIRENTRY)) return FALSE; #if WORDS_BIGENDIAN if (decode) { BYTE *b; /* entry->bWidth, bHeight, bColorCount, bReserved are all BYTE, no change required */ b = (BYTE*)&entry->wPlanes; entry->wPlanes = (b[1] << 8) | b[0]; b = (BYTE*)&entry->wBitCount; entry->wBitCount = (b[1] << 8) | b[0]; b = (BYTE*)&entry->dwBytesInRes; entry->dwBytesInRes = (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]; b = (BYTE*)&entry->dwImageOffset; entry->dwImageOffset = (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]; } #endif return TRUE; } static GpStatus gdip_read_ico_image_from_file_stream (void *pointer, GpImage **image, ImageSource source) { GpStatus status = InvalidParameter; GpBitmap *result = NULL; BYTE *pixels = NULL; WORD w, count; void *p = &w; BYTE *b = (BYTE*)&w; ICONDIRENTRY entry; int i, pos; BOOL upsidedown = TRUE; BOOL os2format = FALSE; BITMAPINFOHEADER bih; int palette_entries = -1; ARGB *colors = NULL; int x, y; int line_xor_length, xor_size; int line_and_length, and_size; BYTE *xor_data = NULL, *and_data = NULL; /* WORD ICONDIR.idReserved / reversed, MUST be 0 */ if (gdip_read_ico_data (pointer, p, sizeof (WORD), source) != sizeof (WORD)) goto error; if (w != 0) goto error; /* WORD ICONDIR.idType / resource type, MUST be 1 for icons */ if (gdip_read_ico_data (pointer, p, sizeof (WORD), source) != sizeof (WORD)) goto error; i = (b[1] << 8 | b[0]); if (i != 1) goto error; /* WORD ICONDIR.idCount / number of icons, must be greater than 0 */ if (gdip_read_ico_data (pointer, p, sizeof (WORD), source) != sizeof (WORD)) goto error; count = (b[1] << 8 | b[0]); if (count < 1) goto error; pos = 6; /* * NOTE: it looks like (from unit tests) that we get the last icon * (e.g. it can return the 16 pixel version, instead of the 32 or 48 pixels available in the same file) */ for (i = 0; i < count - 1; i++) { if (!read_ICONDIRENTRY (pointer, &entry, source, FALSE)) goto error; pos += sizeof (ICONDIRENTRY); } /* last one is important, so we must decode (endianess) it's values */ if (!read_ICONDIRENTRY (pointer, &entry, source, TRUE)) goto error; pos += sizeof (ICONDIRENTRY); while (pos < entry.dwImageOffset) { if (gdip_read_ico_data (pointer, p, sizeof (WORD), source) != sizeof (WORD)) goto error; pos += sizeof (WORD); } /* BITMAPINFOHEADER */ status = gdip_read_BITMAPINFOHEADER (pointer, &bih, source, &os2format, &upsidedown); if (status != Ok) goto error; result = gdip_bitmap_new_with_frame (NULL, TRUE); result->type = ImageTypeBitmap; result->image_format = ICON; result->active_bitmap->pixel_format = PixelFormat32bppARGB; /* icons are always promoted to 32 bbp */ result->active_bitmap->width = entry.bWidth; result->active_bitmap->height = entry.bHeight; result->active_bitmap->stride = result->active_bitmap->width * 4; /* Ensure 32bits alignment */ gdip_align_stride (result->active_bitmap->stride); result->active_bitmap->dpi_horz = 96.0f; result->active_bitmap->dpi_vert = 96.0f; switch (bih.biBitCount) { case 1: case 4: case 8: /* support 2, 16 and 256 colors icons, with palettes, no compression */ if (bih.biCompression == 0) palette_entries = 1 << bih.biBitCount; break; case 24: /* support 24bits + alpha bitmap, this is not documented anywhere but Windows accept them as valid */ case 32: /* support 24bits + 8 bits alpha (aka "XP" icons), no palette, no compression */ if (bih.biCompression == 0) palette_entries = 0; break; } if (palette_entries < 0) { g_warning ("Unknown icon format, bitcount = %d, compression = %d", bih.biBitCount, bih.biCompression); status = InvalidParameter; goto error; } /* * Strangely, even if we're supplying a 32bits ARGB image, * the icon's palette is also supplied with the image. */ result->active_bitmap->palette = GdipAlloc (sizeof(ColorPalette) + sizeof(ARGB) * palette_entries); if (result->active_bitmap->palette == NULL) { status = OutOfMemory; goto error; } result->active_bitmap->palette->Flags = 0; result->active_bitmap->palette->Count = palette_entries; for (i = 0; i < palette_entries; i++) { /* colors are stored as R, G, B and reserved (always 0) */ BYTE color[4]; void *p = &color; if (gdip_read_ico_data (pointer, p, 4, source) < 4) { status = InvalidParameter; goto error; } set_pixel_bgra (result->active_bitmap->palette->Entries, i * 4, (color[0] & 0xFF), /* B */ (color[1] & 0xFF), /* G */ (color[2] & 0xFF), /* R */ 0xFF); /* Alpha */ } /* * Let's build the 32bpp ARGB bitmap from the icon's XOR and AND bitmaps * notes: * - XORBitmap can be a 1, 4 or 8 bpp bitmap * - ANDBitmap is *always* a monochrome (1bpp) bitmap * - in every case each line is padded to 32 bits boundary */ pixels = GdipAlloc (result->active_bitmap->stride * result->active_bitmap->height); if (pixels == NULL) { status = OutOfMemory; goto error; } result->active_bitmap->scan0 = pixels; result->active_bitmap->reserved = GBD_OWN_SCAN0; result->active_bitmap->image_flags = ImageFlagsReadOnly | ImageFlagsHasRealPixelSize | ImageFlagsColorSpaceRGB | ImageFlagsHasAlpha; line_xor_length = (((bih.biBitCount * entry.bWidth + 31) & ~31) >> 3); xor_size = line_xor_length * entry.bHeight; xor_data = (BYTE*) GdipAlloc (xor_size); if (!xor_data) { status = OutOfMemory; goto error; } if (gdip_read_ico_data (pointer, xor_data, xor_size, source) < xor_size) { status = InvalidParameter; goto error; } line_and_length = (((entry.bWidth + 31) & ~31) >> 3); and_size = line_and_length * entry.bHeight; and_data = (BYTE*) GdipAlloc (and_size); if (!and_data) { status = OutOfMemory; goto error; } if (gdip_read_ico_data (pointer, and_data, and_size, source) < and_size) { status = InvalidParameter; goto error; } colors = result->active_bitmap->palette->Entries; for (y = 0; y < entry.bHeight; y++) { for (x = 0; x < entry.bWidth; x++) { ARGB color; if (palette_entries > 0) { color = colors [get_ico_data (xor_data, x, y, bih.biBitCount, line_xor_length)]; if (get_ico_data (and_data, x, y, 1, line_and_length) == 1) color &= 0x00FFFFFF; } else if (bih.biBitCount == 24) { /* take 1bpp alpha from the and_data */ if (get_ico_data (and_data, x, y, 1, line_and_length) == 1) { color = 0; } else { BYTE *line_data = xor_data + y * line_xor_length + x * 3; color = 0xFF000000 | (line_data [0] | line_data [1] << 8| line_data [2] << 16); } } else { BYTE *line_data = xor_data + y * line_xor_length + x * 4; /* ARGB to BRGA */ color = (line_data [0] | line_data [1] << 8 | line_data [2] << 16 | line_data [3] << 24); } /* image is reversed (y) */ GdipBitmapSetPixel (result, x, entry.bHeight - y - 1, color); } } GdipFree (xor_data); GdipFree (and_data); *image = result; return Ok; error: if (result) GdipDisposeImage (result); if (xor_data) GdipFree (xor_data); if (and_data) GdipFree (and_data); return status; } GpStatus gdip_load_ico_image_from_file (FILE *fp, GpImage **image) { return gdip_read_ico_image_from_file_stream ((void*)fp, image, File); } GpStatus gdip_load_ico_image_from_stream_delegate (dstream_t *loader, GpImage **image) { return gdip_read_ico_image_from_file_stream ((void *)loader, image, DStream); } libgdiplus-4.2/src/metafile.h0000664000175000017500000001404112377405421013173 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __METAFILE_H__ #define __METAFILE_H__ typedef enum { MetafileTypeInvalid, MetafileTypeWmf, MetafileTypeWmfPlaceable, MetafileTypeEmf, MetafileTypeEmfPlusOnly, MetafileTypeEmfPlusDual } MetafileType; typedef enum { EmfTypeEmfOnly = MetafileTypeEmf, EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly, EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual } EmfType; typedef enum { MetafileFrameUnitPixel = UnitPixel, MetafileFrameUnitPoint = UnitPoint, MetafileFrameUnitInch = UnitInch, MetafileFrameUnitDocument = UnitDocument, MetafileFrameUnitMillimeter = UnitMillimeter, MetafileFrameUnitGdi } MetafileFrameUnit; typedef enum { EmfRecordTypeGdiComment = 70, EmfPlusRecordTypeHeader = 16385, EmfPlusRecordTypeEndOfFile = 16386, EmfPlusRecordTypeClear = 16393, EmfPlusRecordTypeFillRects = 16394, } EmfPlusRecordType; typedef BOOL (*EnumerateMetafileProc) (EmfPlusRecordType, UINT, UINT, const BYTE*, void*); /* function prototypes */ GpStatus GdipCreateMetafileFromWmf (HMETAFILE hWmf, BOOL deleteWmf, GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, GpMetafile **metafile); GpStatus GdipCreateMetafileFromEmf (HENHMETAFILE hEmf, BOOL deleteEmf, GpMetafile **metafile); GpStatus GdipCreateMetafileFromFile (GDIPCONST WCHAR *file, GpMetafile **metafile); GpStatus GdipCreateMetafileFromWmfFile (GDIPCONST WCHAR *file, GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, GpMetafile **metafile); GpStatus GdipCreateMetafileFromStream (void *stream, GpMetafile **metafile); GpStatus GdipCreateMetafileFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpMetafile **metafile); GpStatus GdipGetMetafileHeaderFromWmf (HMETAFILE hWmf, GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header); GpStatus GdipGetMetafileHeaderFromEmf (HENHMETAFILE hEmf, MetafileHeader *header); GpStatus GdipGetMetafileHeaderFromFile (GDIPCONST WCHAR *filename, MetafileHeader *header); GpStatus GdipGetMetafileHeaderFromStream (void *stream, MetafileHeader *header); GpStatus GdipGetMetafileHeaderFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, MetafileHeader *header); GpStatus GdipGetMetafileHeaderFromMetafile (GpMetafile *metafile, MetafileHeader *header); GpStatus GdipGetHemfFromMetafile (GpMetafile *metafile, HENHMETAFILE *hEmf); GpStatus GdipGetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT *metafileRasterizationLimitDpi); GpStatus GdipSetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT metafileRasterizationLimitDpi); GpStatus GdipPlayMetafileRecord (GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE* data); GpStatus GdipRecordMetafile (HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileI (HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileFileName (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); /* extra public (exported) functions in libgdiplus to replace the IStream (COM-based) ones available on Windows */ GpStatus GdipRecordMetafileFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); GpStatus GdipRecordMetafileFromDelegateI_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile); #endif libgdiplus-4.2/src/texturebrush.c0000664000175000017500000006047012377405421014153 00000000000000/* * texturebrush.c * * Copyright (C) 2003,2006-2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * TODO * reduce duplication between draw_tile*_texture functions */ #include "texturebrush-private.h" #include "graphics-private.h" #include "bitmap-private.h" #include "matrix-private.h" static GpStatus gdip_texture_setup (GpGraphics *graphics, GpBrush *brush); static GpStatus gdip_texture_clone (GpBrush *brush, GpBrush **clonedBrush); static GpStatus gdip_texture_destroy (GpBrush *brush); /* * we have a single copy of vtable for * all instances of texturebrush. */ static BrushClass vtable = { BrushTypeTextureFill, gdip_texture_setup, gdip_texture_clone, gdip_texture_destroy }; static cairo_content_t from_cairoformat_to_content (cairo_format_t format) { switch (format) { case CAIRO_FORMAT_RGB24: return CAIRO_CONTENT_COLOR; case CAIRO_FORMAT_A8: return CAIRO_CONTENT_ALPHA; case CAIRO_FORMAT_ARGB32: default: return CAIRO_CONTENT_COLOR_ALPHA; } } static void gdip_texture_init (GpTexture *texture) { gdip_brush_init (&texture->base, &vtable); texture->wrapMode = WrapModeTile; texture->rectangle.X = 0; texture->rectangle.Y = 0; texture->rectangle.Width = 0; texture->rectangle.Height = 0; texture->pattern = NULL; cairo_matrix_init_identity (&texture->matrix); } static GpTexture* gdip_texture_new (void) { GpTexture *result = (GpTexture *) GdipAlloc (sizeof (GpTexture)); if (result) gdip_texture_init (result); return result; } /* * functions to create different wrapmodes. */ static GpStatus draw_tile_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) { cairo_surface_t *original = NULL; cairo_surface_t *texture; cairo_pattern_t *pat; GpStatus status; GpRect *rect = &brush->rectangle; cairo_t *ct2; BYTE *premul = NULL; if (!rect) return InvalidParameter; gdip_bitmap_ensure_surface (bitmap); if (gdip_bitmap_format_needs_premultiplication (bitmap)) { premul = gdip_bitmap_get_premultiplied_scan0 (bitmap); if (premul) { BitmapData *data = bitmap->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = bitmap->surface; /* Use the original as a pattern */ pat = cairo_pattern_create_for_surface (original); status = gdip_get_pattern_status (pat); if (status != Ok) goto cleanup; cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); /* texture surface to be created */ texture = cairo_surface_create_similar (original, from_cairoformat_to_content (bitmap->cairo_format), rect->Width, rect->Height); status = gdip_get_status (cairo_surface_status (texture)); if (status != Ok) { cairo_pattern_destroy (pat); goto cleanup; } /* Draw the texture */ ct2 = cairo_create (texture); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); cairo_destroy (ct2); brush->pattern = cairo_pattern_create_for_surface (texture); status = gdip_get_pattern_status (brush->pattern); if (status == Ok) cairo_pattern_set_extend (brush->pattern, CAIRO_EXTEND_REPEAT); cairo_pattern_destroy (pat); cairo_surface_destroy (texture); status = gdip_get_status (cairo_status (ct)); cleanup: if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return status; } static GpStatus draw_tile_flipX_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) { cairo_surface_t *original = NULL; cairo_surface_t *texture; cairo_pattern_t *pat; GpRect *rect = &brush->rectangle; GpStatus status; cairo_t *ct2; cairo_matrix_t tempMatrix; BYTE *premul = NULL; if (!rect) return InvalidParameter; gdip_bitmap_ensure_surface (bitmap); if (gdip_bitmap_format_needs_premultiplication (bitmap)) { premul = gdip_bitmap_get_premultiplied_scan0 (bitmap); if (premul) { BitmapData *data = bitmap->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = bitmap->surface; /* Use the original as a pattern */ pat = cairo_pattern_create_for_surface (original); status = gdip_get_pattern_status (pat); if (status != Ok) goto cleanup; cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); /* texture surface to be created */ texture = cairo_surface_create_similar (original, from_cairoformat_to_content (bitmap->cairo_format), 2 * rect->Width, rect->Height); status = gdip_get_status (cairo_surface_status (texture)); if (status != Ok) { cairo_pattern_destroy (pat); goto cleanup; } /* Draw left part of the texture */ ct2 = cairo_create (texture); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); /* Not sure if this is a bug, but using rect->Width - 1 avoids the seam. */ cairo_matrix_init_identity (&tempMatrix); cairo_matrix_translate (&tempMatrix, rect->Width - 1, 0); /* scale in -X direction to flip along X */ cairo_matrix_scale (&tempMatrix, -1.0, 1.0); cairo_pattern_set_matrix (pat, &tempMatrix); /* Draw right part of the texture */ cairo_set_source (ct2, pat); cairo_rectangle (ct2, rect->Width, 0, rect->Width, rect->Height); cairo_fill (ct2); cairo_destroy (ct2); brush->pattern = cairo_pattern_create_for_surface (texture); status = gdip_get_pattern_status (brush->pattern); if (status == Ok) cairo_pattern_set_extend (brush->pattern, CAIRO_EXTEND_REPEAT); cairo_pattern_destroy (pat); cairo_surface_destroy (texture); status = gdip_get_status (cairo_status (ct)); cleanup: if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return status; } static GpStatus draw_tile_flipY_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) { cairo_surface_t *original = NULL; cairo_surface_t *texture; cairo_pattern_t *pat; GpMatrix tempMatrix; GpRect *rect = &brush->rectangle; GpStatus status; cairo_t *ct2; BYTE *premul = NULL; if (!rect) return InvalidParameter; gdip_bitmap_ensure_surface (bitmap); if (gdip_bitmap_format_needs_premultiplication (bitmap)) { premul = gdip_bitmap_get_premultiplied_scan0 (bitmap); if (premul) { BitmapData *data = bitmap->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = bitmap->surface; /* Use the original as a pattern */ pat = cairo_pattern_create_for_surface (original); status = gdip_get_pattern_status (pat); if (status != Ok) goto cleanup; cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); /* texture surface to be created */ texture = cairo_surface_create_similar (original, from_cairoformat_to_content (bitmap->cairo_format), rect->Width, 2 * rect->Height); status = gdip_get_status (cairo_surface_status (texture)); if (status != Ok) { cairo_pattern_destroy (pat); goto cleanup; } /* Draw upper part of the texture */ ct2 = cairo_create (texture); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); /* Not sure if this is a bug, but using rect->Height - 1 avoids the seam. */ cairo_matrix_init_identity (&tempMatrix); cairo_matrix_translate (&tempMatrix, 0, rect->Height - 1); /* scale in -Y direction to flip along Y */ cairo_matrix_scale (&tempMatrix, 1.0, -1.0); cairo_pattern_set_matrix (pat, &tempMatrix); /* Draw lower part of the texture */ cairo_translate (ct2, 0, rect->Height); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); cairo_destroy(ct2); brush->pattern = cairo_pattern_create_for_surface (texture); status = gdip_get_pattern_status (brush->pattern); if (status != Ok) { cairo_pattern_destroy (pat); cairo_surface_destroy (texture); goto cleanup; } cairo_pattern_set_extend (brush->pattern, CAIRO_EXTEND_REPEAT); cairo_pattern_destroy (pat); cairo_surface_destroy (texture); status = gdip_get_status (cairo_status (ct)); cleanup: if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return status; } static GpStatus draw_tile_flipXY_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) { cairo_surface_t *original = NULL; cairo_surface_t *texture; cairo_pattern_t *pat; GpMatrix tempMatrix; GpRect *rect = &brush->rectangle; GpStatus status; cairo_t *ct2; BYTE *premul = NULL; if (!rect) return InvalidParameter; gdip_bitmap_ensure_surface (bitmap); if (gdip_bitmap_format_needs_premultiplication (bitmap)) { premul = gdip_bitmap_get_premultiplied_scan0 (bitmap); if (premul) { BitmapData *data = bitmap->active_bitmap; original = cairo_image_surface_create_for_data (premul, CAIRO_FORMAT_ARGB32, data->width, data->height, data->stride); } } /* if premul isn't required (or couldn't be computed, e.g. out of memory) */ if (!original) original = bitmap->surface; /* Use the original as a pattern */ pat = cairo_pattern_create_for_surface (original); status = gdip_get_pattern_status(pat); if (status != Ok) goto cleanup; cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); /* texture surface to be created */ texture = cairo_surface_create_similar (original, from_cairoformat_to_content (bitmap->cairo_format), 2 * rect->Width, 2 * rect->Height); status = gdip_get_status (cairo_surface_status (texture)); if (status != Ok) { cairo_pattern_destroy (pat); goto cleanup; } /* Draw upper left part of the texture */ ct2 = cairo_create (texture); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); /* Not sure if this is a bug, but using rect->Height - 1 avoids the seam. */ cairo_matrix_init_identity (&tempMatrix); cairo_matrix_translate (&tempMatrix, 0, rect->Height - 1); /* scale in -Y direction to flip along Y */ cairo_matrix_scale (&tempMatrix, 1.0, -1.0); cairo_pattern_set_matrix (pat, &tempMatrix); /* Draw lower left part of the texture */ cairo_translate (ct2, 0, rect->Height); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); /* Reset the pattern matrix and do fresh transformation */ cairo_matrix_init_identity (&tempMatrix); /* Not sure if this is a bug, but using rect->Width - 1 avoids the seam. */ cairo_matrix_translate (&tempMatrix, rect->Width - 1, 0); /* scale in -X direction to flip along X */ cairo_matrix_scale (&tempMatrix, -1.0, 1.0); cairo_pattern_set_matrix (pat, &tempMatrix); /* Draw upper right part of the texture */ cairo_translate (ct2, rect->Width, -rect->Height); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); /* Not sure if this is a bug, but using rect->Height - 1 avoids the seam. */ cairo_matrix_translate (&tempMatrix, 0, rect->Height - 1); /* scale in -Y direction to flip along Y */ cairo_matrix_scale (&tempMatrix, 1.0, -1.0); cairo_pattern_set_matrix (pat, &tempMatrix); /* Draw lower right part of the texture */ cairo_translate (ct2, 0, rect->Height); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); cairo_destroy(ct2); brush->pattern = cairo_pattern_create_for_surface (texture); status = gdip_get_pattern_status(brush->pattern); if (status != Ok) { cairo_pattern_destroy (pat); cairo_surface_destroy (texture); goto cleanup; } cairo_pattern_set_extend (brush->pattern, CAIRO_EXTEND_REPEAT); cairo_pattern_destroy (pat); cairo_surface_destroy (texture); status = gdip_get_status (cairo_status (ct)); cleanup: if (premul) { cairo_surface_destroy (original); GdipFree (premul); } return status; } static GpStatus draw_clamp_texture (cairo_t *ct, GpBitmap *bitmap, GpTexture *brush) { cairo_surface_t *original; cairo_surface_t *texture; cairo_pattern_t *pat; GpRect *rect = &brush->rectangle; GpStatus status; cairo_t *ct2; /* Original image surface */ gdip_bitmap_ensure_surface (bitmap); original = bitmap->surface; /* Use the original as a pattern */ pat = cairo_pattern_create_for_surface (original); status = gdip_get_pattern_status (pat); if (status != Ok) { return status; } cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); /* texture surface to be created */ texture = cairo_surface_create_similar (original, from_cairoformat_to_content (bitmap->cairo_format), rect->Width, rect->Height); if (texture == NULL) { cairo_pattern_destroy (pat); return OutOfMemory; } /* Draw the texture */ ct2 = cairo_create (texture); cairo_identity_matrix (ct2); cairo_set_source (ct2, pat); cairo_rectangle (ct2, 0, 0, rect->Width, rect->Height); cairo_fill (ct2); cairo_destroy(ct2); brush->pattern = cairo_pattern_create_for_surface (texture); status = gdip_get_pattern_status (brush->pattern); if (status != Ok) { cairo_pattern_destroy (pat); cairo_surface_destroy (texture); return status; } cairo_pattern_destroy (pat); cairo_surface_destroy (texture); return gdip_get_status (cairo_status (ct)); } GpStatus gdip_texture_setup (GpGraphics *graphics, GpBrush *brush) { cairo_t *ct; cairo_pattern_t *pattern; GpTexture *texture; GpImage *img; GpStatus status = Ok; BOOL dispose_bitmap; if (!graphics || !brush || !graphics->ct) return InvalidParameter; texture = (GpTexture *) brush; img = texture->image; if (!img) return InvalidParameter; if (img->type != ImageTypeBitmap) return NotImplemented; if (gdip_is_an_indexed_pixelformat (img->active_bitmap->pixel_format)) { /* Unable to create a surface for the bitmap; it is an indexed image. * Instead, it will first be converted to 32-bit RGB. */ img = gdip_convert_indexed_to_rgb (img); if (img == NULL) { return OutOfMemory; } gdip_bitmap_ensure_surface (img); dispose_bitmap = TRUE; } else { dispose_bitmap = FALSE; } ct = graphics->ct; /* We create the new pattern for brush, if the brush is changed * or if pattern has not been created yet. */ if (texture->base.changed || (texture->pattern == NULL)) { if (texture->pattern != NULL) { cairo_pattern_destroy (texture->pattern); } switch (texture->wrapMode) { case WrapModeTile: status = draw_tile_texture (ct, img, texture); break; case WrapModeTileFlipX: status = draw_tile_flipX_texture (ct, img, texture); break; case WrapModeTileFlipY: status = draw_tile_flipY_texture (ct, img, texture); break; case WrapModeTileFlipXY: status = draw_tile_flipXY_texture (ct, img, texture); break; case WrapModeClamp: status = draw_clamp_texture (ct, img, texture); break; default: status = InvalidParameter; } } if (dispose_bitmap) { GdipDisposeImage((GpImage *)img); } if ((status != Ok) || (gdip_get_pattern_status(texture->pattern) != Ok)) { return GenericError; } pattern = texture->pattern; if (pattern != NULL) { /* got something to apply ? */ if (!gdip_is_matrix_empty (&texture->matrix)) { cairo_matrix_t product; gdip_cairo_matrix_copy (&product, &texture->matrix); cairo_matrix_invert (&product); cairo_pattern_set_matrix (pattern, &product); } cairo_set_source (ct, pattern); } return gdip_get_status (cairo_status (ct)); } GpStatus gdip_texture_clone (GpBrush *brush, GpBrush **clonedBrush) { GpTexture *result; GpTexture *texture; GpStatus status; if (!brush || !clonedBrush) return InvalidParameter; result = (GpTexture *) GdipAlloc (sizeof (GpTexture)); if (result == NULL) { return OutOfMemory; } texture = (GpTexture *) brush; result->base = texture->base; result->wrapMode = texture->wrapMode; /* Let the clone create its own pattern. */ result->pattern = NULL; result->base.changed = TRUE; gdip_cairo_matrix_copy (&result->matrix, &texture->matrix); result->rectangle.X = texture->rectangle.X; result->rectangle.Y = texture->rectangle.Y; result->rectangle.Width = texture->rectangle.Width; result->rectangle.Height = texture->rectangle.Height; result->image = NULL; status = GdipCloneImage (texture->image, &result->image); if (status != Ok) { if (result->image) GdipDisposeImage (result->image); GdipFree (result); result = NULL; } else { cairo_surface_reference (result->image->surface); } *clonedBrush = (GpBrush *) result; return status; } GpStatus gdip_texture_destroy (GpBrush *brush) { /* a. the NULL check for brush is done by the caller, GdipDeleteBrush */ /* b. brush itself is freed by the caller */ GpTexture *texture = (GpTexture *) brush; if (texture->pattern) { cairo_pattern_destroy (texture->pattern); texture->pattern = NULL; } if (texture->image) { GdipDisposeImage (texture->image); texture->image = NULL; } return Ok; } /* coverity[+alloc : arg-*2] */ GpStatus GdipCreateTexture (GpImage *image, GpWrapMode wrapMode, GpTexture **texture) { cairo_surface_t *imageSurface = NULL; GpTexture *result; GpStatus status; if (!image || !texture) return InvalidParameter; if ((wrapMode < WrapModeTile) || (wrapMode > WrapModeClamp)) return OutOfMemory; if (image->type != ImageTypeBitmap) return NotImplemented; result = gdip_texture_new (); if (!result) return OutOfMemory; result->image = NULL; status = GdipCloneImage (image, &result->image); if (status != Ok) goto failure; /* note: we must keep the scan0 alive, so we must use the cloned image (and not the original) see bug #80971 */ imageSurface = cairo_image_surface_create_for_data ((BYTE*)result->image->active_bitmap->scan0, image->cairo_format, image->active_bitmap->width, image->active_bitmap->height, image->active_bitmap->stride); if (!imageSurface) goto failure; result->wrapMode = wrapMode; if (result->image->surface) cairo_surface_destroy (result->image->surface); result->image->surface = imageSurface; result->rectangle.X = 0; result->rectangle.Y = 0; result->rectangle.Width = image->active_bitmap->width; result->rectangle.Height = image->active_bitmap->height; *texture = result; return Ok; failure: if (result->image) GdipDisposeImage (result->image); if (imageSurface) cairo_surface_destroy (imageSurface); GdipFree (result); *texture = NULL; return status; } /* coverity[+alloc : arg-*6] */ GpStatus GdipCreateTexture2 (GpImage *image, GpWrapMode wrapMode, float x, float y, float width, float height, GpTexture **texture) { return GdipCreateTexture2I (image, wrapMode, (int) x, (int) y, (int) width, (int) height, texture); } /* coverity[+alloc : arg-*6] */ GpStatus GdipCreateTexture2I (GpImage *image, GpWrapMode wrapMode, int x, int y, int width, int height, GpTexture **texture) { int bmpWidth; int bmpHeight; GpStatus status; GpImage *resized_image = NULL; if (!image || !texture) return InvalidParameter; if (image->type != ImageTypeBitmap) return NotImplemented; bmpWidth = image->active_bitmap->width; bmpHeight = image->active_bitmap->height; /* MS behaves this way */ if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0) || (bmpWidth < (x + width)) || (bmpHeight < (y + height))) return OutOfMemory; status = GdipCloneBitmapAreaI (x, y, width, height, image->active_bitmap->pixel_format, image, &resized_image); if (status != Ok) return status; status = GdipCreateTexture (resized_image, wrapMode, texture); GdipDisposeImage (resized_image); return status; } /* coverity[+alloc : arg-*6] */ GpStatus GdipCreateTextureIA (GpImage *image, GpImageAttributes *imageAttributes, float x, float y, float width, float height, GpTexture **texture) { /* FIXME MonoTODO: Make use of ImageAttributes parameter when * ImageAttributes is implemented */ GpWrapMode mode = imageAttributes ? WrapModeClamp : WrapModeTile; return GdipCreateTexture2 (image, mode, x, y, width, height, texture); } /* coverity[+alloc : arg-*6] */ GpStatus GdipCreateTextureIAI (GpImage *image, GpImageAttributes *imageAttributes, int x, int y, int width, int height, GpTexture **texture) { /* FIXME MonoTODO: Make use of ImageAttributes parameter when * ImageAttributes is implemented */ GpWrapMode mode = imageAttributes ? WrapModeClamp : WrapModeTile; return GdipCreateTexture2I (image, mode, x, y, width, height, texture); } GpStatus GdipGetTextureTransform (GpTexture *texture, GpMatrix *matrix) { if ((texture == NULL) || (matrix == NULL)) { return InvalidParameter; } gdip_cairo_matrix_copy(matrix, &texture->matrix); return Ok; } GpStatus GdipSetTextureTransform (GpTexture *texture, GDIPCONST GpMatrix *matrix) { if ((texture == NULL) || (matrix == NULL)) { return InvalidParameter; } gdip_cairo_matrix_copy(&texture->matrix, matrix); texture->base.changed = TRUE; return Ok; } GpStatus GdipResetTextureTransform (GpTexture *texture) { if (texture == NULL) { return InvalidParameter; } cairo_matrix_init_identity (&texture->matrix); texture->base.changed = TRUE; return Ok; } GpStatus GdipMultiplyTextureTransform (GpTexture *texture, GpMatrix *matrix, GpMatrixOrder order) { GpStatus status; BOOL invertible = FALSE; cairo_matrix_t mat; if ((texture == NULL) || (matrix == NULL)) { return InvalidParameter; } /* the matrix MUST be invertible to be used */ status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible); if (!invertible || (status != Ok)) return InvalidParameter; if (order == MatrixOrderPrepend) cairo_matrix_multiply (&mat, matrix, &texture->matrix); else if (order == MatrixOrderAppend) cairo_matrix_multiply (&mat, &texture->matrix, matrix); gdip_cairo_matrix_copy (&texture->matrix, &mat); texture->base.changed = TRUE; return status; } GpStatus GdipTranslateTextureTransform (GpTexture *texture, float dx, float dy, GpMatrixOrder order) { GpStatus status; if (texture == NULL) { return InvalidParameter; } status = GdipTranslateMatrix (&texture->matrix, dx, dy, order); if (status == Ok) texture->base.changed = TRUE; return status; } GpStatus GdipScaleTextureTransform (GpTexture *texture, float sx, float sy, GpMatrixOrder order) { GpStatus status; if (texture == NULL) { return InvalidParameter; } status = GdipScaleMatrix (&texture->matrix, sx, sy, order); if (status == Ok) texture->base.changed = TRUE; return status; } /* MonoTODO - FIXME - this hack affect the public transform and doesn't work with MultiplyTransform */ GpStatus GdipRotateTextureTransform (GpTexture *texture, float angle, GpMatrixOrder order) { GpStatus status; if (texture == NULL) return InvalidParameter; status = GdipRotateMatrix (&texture->matrix, angle, order); if (status == Ok) texture->base.changed = TRUE; return status; } GpStatus GdipSetTextureWrapMode (GpTexture *texture, GpWrapMode wrapMode) { if (texture == NULL) return InvalidParameter; /* ignore invalid GpWrapMode value */ if ((wrapMode < WrapModeTile) || (wrapMode > WrapModeClamp)) return Ok; texture->wrapMode = wrapMode; texture->base.changed = TRUE; return Ok; } GpStatus GdipGetTextureWrapMode (GpTexture *texture, GpWrapMode *wrapMode) { if (!texture || !wrapMode) return InvalidParameter; *wrapMode = texture->wrapMode; return Ok; } /* coverity[+alloc : arg-*1] */ GpStatus GdipGetTextureImage (GpTexture *texture, GpImage **image) { if (!texture || !image) return InvalidParameter; return GdipCloneImage (texture->image, image); } libgdiplus-4.2/src/texturebrush-private.h0000664000175000017500000000366512377405421015633 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __TEXTUREBRUSH_PRIVATE_H__ #define __TEXTUREBRUSH_PRIVATE_H__ #include "gdiplus-private.h" #include "brush-private.h" #include "matrix-private.h" typedef struct _Texture { GpBrush base; GpImage *image; cairo_matrix_t matrix; GpRect rectangle; GpWrapMode wrapMode; cairo_pattern_t *pattern; } Texture; #include "texturebrush.h" #endif libgdiplus-4.2/src/gdi32.c0000664000175000017500000000360312377405421012312 00000000000000// Authors: // Francis Fisher (frankie@terrorise.me.uk) // // (C) Francis Fisher 2013 // // 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 AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "graphics-private.h" #include "graphics-cairo-private.h" #include #define NO_CAIRO_AA #define MAX_GRAPHICS_STATE_STACK 512 #define SRCCOPY (DWORD)0x00CC0020 BOOL BitBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop) { if (dwRop != SRCCOPY) return FALSE; GpGraphics *src = (GpGraphics *) hdcSrc; GpGraphics *dest = (GpGraphics *) hdcDest; cairo_t *cr = dest->ct; cairo_surface_t *src_surface = cairo_get_target(src->ct); cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_source_surface (cr, src_surface, nXDest - nXSrc, nYDest - nYSrc); cairo_rectangle (cr, nXDest, nYDest, nWidth, nHeight); cairo_fill (cr); return TRUE; } libgdiplus-4.2/src/solidbrush.c0000664000175000017500000001032512377405421013557 00000000000000/* * solidbrush.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine(pigolkine@gmx.de) * Ravindra (rkumar@novell.com) */ #include "solidbrush-private.h" #include "graphics-private.h" static GpStatus gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush); static GpStatus gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush); static GpStatus gdip_solidfill_destroy (GpBrush *brush); /* * we have a single copy of vtable for * all instances of solidbrush. */ static BrushClass vtable = { BrushTypeSolidColor, gdip_solidfill_setup, gdip_solidfill_clone, gdip_solidfill_destroy }; static void gdip_solidfill_init (GpSolidFill *brush) { gdip_brush_init (&brush->base, &vtable); brush->color = 0; } static GpSolidFill* gdip_solidfill_new (void) { GpSolidFill *result = (GpSolidFill *) GdipAlloc (sizeof (GpSolidFill)); if (result) gdip_solidfill_init (result); return result; } GpStatus gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush) { GpSolidFill *solid; int A, R, G, B; if (!graphics || !brush) return InvalidParameter; solid = (GpSolidFill *) brush; /* We extract the ARGB components of the color, only if the * brush is changed. */ if (solid->base.changed) { A = (solid->color & 0xFF000000) >> 24; R = (solid->color & 0x00FF0000) >> 16; G = (solid->color & 0x0000FF00) >> 8; B = (solid->color & 0x000000FF); solid->A = (double) A / 255.0; solid->R = (double) R / 255.0; solid->G = (double) G / 255.0; solid->B = (double) B / 255.0; } /* * Controls whether to use the alpha component in the color * or not. */ if (graphics->composite_mode == CompositingModeSourceOver) cairo_set_source_rgba (graphics->ct, solid->R, solid->G, solid->B, solid->A); else cairo_set_source_rgb (graphics->ct, solid->R, solid->G, solid->B); return Ok; } GpStatus gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush) { GpSolidFill *result; GpSolidFill *solid; /* the NULL checks for brush and clonedBrush are done by the caller, GdipCloneBrush */ result = (GpSolidFill *) GdipAlloc (sizeof (GpSolidFill)); if (!result) return OutOfMemory; solid = (GpSolidFill *) brush; result->base = solid->base; result->color = solid->color; result->base.changed = TRUE; *clonedBrush = (GpBrush *) result; return Ok; } GpStatus gdip_solidfill_destroy (GpBrush *brush) { /* a. the NULL check for brush is done by the caller, GdipDeleteBrush */ /* b. brush itself is freed by the caller */ return Ok; } // coverity[+alloc : arg-*1] GpStatus GdipCreateSolidFill (ARGB color, GpSolidFill **brush) { if (!brush) return InvalidParameter; *brush = gdip_solidfill_new (); if (!*brush) return OutOfMemory; (*brush)->color = color; return Ok; } GpStatus GdipSetSolidFillColor (GpSolidFill *brush, ARGB color) { if (!brush) return InvalidParameter; brush->color = color; brush->base.changed = TRUE; return Ok; } GpStatus GdipGetSolidFillColor (GpSolidFill *brush, ARGB *color) { if (!brush || !color) return InvalidParameter; *color = brush->color; return Ok; } libgdiplus-4.2/src/gifcodec.c0000664000175000017500000007115012614365567013161 00000000000000/* * gifcodec.c : Contains function definitions for encoding decoding gif images * * Copyright (C) 2003-2004,2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Jordi Mas (jordi@ximian.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot */ #if HAVE_CONFIG_H #include #endif #include "gdiplus-private.h" GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; #ifdef HAVE_LIBGIF #include #include "gifcodec.h" /* Data structure used for callback */ typedef struct { GetBytesDelegate getBytesFunc; SeekDelegate seekFunc; } gif_callback_data; /* Codecinfo related data*/ static ImageCodecInfo gif_codec; static const WCHAR gif_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'G', 'I', 'F', ' ', 'C', 'o', 'd', 'e', 'c', 0}; /* Built-in GIF Codec */ static const WCHAR gif_extension[] = {'*', '.', 'G', 'I', 'F',0}; /* *.GIF */ static const WCHAR gif_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'g', 'i', 'f', 0}; /* image/gif */ static const WCHAR gif_format[] = {'G', 'I', 'F', 0}; /* GIF */ static const BYTE gif_sig_pattern[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; static const BYTE gif_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; ImageCodecInfo * gdip_getcodecinfo_gif () { gif_codec.Clsid = (CLSID) { 0x557cf402, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; gif_codec.FormatID = gdip_gif_image_format_guid; gif_codec.CodecName = (const WCHAR*) gif_codecname; gif_codec.DllName = NULL; gif_codec.FormatDescription = (const WCHAR*) gif_format; gif_codec.FilenameExtension = (const WCHAR*) gif_extension; gif_codec.MimeType = (const WCHAR*) gif_mimetype; gif_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; gif_codec.Version = 1; gif_codec.SigCount = 2; gif_codec.SigSize = 6; gif_codec.SigPattern = gif_sig_pattern; gif_codec.SigMask = gif_sig_mask; return &gif_codec; } /* Read callback function for the gif libbrary*/ static int gdip_gif_fileinputfunc (GifFileType *gif, GifByteType *data, int len) { return fread (data, 1, len, (FILE*) gif->UserData); } static int gdip_gif_inputfunc (GifFileType *gif, GifByteType *data, int len) { int read = 0; gif_callback_data *gcd = (gif_callback_data*) gif->UserData; read = gcd->getBytesFunc (data, len, 0); return read; } /* This is the DGifSlurp and AddExtensionBlock code courtesy of giflib, It's modified to not dump comments after the image block, since those are still valid */ static int AddExtensionBlockMono(SavedImage *New, int Function, int Len, BYTE ExtData[]) { ExtensionBlock *ep; if (New->ExtensionBlocks == NULL) { New->ExtensionBlocks=(ExtensionBlock *)GdipAlloc(sizeof(ExtensionBlock)); } else { New->ExtensionBlocks = (ExtensionBlock*) gdip_realloc (New->ExtensionBlocks, sizeof(ExtensionBlock) * (New->ExtensionBlockCount + 1)); } if (New->ExtensionBlocks == NULL) { return (GIF_ERROR); } ep = &New->ExtensionBlocks[New->ExtensionBlockCount++]; ep->Function = Function; ep->ByteCount=Len; ep->Bytes = (GifByteType *)GdipAlloc(ep->ByteCount); if (ep->Bytes == NULL) { return (GIF_ERROR); } if (ExtData) { memcpy(ep->Bytes, ExtData, Len); } return (GIF_OK); } static void FreeExtensionMono(SavedImage *Image) { ExtensionBlock *ep; if ((Image == NULL) || (Image->ExtensionBlocks == NULL)) { return; } for (ep = Image->ExtensionBlocks; ep < (Image->ExtensionBlocks + Image->ExtensionBlockCount); ep++) { (void)GdipFree((char *)ep->Bytes); } GdipFree((char *)Image->ExtensionBlocks); Image->ExtensionBlocks = NULL; } static int gif_read_interlace (GifFileType* GifFile, SavedImage *sp, int start, int increment) { int line; for (line = start; line < sp->ImageDesc.Height; line += increment) { int index = line * sp->ImageDesc.Width * sizeof (GifPixelType); if (DGifGetLine(GifFile, &sp->RasterBits[index], sp->ImageDesc.Width) == GIF_ERROR) return GIF_ERROR; } return GIF_OK; } static int DGifSlurpMono(GifFileType * GifFile, SavedImage *TrailingExtensions) { int ImageSize; int Function; GifRecordType RecordType; SavedImage *sp; GifByteType *ExtData; SavedImage temp_save; temp_save.ExtensionBlocks = NULL; temp_save.ExtensionBlockCount = 0; if (TrailingExtensions != NULL) { TrailingExtensions->ExtensionBlocks = NULL; TrailingExtensions->ExtensionBlockCount = 0; } sp = NULL; do { if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) { return (GIF_ERROR); } switch (RecordType) { case IMAGE_DESC_RECORD_TYPE: { /* This call will leak GifFile->Image.ColorMap; there's a fixme in the DGifGetImageDesc code */ if (DGifGetImageDesc(GifFile) == GIF_ERROR) { return (GIF_ERROR); } sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; sp->RasterBits = (BYTE*) GdipAlloc (ImageSize * sizeof (GifPixelType)); if (sp->RasterBits == NULL) { return GIF_ERROR; } if (GifFile->Image.Interlace) { /* first start at line 0 and read every 8th lines */ if (gif_read_interlace (GifFile, sp, 0, 8) == GIF_ERROR) return GIF_ERROR; /* then start at line 4 and read every 8th lines */ if (gif_read_interlace (GifFile, sp, 4, 8) == GIF_ERROR) return GIF_ERROR; /* then start at line 2 and read every 4th lines */ if (gif_read_interlace (GifFile, sp, 2, 4) == GIF_ERROR) return GIF_ERROR; /* then start at line 1 and read every 2th lines */ if (gif_read_interlace (GifFile, sp, 1, 2) == GIF_ERROR) return GIF_ERROR; /* all lines are read */ } else { if (DGifGetLine(GifFile, sp->RasterBits, ImageSize) == GIF_ERROR) { return (GIF_ERROR); } } if (temp_save.ExtensionBlocks) { sp->ExtensionBlocks = temp_save.ExtensionBlocks; sp->ExtensionBlockCount = temp_save.ExtensionBlockCount; temp_save.ExtensionBlocks = NULL; temp_save.ExtensionBlockCount = 0; } break; } case EXTENSION_RECORD_TYPE: { if (DGifGetExtension(GifFile, &Function, &ExtData) == GIF_ERROR) { return (GIF_ERROR); } while (ExtData != NULL) { /* Create an extension block with our data */ if (AddExtensionBlockMono(&temp_save, Function, ExtData[0], &ExtData[1]) == GIF_ERROR) { return (GIF_ERROR); } if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) { return (GIF_ERROR); } } break; } case TERMINATE_RECORD_TYPE: { break; } default: { /* Should be trapped by DGifGetRecordType */ break; } } } while (RecordType != TERMINATE_RECORD_TYPE); /* In case the Gif has an extension block without an associated * image we return it in TrailingExtensions, if provided */ if ((TrailingExtensions != NULL) && (temp_save.ExtensionBlocks != NULL)) { *TrailingExtensions = temp_save; } return (GIF_OK); } static GpStatus gdip_load_gif_image (void *stream, GpImage **image, BOOL from_file) { GifFileType *gif; BYTE *readptr; BYTE *writeptr; int i; int l; int num_of_images; BOOL animated; const GUID *dimension; FrameData *frame; GpBitmap *result; BitmapData *bitmap_data; SavedImage si; SavedImage global_extensions; ColorPalette *global_palette; BOOL loop_counter; unsigned short loop_value; int disposal; int last_disposal; int transparent_index; int screen_width; int screen_height; GifImageDesc *img_desc; disposal = 0; last_disposal = 0; loop_value = 0; global_palette = NULL; result = NULL; loop_counter = FALSE; if (from_file) { #if GIFLIB_MAJOR >= 5 gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL); #else gif = DGifOpen(stream, &gdip_gif_fileinputfunc); #endif } else { #if GIFLIB_MAJOR >= 5 gif = DGifOpen (stream, &gdip_gif_inputfunc, NULL); #else gif = DGifOpen (stream, &gdip_gif_inputfunc); #endif } if (gif == NULL) { goto error; } /* Read the image */ if (DGifSlurpMono(gif, &global_extensions) != GIF_OK) { goto error; } /* We can have either multiple pages (page dimension) or an animation (time dimension) If we find an Application Extension, it's an animated gif, otherwise we've got multiple pages */ screen_width = gif->SWidth; screen_height = gif->SHeight; animated = FALSE; num_of_images = gif->ImageCount; for (i = 0; i < num_of_images; i++) { for (l = 0; l < gif->SavedImages[i].ExtensionBlockCount; l++) { switch(gif->SavedImages[i].ExtensionBlocks[l].Function) { case APPLICATION_EXT_FUNC_CODE: { if (num_of_images > 1) { animated = TRUE; } /* Mention of the Netscape format is here: http://list-archive.xemacs.org/xemacs-beta/199910/msg00070.html */ /* We seem to be dealing with a bug in the gif lib here, it breaks the sub-bart part of the * extension data up into a separate ExtensionBlock (of type 0x00) */ if (gif->SavedImages[i].ExtensionBlocks[l].ByteCount > 10) { if (memcmp(gif->SavedImages[i].ExtensionBlocks[l].Bytes, "NETSCAPE2.0", 11) == 0) { loop_counter = TRUE; /* The next Block is a subblock of the app extension. The 3 bytes are the loop counter */ if ((l + 1) < gif->SavedImages[i].ExtensionBlockCount) { if ((gif->SavedImages[i].ExtensionBlocks[l + 1].Function == 0) && (gif->SavedImages[i].ExtensionBlocks[l + 1].ByteCount == 3) && (gif->SavedImages[i].ExtensionBlocks[l + 1].Bytes[0] == 1)) { loop_value = (BYTE)(gif->SavedImages[i].ExtensionBlocks[l + 1].Bytes[2] << 8) + (BYTE)gif->SavedImages[i].ExtensionBlocks[l + 1].Bytes[1]; } } } } break; } case 0: { break; } } } } if (animated) { dimension = &gdip_image_frameDimension_time_guid; } else { dimension = &gdip_image_frameDimension_page_guid; } result = gdip_bitmap_new(); result->type = ImageTypeBitmap; frame = gdip_frame_add(result, dimension); /* Copy the palette over, if there is one */ if (gif->SColorMap != NULL) { global_palette = GdipAlloc (sizeof(ColorPalette) + sizeof(ARGB) * gif->SColorMap->ColorCount); global_palette->Flags = 0; global_palette->Count = gif->SColorMap->ColorCount; for (i = 0; i < gif->SColorMap->ColorCount; i++) { global_palette->Entries[i] = MAKE_ARGB_ARGB(0xff, gif->SColorMap->Colors[i].Red, gif->SColorMap->Colors[i].Green, gif->SColorMap->Colors[i].Blue); } } else { /* Assume a grayscale image for the global palette. Individual images might still have a different one. */ global_palette = GdipAlloc (sizeof(ColorPalette) + 256 * sizeof(ARGB)); global_palette->Flags = PaletteFlagsGrayScale; global_palette->Count = 256; for (i=0; i < 256; i++) { global_palette->Entries[i] = MAKE_ARGB_RGB(i, i, i); } } result->cairo_format = CAIRO_FORMAT_A8; /* create our bitmaps */ for (i = 0; i < num_of_images; i++) { /* Add BitmapData to our frame */ bitmap_data = gdip_frame_add_bitmapdata(frame); if (bitmap_data == NULL) { goto error; } si = gif->SavedImages[i]; img_desc = &si.ImageDesc; if (img_desc->Top < 0 || img_desc->Height < 0 || img_desc->Left < 0 || img_desc->Width < 0 || (img_desc->Width + img_desc->Left) > screen_width || (img_desc->Height + img_desc->Top) > screen_height) { goto error; } for (l = 0; l < global_extensions.ExtensionBlockCount; l++) { ExtensionBlock eb = global_extensions.ExtensionBlocks[l]; if (eb.Function == COMMENT_EXT_FUNC_CODE) { int index; if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagExifUserComment, &index) != Ok) { BYTE *bytes = (BYTE*) GdipAlloc (eb.ByteCount + 1); if (bytes == NULL) goto error; memcpy (bytes, eb.Bytes, eb.ByteCount); bytes [eb.ByteCount] = '\0'; gdip_bitmapdata_property_add_ASCII (bitmap_data, PropertyTagExifUserComment, bytes); GdipFree (bytes); } } } for (l = 0; l < si.ExtensionBlockCount; l++) { ExtensionBlock eb = si.ExtensionBlocks[l]; switch(eb.Function) { case GRAPHICS_EXT_FUNC_CODE: { /* Pull animation time and/or transparent color */ if (eb.ByteCount > 3) { /* Sanity */ guint32 delay; disposal = ((eb.Bytes [0] >> 2) & 7); if ((eb.Bytes[0] & 0x01) != 0) { /* 0 = no transparency, so we need to shift range */ bitmap_data->transparent = -eb.Bytes[3] - 1; } delay = (eb.Bytes[2] << 8) + (eb.Bytes[1]); gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagFrameDelay, delay); if (loop_counter) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagLoopCount, loop_value); } } break; } case COMMENT_EXT_FUNC_CODE: { int index; BYTE *text; /* Per-image comments override global */ if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagExifUserComment, &index) == Ok) { gdip_bitmapdata_property_remove_index(bitmap_data, index); } /* String is not null terminated */ text = (BYTE*)GdipAlloc(eb.ByteCount + 1); if (text != NULL) { memcpy(text, eb.Bytes, eb.ByteCount); text[eb.ByteCount] = '\0'; gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagExifUserComment, text); GdipFree(text); } break; } #if 0 case PLAINTEXT_EXT_FUNC_CODE: { printf("Do something with PLAINTEXT_EXT_FUNC_CODE?\n"); break; } #endif } } /* copy the local color map if there is one, otherwise we duplicate the global one */ if (img_desc->ColorMap != NULL) { ColorMapObject *local_palette_obj; /* TODO: what do we do with combined gif + local palettes? */ local_palette_obj = img_desc->ColorMap; bitmap_data->palette = GdipAlloc (sizeof(ColorPalette) + sizeof(ARGB) * local_palette_obj->ColorCount); bitmap_data->palette->Flags = 0; bitmap_data->palette->Count = local_palette_obj->ColorCount; for (l = 0; l < local_palette_obj->ColorCount; l++) { bitmap_data->palette->Entries[l] = MAKE_ARGB_ARGB(0xff, local_palette_obj->Colors[l].Red, local_palette_obj->Colors[l].Green, local_palette_obj->Colors[l].Blue); } } else { bitmap_data->palette = gdip_palette_clone(global_palette); } if (bitmap_data->transparent < 0) { BYTE *v; bitmap_data->palette->Flags |= PaletteFlagsHasAlpha; transparent_index = (bitmap_data->transparent + 1) * -1; v = (BYTE*)&bitmap_data->palette->Entries [transparent_index]; #ifdef WORDS_BIGENDIAN v[0] = 0x00; #else v[3] = 0x00; #endif /* WORDS_BIGENDIAN */ } else { transparent_index = -1; } bitmap_data->pixel_format = PixelFormat8bppIndexed; bitmap_data->width = screen_width; bitmap_data->height = screen_height; bitmap_data->stride = bitmap_data->width; gdip_align_stride (bitmap_data->stride); bitmap_data->left = img_desc->Left; bitmap_data->top = img_desc->Top; bitmap_data->scan0 = GdipAlloc (bitmap_data->stride * bitmap_data->height); bitmap_data->reserved = GBD_OWN_SCAN0; bitmap_data->image_flags = ImageFlagsHasAlpha | ImageFlagsReadOnly | ImageFlagsHasRealPixelSize | ImageFlagsColorSpaceRGB; bitmap_data->dpi_horz = gdip_get_display_dpi (); bitmap_data->dpi_vert = bitmap_data->dpi_horz; readptr = (BYTE*) si.RasterBits; writeptr = bitmap_data->scan0; for (l = 0; l < bitmap_data->height; l++) { if (l >= img_desc->Top && l - img_desc->Top < img_desc->Height) { /* Ignore 'disposal' 0 (don't care) and 4, 5, 6, 7 (undocumented) */ if (i == 0 || transparent_index == -1 || (last_disposal != 1 && last_disposal != 3)) { writeptr += img_desc->Left; memcpy (writeptr, readptr, img_desc->Width); writeptr -= img_desc->Left; writeptr += bitmap_data->stride; readptr += img_desc->Width; } else { int ridx, widx; BitmapData *last_bitmap; last_bitmap = &frame->bitmap [i - 1]; if (l == img_desc->Top) { /* Copy the previous bitmap as the base for this one */ /* TODO: This will be wrong if each image has a different palette */ /* There's a comment up there too */ memcpy (bitmap_data->scan0, last_bitmap->scan0, bitmap_data->height * bitmap_data->stride); } for (ridx = 0, widx = bitmap_data->left; ridx < img_desc->Width; widx++, ridx++) { BYTE bt = readptr [ridx]; if (bt == transparent_index) continue; writeptr [widx] = bt; } readptr += img_desc->Width; writeptr += bitmap_data->stride; } } else { writeptr += bitmap_data->stride; } } last_disposal = disposal; disposal = 0; } gdip_bitmap_setactive(result, dimension, 0); if (global_palette != NULL) { GdipFree(global_palette); } FreeExtensionMono(&global_extensions); #if (GIFLIB_MAJOR > 5) || ((GIFLIB_MAJOR == 5) && (GIFLIB_MINOR >= 1)) DGifCloseFile (gif, NULL); #else DGifCloseFile (gif); #endif *image = result; return Ok; error: if (global_palette != NULL) { GdipFree(global_palette); } if (result != NULL) { gdip_bitmap_dispose (result); } if (gif != NULL) { FreeExtensionMono (&global_extensions); #if (GIFLIB_MAJOR > 5) || ((GIFLIB_MAJOR == 5) && (GIFLIB_MINOR >= 1)) DGifCloseFile (gif, NULL); #else DGifCloseFile (gif); #endif } *image = NULL; return InvalidParameter; } GpStatus gdip_load_gif_image_from_file (FILE *fp, GpImage **image) { return gdip_load_gif_image (fp, image, TRUE); } GpStatus gdip_load_gif_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seekFunc, GpImage **image) { gif_callback_data gif_data; gif_data.getBytesFunc = getBytesFunc; gif_data.seekFunc = seekFunc; return gdip_load_gif_image (&gif_data, image, FALSE); } /* Write callback function for the gif libbrary*/ static int gdip_gif_outputfunc (GifFileType *gif, const GifByteType *data, int len) { int written = 0; PutBytesDelegate putBytesFunc = (PutBytesDelegate) gif->UserData; written = putBytesFunc ((void *)data, len); return written; } static GpStatus gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file) { GifFileType *fp; int i, x, y, size; GifByteType *red; GifByteType *green; GifByteType *blue; GifByteType *red_ptr; GifByteType *green_ptr; GifByteType *blue_ptr; GifByteType *pixbuf; GifByteType *pixbuf_org; int cmap_size; ColorMapObject *cmap = NULL; int k; BYTE *v; int c; int index; BOOL animated; int frame; BitmapData *bitmap_data; int pixbuf_size; if (!stream) { return InvalidParameter; } if (from_file) { #if GIFLIB_MAJOR >= 5 fp = EGifOpenFileName (stream, 0, NULL); #else fp = EGifOpenFileName (stream, 0); #endif } else { #if GIFLIB_MAJOR >= 5 fp = EGifOpen (stream, gdip_gif_outputfunc, NULL); #else fp = EGifOpen (stream, gdip_gif_outputfunc); #endif } if (!fp) { return FileNotFound; } red = NULL; green = NULL; blue = NULL; pixbuf_org = NULL; for (frame = 0; frame < image->num_of_frames; frame++) { animated = FALSE; if (memcmp(&image->frames[frame].frame_dimension, &gdip_image_frameDimension_time_guid, sizeof(GUID)) == 0) { animated = TRUE; } for (k = 0; k < image->frames[frame].count; k++) { bitmap_data = &image->frames[frame].bitmap[k]; pixbuf_size = bitmap_data->width * bitmap_data->height * sizeof(GifByteType); if (gdip_is_an_indexed_pixelformat(bitmap_data->pixel_format)) { BYTE w; switch (bitmap_data->pixel_format) { case PixelFormat1bppIndexed: cmap_size = 2; break; case PixelFormat4bppIndexed: cmap_size = 16; break; case PixelFormat8bppIndexed: cmap_size = 256; break; default: goto error; } #if GIFLIB_MAJOR >= 5 cmap = GifMakeMapObject(cmap_size, 0); #else cmap = MakeMapObject(cmap_size, 0); #endif pixbuf = GdipAlloc(pixbuf_size); if (pixbuf == NULL) { goto error; } pixbuf_org = pixbuf; for (c = 0; (c < cmap_size) && (c < bitmap_data->palette->Count); c++) { v = (BYTE*)&bitmap_data->palette->Entries[c]; #ifdef WORDS_BIGENDIAN cmap->Colors[c].Red = v[1]; cmap->Colors[c].Green = v[2]; cmap->Colors[c].Blue = v[3]; #else cmap->Colors[c].Red = v[2]; cmap->Colors[c].Green = v[1]; cmap->Colors[c].Blue = v[0]; #endif /* WORDS_BIGENDIAN */ } switch(bitmap_data->pixel_format) { case PixelFormat1bppIndexed: { for (y = 0; y < bitmap_data->height; y++) { v = bitmap_data->scan0 + y * bitmap_data->stride; for (x = 0; x + 7 < bitmap_data->width; x += 8) { w = *v; *(pixbuf++) = ((w & 0x80) != 0); *(pixbuf++) = ((w & 0x40) != 0); *(pixbuf++) = ((w & 0x20) != 0); *(pixbuf++) = ((w & 0x10) != 0); *(pixbuf++) = ((w & 0x08) != 0); *(pixbuf++) = ((w & 0x04) != 0); *(pixbuf++) = ((w & 0x02) != 0); *(pixbuf++) = ((w & 0x01) != 0); v++; } w = *v; switch (bitmap_data->width & 7) {/* every 'case' here flows into the next */ case 7: pixbuf[6] = ((w & 0x02) != 0); case 6: pixbuf[5] = ((w & 0x04) != 0); case 5: pixbuf[4] = ((w & 0x08) != 0); case 4: pixbuf[3] = ((w & 0x10) != 0); case 3: pixbuf[2] = ((w & 0x20) != 0); case 2: pixbuf[1] = ((w & 0x40) != 0); case 1: pixbuf[0] = ((w & 0x80) != 0); } pixbuf += (bitmap_data->width & 7); } break; } case PixelFormat4bppIndexed: { for (y = 0; y < bitmap_data->height; y++) { v = bitmap_data->scan0 + y * bitmap_data->stride; for (x = 0; x + 1 < bitmap_data->width; x += 2) { w = *v; *(pixbuf++) = ((w >> 4) & 0xF); *(pixbuf++) = ( w & 0xF); v++; } if ((bitmap_data->width & 1) != 0) { *(pixbuf++) = ((*v >> 4) & 0xF); } } break; } case PixelFormat8bppIndexed: { for (y = 0; y < bitmap_data->height; y++) { memcpy(pixbuf + y * bitmap_data->width, bitmap_data->scan0 + y * bitmap_data->stride, bitmap_data->width); } break; } } /* Restore pointer, 1bpp and 4bpp above alter it */ pixbuf = pixbuf_org; } else { cmap_size = 256; #if GIFLIB_MAJOR >= 5 cmap = GifMakeMapObject (cmap_size, 0); #else cmap = MakeMapObject (cmap_size, 0); #endif red = GdipAlloc(pixbuf_size); green = GdipAlloc(pixbuf_size); blue = GdipAlloc(pixbuf_size); pixbuf = GdipAlloc(pixbuf_size); if ((red == NULL) || (green == NULL) || (blue == NULL) || (pixbuf == NULL)) { goto error; } pixbuf_org = pixbuf; red_ptr = red; green_ptr = green; blue_ptr = blue; for (y = 0; y < bitmap_data->height; y++) { v = bitmap_data->scan0 + y * bitmap_data->stride; for (x = 0; x < bitmap_data->width; x++) { #ifdef WORDS_BIGENDIAN *red_ptr++ = v[1]; *green_ptr++ = v[2]; *blue_ptr++ = v[3]; #else *red_ptr++ = v[2]; *green_ptr++ = v[1]; *blue_ptr++ = v[0]; #endif v += 4; } } if ( #if GIFLIB_MAJOR >= 5 GifQuantizeBuffer( #else QuantizeBuffer( #endif bitmap_data->width, bitmap_data->height, &cmap_size, red, green, blue, pixbuf, cmap->Colors) == GIF_ERROR) { goto error; } } #if GIFLIB_MAJOR >= 5 cmap->BitsPerPixel = GifBitSize (cmap_size); #else cmap->BitsPerPixel = BitSize (cmap_size); #endif cmap->ColorCount = 1 << cmap->BitsPerPixel; if ((frame == 0) && (k == 0)) { /* First Image defines the global colormap */ if (EGifPutScreenDesc (fp, bitmap_data->width, bitmap_data->height, cmap->BitsPerPixel, 0, cmap) == GIF_ERROR) { goto error; } /* An animated image must have the application extension */ if (animated) { /* Store the LoopCount extension */ if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagLoopCount, &index) == Ok) { BYTE Buffer[3]; BYTE *ptr = bitmap_data->property[index].value; Buffer[0] = 1; Buffer[1] = ptr[0]; Buffer[2] = ptr[1]; #if GIFLIB_MAJOR >= 5 EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE); EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0"); EGifPutExtensionBlock(fp, 3, Buffer); EGifPutExtensionTrailer(fp); #else EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0"); EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer); #endif } } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagExifUserComment, &index) == Ok) { EGifPutComment(fp, (const char *)bitmap_data->property[index].value); } } /* Every image has a control extension specifying the time delay */ if (animated || bitmap_data->transparent < 0) { BYTE buffer[4]; buffer[0] = 0x03; /* 0000 0100 = do not dispose */ if (bitmap_data->transparent < 0) { buffer[0] |= 0x01; /* 0000 0001 = transparent */ } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagFrameDelay, &index) == Ok) { BYTE *ptr; ptr = bitmap_data->property[index].value; buffer[1] = ptr[0]; buffer[2] = ptr[1]; } else { buffer[1] = 0; buffer[2] = 0; } if (bitmap_data->transparent < 0) { buffer[3] = (bitmap_data->transparent + 1) * -1; } else { buffer[3] = 0; } EGifPutExtension(fp, GRAPHICS_EXT_FUNC_CODE, 4, buffer); } /* Store the image description */ /* This call will leak GifFile->Image.ColorMap */ if (EGifPutImageDesc (fp, bitmap_data->left, bitmap_data->top, bitmap_data->width, bitmap_data->height, FALSE, cmap) == GIF_ERROR) { goto error; } for (i = 0; i < bitmap_data->height; ++i) { if (EGifPutLine (fp, pixbuf, bitmap_data->width) == GIF_ERROR) { goto error; } pixbuf += bitmap_data->width; } #if GIFLIB_MAJOR >= 5 GifFreeMapObject (cmap); #else FreeMapObject (cmap); #endif if (red != NULL) { GdipFree (red); } if (green != NULL) { GdipFree (green); } if (blue != NULL) { GdipFree (blue); } if (pixbuf_org != NULL) { GdipFree (pixbuf_org); } red = NULL; green = NULL; blue = NULL; pixbuf_org = NULL; } } #if (GIFLIB_MAJOR > 5) || ((GIFLIB_MAJOR == 5) && (GIFLIB_MINOR >= 1)) EGifCloseFile (fp, NULL); #else EGifCloseFile (fp); #endif return Ok; error: if (cmap != NULL) { #if GIFLIB_MAJOR >= 5 GifFreeMapObject (cmap); #else FreeMapObject (cmap); #endif } if (red != NULL) { GdipFree (red); } if (green != NULL) { GdipFree (green); } if (blue != NULL) { GdipFree (blue); } if (pixbuf_org != NULL) { GdipFree (pixbuf_org); } return GenericError; } GpStatus gdip_save_gif_image_to_file (BYTE *filename, GpImage *image) { return gdip_save_gif_image ((void *)filename, image, TRUE); } GpStatus gdip_save_gif_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return gdip_save_gif_image ( (void *)putBytesFunc, image, FALSE); } #else /* No libgif */ #include "image.h" ImageCodecInfo * gdip_getcodecinfo_gif () { return NULL; } GpStatus gdip_load_gif_image_from_file (FILE *fp, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_save_gif_image_to_file (BYTE *filename, GpImage *image) { return UnknownImageFormat; } GpStatus gdip_save_gif_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } GpStatus gdip_load_gif_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seekFunc, GpImage **image) { *image = NULL; return UnknownImageFormat; } #endif libgdiplus-4.2/src/graphics-pathiterator.c0000664000175000017500000002671312377405421015715 00000000000000/* * graphics-pathiterator.c * * Copyright (C) 2004,2006-2007 Novell Inc. * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Author: Ravindra (rkumar@novell.com) * */ #include "graphics-pathiterator-private.h" #include "graphics-path-private.h" #include "font.h" // coverity[+alloc : arg-*0] GpStatus GdipCreatePathIter (GpPathIterator **iterator, GpPath *path) { GpPath *clone = NULL; GpPathIterator *iter; GpStatus status; if (!iterator) return InvalidParameter; iter = (GpPathIterator *) GdipAlloc (sizeof (GpPathIterator)); if (iter == NULL) return OutOfMemory; /* supplying a path isn't required */ if (path) { status = GdipClonePath (path, &clone); if (status != Ok) { GdipFree (iter); if (clone) GdipDeletePath (clone); return status; } } iter->path = clone; iter->markerPosition = 0; iter->subpathPosition = 0; iter->pathTypePosition = 0; *iterator = iter; return Ok; } GpStatus GdipPathIterGetCount (GpPathIterator *iterator, int *count) { if (!iterator || !count) return InvalidParameter; if (iterator->path) *count = iterator->path->count; else *count = 0; return Ok; } GpStatus GdipPathIterGetSubpathCount (GpPathIterator *iterator, int *count) { int numSubpaths = 0; if (!iterator || !count) return InvalidParameter; if (iterator->path) { int i; BYTE type; /* Number of subpaths = Number of starting points */ for (i = 0; i < iterator->path->count; i++) { type = g_array_index (iterator->path->types, BYTE, i); if (type == PathPointTypeStart) numSubpaths++; } } *count = numSubpaths; return Ok; } GpStatus GdipDeletePathIter (GpPathIterator *iterator) { if (!iterator) return InvalidParameter; if (iterator->path) { GdipDeletePath (iterator->path); iterator->path = NULL; } GdipFree (iterator); return Ok; } GpStatus GdipPathIterCopyData (GpPathIterator *iterator, int *resultCount, GpPointF *points, BYTE *types, int startIndex, int endIndex) { int i, j; if (!iterator || !resultCount || !points || !types) return InvalidParameter; if (!iterator->path || (startIndex >= iterator->path->count) || (startIndex > endIndex) || (endIndex >= iterator->path->count) || (startIndex < 0) || (endIndex < 0)) { *resultCount = 0; return Ok; } for (i = startIndex, j = 0; i <= endIndex; i++, j++) { points [j] = g_array_index (iterator->path->points, GpPointF, i); types [j] = g_array_index (iterator->path->types, BYTE, i); } *resultCount = j; return Ok; } GpStatus GdipPathIterEnumerate (GpPathIterator *iterator, int *resultCount, GpPointF *points, BYTE *types, int count) { int i = 0; if (!iterator || !resultCount || !points || !types) return InvalidParameter; if (iterator->path) { for (; i < count && i < iterator->path->count; i++) { points [i] = g_array_index (iterator->path->points, GpPointF, i); types [i] = g_array_index (iterator->path->types, BYTE, i); } } *resultCount = i; return Ok; } GpStatus GdipPathIterHasCurve (GpPathIterator *iterator, BOOL *curve) { if (!iterator || !curve) return InvalidParameter; *curve = gdip_path_has_curve (iterator->path); return Ok; } GpStatus GdipPathIterNextMarkerPath (GpPathIterator *iterator, int *resultCount, GpPath *path) { int index = 0; BYTE type; GpPointF point; if (!iterator || !resultCount) return InvalidParameter; /* There are no paths or markers or we are done with all the markers */ if (!path || !iterator->path || (iterator->path->count == 0) || (iterator->markerPosition == iterator->path->count)) { *resultCount = 0; return Ok; } /* Clear the existing values from path */ if (path->count > 0) { g_array_free (path->points, TRUE); g_byte_array_free (path->types, TRUE); path->points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); path->types = g_byte_array_new (); path->count = 0; } for (index = iterator->markerPosition; index < iterator->path->count; index++) { type = g_array_index (iterator->path->types, BYTE, index); point = g_array_index (iterator->path->points, GpPointF, index); g_array_append_val (path->points, point); g_byte_array_append (path->types, &type, 1); path->count++; /* Copy the marker and stop copying the points when we reach a marker type */ if (type & PathPointTypePathMarker) { index++; break; } } *resultCount = index - iterator->markerPosition; iterator->markerPosition = index; return Ok; } GpStatus GdipPathIterNextMarker (GpPathIterator *iterator, int *resultCount, int *startIndex, int *endIndex) { int index = 0; BYTE type; if (!iterator || !resultCount || !startIndex || !endIndex) return InvalidParameter; /* There are no markers or we are done with all the markers */ if (!iterator->path || (iterator->path->count == 0) || (iterator->markerPosition == iterator->path->count)) { /* we don't touch startIndex and endIndex in this case */ *resultCount = 0; return Ok; } /* Check for next marker */ for (index = iterator->markerPosition; index < iterator->path->count; index++) { type = g_array_index (iterator->path->types, BYTE, index); if (type & PathPointTypePathMarker) { index++; break; } } *startIndex = iterator->markerPosition; *endIndex = index - 1; *resultCount = (*endIndex) - (*startIndex) + 1;; iterator->markerPosition = index; return Ok; } GpStatus GdipPathIterNextPathType (GpPathIterator *iterator, int *resultCount, BYTE *pathType, int *startIndex, int *endIndex) { int index; BYTE currentType; BYTE lastTypeSeen; if (!iterator || !resultCount || !pathType || !startIndex || !endIndex) return InvalidParameter; /* There are no subpaths or we are done with all the subpaths */ if (!iterator->path || (iterator->path->count == 0) || (iterator->subpathPosition == 0)) { /* we don't touch pathType, startIndex and endIndex in this case */ *resultCount = 0; return Ok; } /* Pathtype position lags behind subpath position */ else if (iterator->pathTypePosition < iterator->subpathPosition) { lastTypeSeen = g_array_index (iterator->path->types, BYTE, iterator->pathTypePosition + 1); /* Mask the flags */ lastTypeSeen &= PathPointTypePathTypeMask; /* Check for the change in type */ for (index = iterator->pathTypePosition + 2; index < iterator->subpathPosition; index++) { currentType = g_array_index (iterator->path->types, BYTE, index); currentType &= PathPointTypePathTypeMask; if (currentType != lastTypeSeen) break; } *startIndex = iterator->pathTypePosition; *endIndex = index - 1; *resultCount = (*endIndex) - (*startIndex) + 1; *pathType = lastTypeSeen; /* If lastTypeSeen is a line, it becomes the starting point for the next * path type. We get this when we have connected figures. We need to step * back in that case. We don't need to step back if we are finished with * current subpath. */ if ((lastTypeSeen == PathPointTypeLine) && (index != iterator->subpathPosition)) iterator->pathTypePosition = index - 1; else iterator->pathTypePosition = index; } /* If pathtype position and subpath position coincide we return the resultCount = 0 */ else *resultCount = 0; return Ok; } GpStatus GdipPathIterNextSubpathPath (GpPathIterator *iterator, int *resultCount, GpPath *path, BOOL *isClosed) { int index = 0; GpPointF point; BYTE currentType; if (!iterator || !resultCount || !isClosed) return InvalidParameter; /* There are no subpaths or we are done with all the subpaths */ if (!path || !iterator->path || (iterator->path->count == 0) || (iterator->subpathPosition == iterator->path->count)) { *resultCount = 0; *isClosed = TRUE; return Ok; } /* Clear the existing values from path */ if (path->count > 0) { g_array_free (path->points, TRUE); g_byte_array_free (path->types, TRUE); path->points = g_array_new (FALSE, FALSE, sizeof (GpPointF)); path->types = g_byte_array_new (); path->count = 0; } /* Copy the starting point */ currentType = g_array_index (iterator->path->types, BYTE, iterator->subpathPosition); point = g_array_index (iterator->path->points, GpPointF, iterator->subpathPosition); g_array_append_val (path->points, point); g_byte_array_append (path->types, ¤tType, 1); path->count++; /* Check for next start point */ for (index = iterator->subpathPosition + 1; index < iterator->path->count; index++) { currentType = g_array_index (iterator->path->types, BYTE, index); /* Copy the start point till next start point */ if (currentType == PathPointTypeStart) break; point = g_array_index (iterator->path->points, GpPointF, index); g_array_append_val (path->points, point); g_byte_array_append (path->types, ¤tType, 1); path->count++; } *resultCount = index - iterator->subpathPosition; /* set positions for next iteration */ iterator->pathTypePosition = iterator->subpathPosition; iterator->subpathPosition = index; /* Check if last subpath was closed */ currentType = g_array_index (iterator->path->types, BYTE, index - 1); if (currentType & PathPointTypeCloseSubpath) *isClosed = TRUE; else *isClosed = FALSE; return Ok; } GpStatus GdipPathIterNextSubpath (GpPathIterator *iterator, int *resultCount, int *startIndex, int *endIndex, BOOL *isClosed) { int index = 0; BYTE currentType; if (!iterator || !resultCount || !startIndex || !endIndex || !isClosed) return InvalidParameter; /* There are no subpaths or we are done with all the subpaths */ if (!iterator->path || (iterator->path->count == 0) || (iterator->subpathPosition == iterator->path->count)) { /* we don't touch startIndex and endIndex in this case */ *resultCount = 0; *isClosed = TRUE; return Ok; } /* Check for next start point */ for (index = iterator->subpathPosition + 1; index < iterator->path->count; index++) { currentType = g_array_index (iterator->path->types, BYTE, index); if (currentType == PathPointTypeStart) break; } *startIndex = iterator->subpathPosition; *endIndex = index - 1; *resultCount = (*endIndex) - (*startIndex) + 1; /* set positions for next iteration */ iterator->pathTypePosition = iterator->subpathPosition; iterator->subpathPosition = index; /* check if last subpath was closed */ currentType = g_array_index (iterator->path->types, BYTE, index - 1); if (currentType & PathPointTypeCloseSubpath) *isClosed = TRUE; else *isClosed = FALSE; return Ok; } GpStatus GdipPathIterRewind (GpPathIterator *iterator) { if (!iterator) return InvalidParameter; /* Reset the marker and subpath positions */ iterator->markerPosition = 0; iterator->subpathPosition = 0; iterator->pathTypePosition = 0; return Ok; } libgdiplus-4.2/src/pathgradientbrush.h0000664000175000017500000001060412377405421015124 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Vladimir Vukicevic (vladimir@pobox.com) * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef __PATHGRADIENTBRUSH_H__ #define __PATHGRADIENTBRUSH_H__ #include "gdiplus-private.h" #include "brush.h" GpStatus GdipCreatePathGradient (GDIPCONST GpPointF *points, INT count, GpWrapMode wrapMode, GpPathGradient **polyGradient); GpStatus GdipCreatePathGradientI (GDIPCONST GpPoint *points, INT count, GpWrapMode wrapMode, GpPathGradient **polyGradient); GpStatus GdipCreatePathGradientFromPath (GDIPCONST GpPath *path, GpPathGradient **polyGradient); GpStatus GdipGetPathGradientCenterColor (GpPathGradient *brush, ARGB *colors); GpStatus GdipSetPathGradientCenterColor (GpPathGradient *brush, ARGB colors); GpStatus GdipGetPathGradientSurroundColorCount (GpPathGradient *brush, INT *count); GpStatus GdipGetPathGradientSurroundColorsWithCount (GpPathGradient *brush, ARGB *color, INT *count); GpStatus GdipSetPathGradientSurroundColorsWithCount (GpPathGradient *brush, GDIPCONST ARGB *color, INT *count); GpStatus GdipGetPathGradientCenterPoint (GpPathGradient *brush, GpPointF *points); GpStatus GdipSetPathGradientCenterPoint (GpPathGradient *brush, GDIPCONST GpPointF *points); GpStatus GdipGetPathGradientRect (GpPathGradient *brush, GpRectF *rect); GpStatus GdipGetPathGradientBlendCount (GpPathGradient *brush, INT *count); GpStatus GdipGetPathGradientBlend (GpPathGradient *brush, REAL *blend, REAL *positions, INT count); GpStatus GdipSetPathGradientBlend (GpPathGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL *positions, INT count); GpStatus GdipGetPathGradientPresetBlendCount (GpPathGradient *brush, INT *count); GpStatus GdipGetPathGradientPresetBlend (GpPathGradient *brush, ARGB *blend, REAL *positions, INT count); GpStatus GdipSetPathGradientPresetBlend (GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *positions, INT count); GpStatus GdipSetPathGradientSigmaBlend (GpPathGradient *brush, REAL focus, REAL scale); GpStatus GdipSetPathGradientLinearBlend (GpPathGradient *brush, REAL focus, REAL scale); GpStatus GdipGetPathGradientWrapMode (GpPathGradient *brush, GpWrapMode *wrapMode); GpStatus GdipSetPathGradientWrapMode (GpPathGradient *brush, GpWrapMode wrapMode); GpStatus GdipGetPathGradientTransform (GpPathGradient *brush, GpMatrix *matrix); GpStatus GdipSetPathGradientTransform (GpPathGradient *brush, GpMatrix *matrix); GpStatus GdipResetPathGradientTransform (GpPathGradient *brush); GpStatus GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); GpStatus GdipTranslatePathGradientTransform (GpPathGradient *brush, REAL dx, REAL dy, GpMatrixOrder order); GpStatus GdipScalePathGradientTransform (GpPathGradient *brush, REAL sx, REAL sy, GpMatrixOrder order); GpStatus GdipRotatePathGradientTransform (GpPathGradient *brush, REAL angle, GpMatrixOrder order); GpStatus GdipGetPathGradientFocusScales (GpPathGradient *brush, REAL *xScale, REAL *yScale); GpStatus GdipSetPathGradientFocusScales (GpPathGradient *brush, REAL xScale, REAL yScale); /* missing API GdipGetPathGradientPath GdipSetPathGradientPath GdipGetPathGradientCenterPointI GdipSetPathGradientCenterPointI GdipGetPathGradientRectI GdipGetPathGradientGammaCorrection GdipSetPathGradientGammaCorrection */ #endif libgdiplus-4.2/src/GdiPlusFlat.h0000664000175000017500000000620512377405421013566 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ /* * This is *the* public header to be used by C/C++ consumers of GDI+ * and has the same name as MS provided header for the "flat API" */ #ifndef _FLATAPI_H #define _FLATAPI_H #ifdef __cplusplus extern "C" { #endif /* * If you ever need a workaround specific to libgdiplus then use the following define */ #define MONO_LIBGDIPLUS 1 /* * public view of internal stuff (curious about them, check in *-private.h files ;-) */ typedef void GpAdjustableArrowCap; typedef void GpBitmap; typedef void GpBrush; typedef void GpCustomLineCap; typedef void GpFont; typedef void GpFontCollection; typedef void GpFontFamily; typedef void GpGraphics; typedef void GpHatch; typedef void GpImage; typedef void GpImageAttributes; typedef void GpLineGradient; typedef void GpMatrix; typedef void GpPath; typedef void GpPathIterator; typedef void GpPathGradient; typedef void GpPen; typedef void GpRegion; typedef void GpSolidFill; typedef void GpState; typedef void GpStringFormat; typedef void GpTexture; /* * Do not include those headers directly. * Their content is public but, unlike this file, the header filenames do NOT match MS filenames! */ #include "gdipenums.h" #include "gdipstructs.h" /* FIXME - libgdiplus version is larger than this (and some members are misnamed) */ typedef struct { UINT Width; UINT Height; INT Stride; /* C++ compilers should need '::' (and GCC does) */ #ifdef __cplusplus ::PixelFormat PixelFormat; #else PixelFormat PixelFormat; #endif VOID *Scan0; UINT *Reserved; } BitmapData; #include "general.h" #include "adjustablearrowcap.h" #include "bitmap.h" #include "brush.h" #include "customlinecap.h" #include "font.h" #include "fontcollection.h" #include "fontfamily.h" #include "graphics.h" #include "graphics-path.h" #include "hatchbrush.h" #include "image.h" #include "imageattributes.h" #include "pen.h" #include "matrix.h" #include "region.h" #include "solidbrush.h" #include "stringformat.h" #include "text.h" #ifdef __cplusplus } #endif #endif libgdiplus-4.2/src/text-metafile.c0000664000175000017500000000310112377405421014143 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "text-metafile-private.h" /* * NOTE: all parameter's validations are done inside text.c */ /* * http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawString.html */ GpStatus metafile_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) { /* TODO */ return Ok; } libgdiplus-4.2/src/hatchbrush.c0000664000175000017500000014320112377405421013534 00000000000000/* * hatchbrush.c * * Copyright (C) 2004,2006-2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Ravindra (rkumar@novell.com) * */ /* FIXME - match hatchbrush use the RenderOrigin stored in graphics */ #include "hatchbrush-private.h" #include "graphics-private.h" static GpStatus gdip_hatch_setup (GpGraphics *graphics, GpBrush *brush); static GpStatus gdip_hatch_clone (GpBrush *brush, GpBrush **clonedBrush); static GpStatus gdip_hatch_destroy (GpBrush *brush); /* * We keep a single copy of vtable for * all instances of hatchbrush. */ static BrushClass vtable = { BrushTypeHatchFill, gdip_hatch_setup, gdip_hatch_clone, gdip_hatch_destroy }; static void gdip_hatch_init (GpHatch *hatch) { gdip_brush_init (&hatch->base, &vtable); hatch->backColor = 0; hatch->pattern = NULL; } static GpHatch* gdip_hatch_new (void) { GpHatch *result = (GpHatch *) GdipAlloc (sizeof (GpHatch)); if (result) gdip_hatch_init (result); return result; } /* helper functions */ static cairo_t* create_hatch_context (cairo_surface_t *hatch, cairo_line_cap_t line_cap, BOOL antialias) { cairo_t *ct = cairo_create (hatch); if (cairo_status (ct) != CAIRO_STATUS_SUCCESS) { cairo_destroy (ct); return NULL; } cairo_set_line_cap (ct, line_cap); if (!antialias) cairo_set_antialias (ct, CAIRO_ANTIALIAS_NONE); return ct; } static void set_color (cairo_t *ct, int color) { int R = (color & 0x00FF0000) >> 16; int G = (color & 0x0000FF00) >> 8; int B = (color & 0x000000FF); cairo_set_source_rgb (ct, (double) R / 255.0, (double) G / 255.0, (double) B / 255.0); } static void draw_background (cairo_t *ct, int backcolor, int width, int height) { set_color (ct, backcolor); cairo_rectangle (ct, 0, 0, width, height); cairo_fill (ct); } /* The values used below are obtained by hit and trial to get the results similar to that of MS. */ static const double hatches_const[][3] = { /* HatchStyleHorizontal */ { HATCH_SIZE, HATCH_SIZE, LINE_WIDTH }, /* HatchStyleVertical */ { HATCH_SIZE, HATCH_SIZE, LINE_WIDTH }, /* HatchStyleForwardDiagonal */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleBackwardDiagonal */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleCross */ { HATCH_SIZE + 2.0, HATCH_SIZE + 2.0, LINE_WIDTH }, /* HatchStyleDiagonalCross */ { HATCH_SIZE, HATCH_SIZE, LINE_WIDTH }, /* HatchStyle05Percent */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyle10Percent */ { HATCH_SIZE + 1.0, 4.0, LINE_WIDTH }, /* HatchStyle20Percent */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyle25Percent */ { 4.0, 2.0, LINE_WIDTH }, /* HatchStyle30Percent */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyle40Percent */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyle50Percent */ { 2.0, 2.0, LINE_WIDTH }, /* HatchStyle60Percent */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyle70Percent */ { 4.0, 2.0, LINE_WIDTH }, /* HatchStyle75Percent */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyle80Percent */ { HATCH_SIZE + 1.0, 4.0, LINE_WIDTH }, /* HatchStyle90Percent */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleLightDownwardDiagonal */ { (HATCH_SIZE + 1.0) * 0.5, (HATCH_SIZE + 1.0) * 0.5, LINE_WIDTH }, /* HatchStyleLightUpwardDiagonal */ { (HATCH_SIZE + 1.0) * 0.5, (HATCH_SIZE + 1.0) * 0.5, LINE_WIDTH }, /* HatchStyleDarkDownwardDiagonal */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyleDarkUpwardDiagonal */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyleWideDownwardDiagonal */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH * 2.0 }, /* HatchStyleWideUpwardDiagonal */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH * 2.0 }, /* HatchStyleLightVertical */ { HATCH_SIZE * 0.7, HATCH_SIZE * 0.7, LINE_WIDTH }, /* HatchStyleLightHorizontal */ { HATCH_SIZE * 0.7, HATCH_SIZE * 0.7, LINE_WIDTH }, /* HatchStyleNarrowVertical */ { 2.0, 2.0, LINE_WIDTH }, /* HatchStyleNarrowHorizontal */ { 2.0, 2.0, LINE_WIDTH }, /* HatchStyleDarkVertical */ { HATCH_SIZE * 0.6, HATCH_SIZE * 0.6, LINE_WIDTH * 2.0 }, /* HatchStyleDarkHorizontal */ { HATCH_SIZE * 0.6, HATCH_SIZE * 0.6, LINE_WIDTH * 2.0 }, /* HatchStyleDashedDownwardDiagonal */ { 4.0, 8.0, LINE_WIDTH }, /* HatchStyleDashedUpwardDiagonal */ { 4.0, 8.0, LINE_WIDTH }, /* HatchStyleDashedHorizontal */ { 8.0, 8.0, LINE_WIDTH }, /* HatchStyleDashedVertical */ { 8.0, 8.0, LINE_WIDTH }, /* HatchStyleSmallConfetti */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleLargeConfetti */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleZigZag */ { HATCH_SIZE + 1.0, 4.0, LINE_WIDTH }, /* HatchStyleWave */ { HATCH_SIZE + 2.0, (HATCH_SIZE + 2.0) / 2.0, LINE_WIDTH }, /* HatchStyleDiagonalBrick */ { HATCH_SIZE + 0.0, HATCH_SIZE + 0.0, LINE_WIDTH }, /* HatchStyleHorizontalBrick */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleWeave */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStylePlaid */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleDivot */ { 9.0, 9.0, LINE_WIDTH }, /* HatchStyleDottedGrid */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleDottedDiamond */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleShingle */ { HATCH_SIZE + 1.0, HATCH_SIZE - 1.0, LINE_WIDTH }, /* HatchStyleTrellis */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyleSphere */ { 9.0, 9.0, LINE_WIDTH }, /* HatchStyleSmallGrid */ { (HATCH_SIZE + 2.0) * 0.6, (HATCH_SIZE + 2.0) * 0.6, LINE_WIDTH }, /* HatchStyleSmallCheckerBoard */ { 4.0, 4.0, LINE_WIDTH }, /* HatchStyleLargeCheckerBoard */ { 8.0, 8.0, LINE_WIDTH }, /* HatchStyleOutlinedDiamond */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH }, /* HatchStyleSolidDiamond */ { HATCH_SIZE + 1.0, HATCH_SIZE + 1.0, LINE_WIDTH } }; /* * functions to draw different hatch styles. */ static cairo_status_t draw_horizontal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw horizontal line in the foreground color */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, 0, hatch_size / 2.0); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_vertical_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw vertical line in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_forward_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, TRUE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw forward diagonal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, 0, hatch_size / 2.0); cairo_line_to (ct2, hatch_size / 2.0, hatch_size); cairo_move_to (ct2, hatch_size / 2.0, 0); cairo_line_to (ct2, hatch_size, hatch_size / 2.0); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_backward_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, TRUE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw backward diagonal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, hatch_size / 2.0, 0); cairo_line_to (ct2, 0, hatch_size / 2.0 ); cairo_move_to (ct2, hatch_size, hatch_size / 2.0); cairo_line_to (ct2, hatch_size / 2.0, hatch_size); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_cross_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); double dash [] = {1.0}; /* used for drawing dotted grid */ BOOL dotted = (hbr->hatchStyle == HatchStyleDottedGrid); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, dotted ? CAIRO_LINE_CAP_BUTT : CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw lines in the foregound */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); if (hbr->hatchStyle == HatchStyleDottedGrid) cairo_set_dash (ct2, dash, 1, 0); /* draw a horizontal line */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); /* draw a vertical line */ cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_diagonal_cross_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, TRUE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw diagonal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* draw a forward diagonal line */ cairo_move_to (ct2, 0, 0); cairo_line_to (ct2, hatch_size, hatch_size); /* draw a backward diagonal line */ cairo_move_to (ct2, hatch_size, 0); cairo_line_to (ct2, 0, hatch_size); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_percent_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* some patterns requires to reverse the colors */ switch (hbr->hatchStyle) { case HatchStyle05Percent: case HatchStyle10Percent: case HatchStyle20Percent: case HatchStyle25Percent: draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); set_color (ct2, hbr->foreColor); break; default: draw_background (ct2, hbr->foreColor, hatch_wd, hatch_ht); set_color (ct2, hbr->backColor); } /* draw four dots */ /* left middle */ gdip_cairo_pixel (ct2, 0, hatch_ht / 2.0); /* top middle */ gdip_cairo_pixel (ct2, hatch_wd / 2.0, 0); /* bottom middle */ gdip_cairo_pixel (ct2, hatch_wd / 2.0, hatch_ht); /* right middle */ gdip_cairo_pixel (ct2, hatch_wd, hatch_ht / 2.0); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_30_percent_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* HatchStyle30Percent and HatchStyle60Percent are identical, but the colors are reversed */ if (hbr->hatchStyle == HatchStyle60Percent) { draw_background (ct2, hbr->foreColor, hatch_size, hatch_size); set_color (ct2, hbr->backColor); } else { draw_background (ct2, hbr->backColor, hatch_size, hatch_size); set_color (ct2, hbr->foreColor); } /* draw two diagonal lines in the foreground */ cairo_set_line_width (ct2, line_width); /* near top left corner */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); /* near top right corner */ cairo_move_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* simulate the dots by drawing lines in background color */ if (hbr->hatchStyle == HatchStyleDottedDiamond) { double i; set_color (ct2, hbr->backColor); for (i = 0.0; i <= hatch_size; i += 2.0) { cairo_move_to (ct2, i, 0.0); cairo_line_to (ct2, i, hatch_size); } cairo_stroke (ct2); } /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_40_percent_hatch (cairo_t *ct, cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); cairo_pattern_t *pattern; cairo_t *ct2; double temp_size = 2; /* calculate radius using, pi * square (r) = % of hatch area */ double rad = sqrt ((10.0 * hatch_size * hatch_size) / (2 * PI * 100.0)); cairo_surface_t *temp = cairo_surface_create_similar (cairo_get_target (ct), CAIRO_CONTENT_COLOR_ALPHA, temp_size, temp_size); if (cairo_surface_status (temp) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (temp); return CAIRO_STATUS_NO_MEMORY; } /* draw a 50% hatch */ ct2 = create_hatch_context (temp, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) { cairo_surface_destroy (temp); return CAIRO_STATUS_NO_MEMORY; } /* draw background */ draw_background (ct2, hbr->backColor, temp_size, temp_size); /* draw two diagonal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_rectangle (ct2, 0, 0, temp_size / 2.0, temp_size / 2.0); cairo_rectangle (ct2, temp_size / 2.0, temp_size / 2.0, temp_size, temp_size); cairo_fill (ct2); /* set the pattern for the consequent fill or stroke */ pattern = cairo_pattern_create_for_surface (temp); if (cairo_pattern_status (pattern) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (temp); cairo_destroy (ct2); cairo_pattern_destroy (pattern); return CAIRO_STATUS_NO_MEMORY; } cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); /* Clean up 50% */ cairo_surface_destroy (temp); cairo_destroy (ct2); /* temp hatch is used as background, so we get 50% hatch */ ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) { cairo_pattern_destroy (pattern); return CAIRO_STATUS_NO_MEMORY; } cairo_set_source (ct2, pattern); cairo_rectangle (ct2, 0, 0, hatch_size, hatch_size); cairo_fill (ct2); /* foreground is filled with 10% hatch of background color */ set_color (ct2, hbr->backColor); /* 0.5 is added for pixel adjustment. It's ugly but it makes output better. */ /* draw four semi circles in the foregound to make dots */ /* left middle */ cairo_arc (ct2, 0, hatch_size / 2.0, rad, - PI / 2.0, PI / 2.0); cairo_fill (ct2); /* top middle */ cairo_arc (ct2, hatch_size / 2.0, 0, rad, 0, PI); cairo_fill (ct2); /* bottom middle */ cairo_arc (ct2, hatch_size / 2.0, hatch_size, rad, - PI, 0); cairo_fill (ct2); /* right middle */ cairo_arc (ct2, hatch_size, hatch_size / 2.0, rad, PI / 2.0, - PI / 2.0); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); cairo_pattern_destroy (pattern); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_50_percent_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw two rectangles in the foreground */ set_color (ct2, hbr->foreColor); cairo_rectangle (ct2, 0, 0, hatch_size / 2.0, hatch_size / 2.0); cairo_rectangle (ct2, hatch_size / 2.0, hatch_size / 2.0, hatch_size, hatch_size); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_downward_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw diagonal line in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_dark_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw diagonal line in the foreground */ set_color (ct2, hbr->foreColor); if (hbr->hatchStyle == HatchStyleDarkDownwardDiagonal) { cairo_rectangle (ct2, 0, 0, 2, 1); cairo_rectangle (ct2, 1, 1, 2, 1); cairo_rectangle (ct2, 2, 2, 2, 1); cairo_rectangle (ct2, 0, 3, 1, 1); cairo_rectangle (ct2, 3, 3, 1, 1); } else { cairo_rectangle (ct2, 1, 3, 2, 1); cairo_rectangle (ct2, 2, 2, 2, 1); cairo_rectangle (ct2, 3, 1, 1, 1); cairo_rectangle (ct2, 0, 1, 1, 1); cairo_rectangle (ct2, 0, 0, 2, 1); } cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_upward_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw diagonal line in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_move_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_dashed_diagonal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); /* draw slant line in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); if (hbr->hatchStyle == HatchStyleDashedUpwardDiagonal) { /* 45 deg slant line */ cairo_move_to (ct2, hatch_wd + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, hatch_wd + CAIRO_AA_OFFSET_Y); } else { /* HatchStyleDashedDownwardDiagonal */ /* -45 deg slant line */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_wd, hatch_wd - CAIRO_AA_OFFSET_Y); } cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_dashed_horizontal_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); double line_width = gdip_hatch_get_line_width (hbr); double line_space = 4; double dash_len = 4; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); /* draw horizontal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* upper left dash */ cairo_move_to (ct2, 0, line_space / 2 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, dash_len, line_space / 2 + CAIRO_AA_OFFSET_Y); /* lower right dash */ cairo_move_to (ct2, hatch_wd - dash_len + CAIRO_AA_OFFSET_X, hatch_ht - line_space / 2 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_wd, hatch_ht - line_space / 2 + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_dashed_vertical_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); double line_width = gdip_hatch_get_line_width (hbr); double line_space = 4; double dash_len = 4; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); /* draw vertical lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* upper left dash */ cairo_move_to (ct2, line_space / 2 + CAIRO_AA_OFFSET_X, 0); cairo_line_to (ct2, line_space / 2 + CAIRO_AA_OFFSET_X, dash_len - CAIRO_AA_OFFSET_Y); /* lower right dash */ cairo_move_to (ct2, hatch_wd - line_space / 2 + CAIRO_AA_OFFSET_X, hatch_ht - dash_len + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_wd - line_space / 2 + CAIRO_AA_OFFSET_X, hatch_ht); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_confetti_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double confetti_size = (hbr->hatchStyle == HatchStyleLargeConfetti) ? 1.5 : 1.0; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw small rectangles in the foreground */ set_color (ct2, hbr->foreColor); /* draw four rectangles on the left reversed 'L' shape */ cairo_rectangle (ct2, 0, 0, confetti_size, confetti_size); cairo_rectangle (ct2, hatch_size / 8.0, hatch_size / 4.0, confetti_size, confetti_size); cairo_rectangle (ct2, 3 * hatch_size / 8.0, hatch_size / 2.0, confetti_size, confetti_size); cairo_rectangle (ct2, hatch_size / 4.0, 3 * hatch_size / 4.0, confetti_size, confetti_size); /* draw four rectangles on the other left reversed 'L' shape */ cairo_rectangle (ct2, hatch_size / 2.0, hatch_size / 8.0, confetti_size, confetti_size); cairo_rectangle (ct2, 3 * hatch_size / 4.0, 3 * hatch_size / 8.0, confetti_size, confetti_size); cairo_rectangle (ct2, 7 * hatch_size / 8.0, 5 * hatch_size / 8.0, confetti_size, confetti_size); cairo_rectangle (ct2, 5 * hatch_size / 8.0, 7 * hatch_size / 8.0, confetti_size, confetti_size); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_zigzag_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); set_color (ct2, hbr->foreColor); /* draw two diagonal lines in the foreground */ cairo_set_line_width (ct2, line_width); /* first half*/ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); /* second half */ cairo_move_to (ct2, hatch_size - 1 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, 1 - CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_wave_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); /* set foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* draw a horizontal 'S' shape */ cairo_move_to (ct2, 1.0 + CAIRO_AA_OFFSET_X, 1.0 + CAIRO_AA_OFFSET_Y); cairo_curve_to (ct2, 1.0 + CAIRO_AA_OFFSET_X, 1.0 + CAIRO_AA_OFFSET_Y, hatch_wd / 4.0 + CAIRO_AA_OFFSET_X, hatch_ht + CAIRO_AA_OFFSET_Y, hatch_wd / 2.0 + CAIRO_AA_OFFSET_X, hatch_ht / 2.0 + CAIRO_AA_OFFSET_Y); cairo_curve_to (ct2, hatch_wd / 2.0 + CAIRO_AA_OFFSET_X, hatch_ht / 2.0 + CAIRO_AA_OFFSET_Y, 3 * hatch_wd / 4.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y, hatch_wd - 1.0 + CAIRO_AA_OFFSET_X, hatch_ht - 1.0 + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_diagonal_brick_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* set foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* draw one full diagonal line and half of another diagonal line */ gdip_cairo_pixel (ct2, 0, 0); cairo_fill (ct2); cairo_move_to (ct2, CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_horizontal_brick_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* set foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* draw a 'C' shape */ cairo_move_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); /* draw lower connector */ cairo_move_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_weave_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); double dash [] = {0.5}; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* set foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); cairo_set_dash (ct2, dash, 1, 0); /* draw a reversed 'C' shape diagonally with one connector towards * one of the other two vertices of the square and three connectors * towards the fourth vertex. */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); /* this makes up one of the lower connectors also */ cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); /* complete the diagonal 'C' shape */ cairo_move_to (ct2, 3 * hatch_size / 4.0 + CAIRO_AA_OFFSET_X, hatch_size / 4.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); /* draw one upper connector */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 4.0 + CAIRO_AA_OFFSET_X, hatch_size / 4.0 + CAIRO_AA_OFFSET_Y); /* draw lower connectors */ cairo_move_to (ct2, hatch_size / 4.0 + CAIRO_AA_OFFSET_X, 3 * hatch_size / 4.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_move_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_plaid_hatch (cairo_t *ct, cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double temp_size = 2; cairo_t *ct2; cairo_pattern_t *pattern; /* draw one hatch that has 50% of area as 50% hatch and remaining area * equally covered by each of foreground and background colors. */ cairo_surface_t *temp = cairo_surface_create_similar (cairo_get_target (ct), CAIRO_CONTENT_COLOR_ALPHA, temp_size, temp_size); if (cairo_surface_status (temp) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (temp); return CAIRO_STATUS_NO_MEMORY; } /* draw a 50% hatch */ ct2 = create_hatch_context (temp, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) { cairo_surface_destroy (temp); return CAIRO_STATUS_NO_MEMORY; } /* draw background */ draw_background (ct2, hbr->backColor, temp_size, temp_size); /* draw two diagonal lines in the foreground */ set_color (ct2, hbr->foreColor); cairo_rectangle (ct2, 0, 0, temp_size / 2.0, temp_size / 2.0); cairo_rectangle (ct2, temp_size / 2.0, temp_size / 2.0, temp_size, temp_size); cairo_fill (ct2); /* create the pattern for the consequent fill or stroke */ pattern = cairo_pattern_create_for_surface (temp); if (cairo_pattern_status (pattern) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (temp); cairo_destroy (ct2); cairo_pattern_destroy (pattern); return CAIRO_STATUS_NO_MEMORY; } cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); /* Clean up the 50% objects */ cairo_surface_destroy (temp); cairo_destroy (ct2); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) { cairo_pattern_destroy (pattern); return CAIRO_STATUS_NO_MEMORY; } /* temp hatch is used to fill 50% of area */ cairo_set_source(ct2, pattern); cairo_rectangle (ct2, 0, 0, hatch_size, hatch_size / 2.0); cairo_fill (ct2); /* draw two rectangle in the foregound to make up 50% of plaid */ /* foreground is filled with 25% of background color and 25% of foreground color */ set_color (ct2, hbr->foreColor); cairo_rectangle (ct2, 0, hatch_size / 2.0, hatch_size / 2.0, hatch_size / 2.0); cairo_fill (ct2); set_color (ct2, hbr->backColor); cairo_rectangle (ct2, hatch_size / 2.0, hatch_size / 2.0, hatch_size / 2.0, hatch_size / 2.0); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); cairo_pattern_destroy (pattern); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_divot_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); double x, y; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* set foreground */ set_color (ct2, hbr->foreColor); cairo_set_line_width (ct2, line_width); /* draw two angle brackets in the foreground */ x = hatch_size / 8.0 + CAIRO_AA_OFFSET_X; y = hatch_size / 8.0 + CAIRO_AA_OFFSET_Y; gdip_cairo_pixel (ct2, x, y); gdip_cairo_pixel (ct2, x + 1, y + 1); gdip_cairo_pixel (ct2, x, y + 2); x += 5; y += 6; gdip_cairo_pixel (ct2, x, y); gdip_cairo_pixel (ct2, x - 1, y - 1); gdip_cairo_pixel (ct2, x, y - 2); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_solid_diamond_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_wd = gdip_hatch_get_width (hbr); double hatch_ht = gdip_hatch_get_height (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_BUTT, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_wd, hatch_ht); /* draw two triangles in the foreground with left and right sides as their bases */ set_color (ct2, hbr->foreColor); /* draw left triangle */ cairo_move_to (ct2, -0.5, 0.5); cairo_line_to (ct2, hatch_wd / 2.0 - 0.5, hatch_ht / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, 0, hatch_ht); cairo_close_path (ct2); cairo_fill (ct2); /* draw right triangle */ cairo_move_to (ct2, hatch_wd, 0.5); cairo_line_to (ct2, hatch_wd / 2.0 + 0.5, hatch_ht / 2.0); cairo_line_to (ct2, hatch_wd, hatch_ht); cairo_close_path (ct2); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_shingle_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); double dash [] = {1.0}; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw two curves in the foreground */ set_color (ct2, hbr->foreColor); cairo_set_dash (ct2, dash, 1, 0); cairo_set_line_width (ct2, line_width); /* draw a curve thru left top, center and right top corners */ cairo_move_to (ct2, CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size / 4.0 + CAIRO_AA_OFFSET_X, hatch_size / 4.0 + CAIRO_AA_OFFSET_Y); cairo_curve_to (ct2, hatch_size / 4.0 + CAIRO_AA_OFFSET_X, hatch_size / 4.0 + CAIRO_AA_OFFSET_Y, hatch_size / 2.0 + CAIRO_AA_OFFSET_X, hatch_size / 2.0 + CAIRO_AA_OFFSET_Y, 3 * hatch_size / 4.0 + CAIRO_AA_OFFSET_X, hatch_size / 4.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size + CAIRO_AA_OFFSET_X, CAIRO_AA_OFFSET_Y); /* draw a quarter circle thru center and right bottom corner */ cairo_arc (ct2, CAIRO_AA_OFFSET_X, hatch_size + CAIRO_AA_OFFSET_Y, hatch_size, -PI/4.0, 0); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_trellis_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* note: we swap the colors (easier to draw this way) */ /* draw background */ draw_background (ct2, hbr->foreColor, hatch_size, hatch_size); /* draw rectangles in the foreground */ set_color (ct2, hbr->backColor); /* upper left rectangle */ cairo_rectangle (ct2,0, hatch_size / 4.0, hatch_size / 2.0, hatch_size / 4.0); /* lower right rectangle */ cairo_rectangle (ct2, hatch_size / 2.0, 3 * hatch_size / 4.0, hatch_size / 2.0, hatch_size / 4.0); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_sphere_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); double line_width = gdip_hatch_get_line_width (hbr); double rad = hatch_size / 4.0 + 0.5; /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw half circles in the foreground */ set_color (ct2, hbr->foreColor); /* left middle */ cairo_arc (ct2, 0, hatch_size / 2.0, rad, - PI / 2.0, PI / 2.0); cairo_fill (ct2); /* top middle */ cairo_arc (ct2, hatch_size / 2.0, 0, rad, 0, PI); cairo_fill (ct2); /* bottom middle */ cairo_arc (ct2, hatch_size / 2.0, hatch_size, rad, - PI, 0); cairo_fill (ct2); /* right middle */ cairo_arc (ct2, hatch_size, hatch_size / 2.0, rad, PI / 2.0, - PI / 2.0); cairo_fill (ct2); /* draw lines to mark sphere shining */ set_color (ct2, hbr->backColor); cairo_set_line_width (ct2, line_width); /* first line */ cairo_move_to (ct2, hatch_size - 1.0, hatch_size / 2.0 - rad / 2.0 + CAIRO_AA_OFFSET_Y); cairo_line_to (ct2, hatch_size - rad / 2.0 + CAIRO_AA_OFFSET_X, hatch_size / 2.0 - rad / 2.0 + CAIRO_AA_OFFSET_Y); /* second line */ cairo_move_to (ct2, hatch_size / 2.0 - rad / 4.0, hatch_size - rad / 2.0); cairo_line_to (ct2, hatch_size / 2.0 + rad / 4.0 - 1.0, hatch_size - rad / 2.0); cairo_stroke (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } static cairo_status_t draw_checker_hatch (cairo_surface_t *hatch, GpHatch *hbr) { double hatch_size = gdip_hatch_get_width (hbr); /* draw one hatch that has two colored squares at upper left and lower right corners */ /* hatch is not supposed to be affected by user matrix (so we create a new context) */ cairo_t *ct2 = create_hatch_context (hatch, CAIRO_LINE_CAP_SQUARE, FALSE); if (ct2 == NULL) return CAIRO_STATUS_NO_MEMORY; /* draw background */ draw_background (ct2, hbr->backColor, hatch_size, hatch_size); /* draw squares in the foreground */ set_color (ct2, hbr->foreColor); /* upper left square */ cairo_rectangle (ct2, 0, 0, hatch_size / 2.0, hatch_size / 2.0); /* lower right square */ cairo_rectangle (ct2, hatch_size / 2.0, hatch_size / 2.0, hatch_size, hatch_size); cairo_fill (ct2); /* clean up */ cairo_destroy (ct2); return CAIRO_STATUS_SUCCESS; } GpStatus gdip_hatch_setup (GpGraphics *graphics, GpBrush *brush) { GpHatch *hbr; cairo_t *ct; cairo_status_t status; if (!graphics || !brush) return InvalidParameter; ct = graphics->ct; if (!ct) return InvalidParameter; /* We create the new pattern for brush, if the brush is changed * or if pattern has not been created yet. */ hbr = (GpHatch *) brush; if (hbr->base.changed || (hbr->pattern) == NULL) { cairo_surface_t *hatch; cairo_antialias_t alias; int width = gdip_hatch_get_width (hbr); int height = gdip_hatch_get_height (hbr); /* destroy the existing pattern */ if (hbr->pattern) cairo_pattern_destroy (hbr->pattern); hatch = cairo_surface_create_similar (cairo_get_target (ct), CAIRO_CONTENT_COLOR_ALPHA, width, height); status = cairo_surface_status (hatch); if (status != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (hatch); return gdip_get_status (status); } alias = cairo_get_antialias (ct); cairo_set_antialias(ct, CAIRO_ANTIALIAS_NONE); switch (hbr->hatchStyle) { /* case HatchStyleMin: */ case HatchStyleHorizontal: case HatchStyleLightHorizontal: case HatchStyleNarrowHorizontal: case HatchStyleDarkHorizontal: status = draw_horizontal_hatch (hatch, hbr); break; case HatchStyleVertical: case HatchStyleLightVertical: case HatchStyleNarrowVertical: case HatchStyleDarkVertical: status = draw_vertical_hatch (hatch, hbr); break; case HatchStyleForwardDiagonal: status = draw_forward_diagonal_hatch (hatch, hbr); break; case HatchStyleBackwardDiagonal: status = draw_backward_diagonal_hatch (hatch, hbr); break; /* case HatchStyleCross: */ case HatchStyleLargeGrid: case HatchStyleSmallGrid: case HatchStyleDottedGrid: status = draw_cross_hatch (hatch, hbr); break; case HatchStyleDiagonalCross: status = draw_diagonal_cross_hatch (hatch, hbr); break; case HatchStyle05Percent: case HatchStyle10Percent: case HatchStyle20Percent: case HatchStyle25Percent: case HatchStyle70Percent: /* same as 25% but colors will be reversed (not a typo for 75) */ case HatchStyle75Percent: /* same as 20% but colors will be reversed (not a typo for 80) */ case HatchStyle80Percent: /* same as 10% but colors will be reversed (not a typo for 90) */ case HatchStyle90Percent: /* same as 5% but colors will be reversed (not a typo) */ status = draw_percent_hatch (hatch, hbr); break; case HatchStyle30Percent: case HatchStyle60Percent: /* same as 30% but colors will be reversed (not a typo for 70) */ case HatchStyleOutlinedDiamond: /* hack: perfect width */ case HatchStyleDottedDiamond: /* hack */ status = draw_30_percent_hatch (hatch, hbr); break; case HatchStyle40Percent: status = draw_40_percent_hatch (ct, hatch, hbr); break; case HatchStyle50Percent: status = draw_50_percent_hatch (hatch, hbr); break; case HatchStyleLightDownwardDiagonal: case HatchStyleWideDownwardDiagonal: status = draw_downward_diagonal_hatch (hatch, hbr); break; case HatchStyleDarkUpwardDiagonal: case HatchStyleDarkDownwardDiagonal: status = draw_dark_diagonal_hatch (hatch, hbr); break; case HatchStyleLightUpwardDiagonal: case HatchStyleWideUpwardDiagonal: status = draw_upward_diagonal_hatch (hatch, hbr); break; case HatchStyleDashedDownwardDiagonal: case HatchStyleDashedUpwardDiagonal: status = draw_dashed_diagonal_hatch (hatch, hbr); break; case HatchStyleDashedHorizontal: status = draw_dashed_horizontal_hatch (hatch, hbr); break; case HatchStyleDashedVertical: status = draw_dashed_vertical_hatch (hatch, hbr); break; case HatchStyleSmallConfetti: case HatchStyleLargeConfetti: status = draw_confetti_hatch (hatch, hbr); break; case HatchStyleZigZag: status = draw_zigzag_hatch (hatch, hbr); break; case HatchStyleWave: status = draw_wave_hatch (hatch, hbr); break; case HatchStyleDiagonalBrick: status = draw_diagonal_brick_hatch (hatch, hbr); break; case HatchStyleHorizontalBrick: status = draw_horizontal_brick_hatch (hatch, hbr); break; case HatchStyleWeave: status = draw_weave_hatch (hatch, hbr); break; case HatchStylePlaid: status = draw_plaid_hatch (ct, hatch, hbr); break; case HatchStyleDivot: status = draw_divot_hatch (hatch, hbr); break; case HatchStyleShingle: status = draw_shingle_hatch (hatch, hbr); break; case HatchStyleTrellis: status = draw_trellis_hatch (hatch, hbr); break; case HatchStyleSphere: status = draw_sphere_hatch (hatch, hbr); break; case HatchStyleSmallCheckerBoard: case HatchStyleLargeCheckerBoard: status = draw_checker_hatch (hatch, hbr); break; /* case HatchStyleMax: */ case HatchStyleSolidDiamond: status = draw_solid_diamond_hatch (hatch, hbr); break; default: status = CAIRO_STATUS_INVALID_RESTORE; /* will be converted into InvalidParameter */ break; } cairo_set_antialias (ct, alias); if (status != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy (hatch); return gdip_get_status (status); } /* create and verity the pattern created from the surface */ hbr->pattern = cairo_pattern_create_for_surface (hatch); status = cairo_pattern_status (hbr->pattern); if (status != CAIRO_STATUS_SUCCESS) { cairo_pattern_destroy (hbr->pattern); hbr->pattern = NULL; cairo_surface_destroy (hatch); return gdip_get_status (status); } /* finally set the pattern into the context and destroy the hatch surface */ cairo_pattern_set_extend (hbr->pattern, CAIRO_EXTEND_REPEAT); cairo_surface_destroy (hatch); } cairo_set_source (ct, hbr->pattern); return gdip_get_status (cairo_status (ct)); } GpStatus gdip_hatch_clone (GpBrush *brush, GpBrush **clonedBrush) { GpHatch *result; GpHatch *hatch; if (!brush || !clonedBrush) return InvalidParameter; result = (GpHatch *) GdipAlloc (sizeof (GpHatch)); if (!result) { *clonedBrush = NULL; return OutOfMemory; } hatch = (GpHatch *) brush; result->base = hatch->base; result->hatchStyle = hatch->hatchStyle; result->foreColor = hatch->foreColor; result->backColor = hatch->backColor; result->base.changed = TRUE; result->pattern = NULL; *clonedBrush = (GpBrush *) result; return Ok; } GpStatus gdip_hatch_destroy (GpBrush *brush) { /* a. the NULL check for brush is done by the caller, GdipDeleteBrush */ /* b. brush itself is freed by the caller */ GpHatch *hbr = (GpHatch *) brush; if (hbr->pattern) { cairo_pattern_destroy (hbr->pattern); hbr->pattern = NULL; } return Ok; } // coverity[+alloc : arg-*3] GpStatus GdipCreateHatchBrush (GpHatchStyle hatchstyle, ARGB forecolor, ARGB backcolor, GpHatch **brush) { if (!brush) return InvalidParameter; *brush = gdip_hatch_new (); if (!*brush) return OutOfMemory; (*brush)->hatchStyle = hatchstyle; (*brush)->foreColor = forecolor; (*brush)->backColor = backcolor; return Ok; } GpStatus GdipGetHatchStyle (GpHatch *brush, GpHatchStyle *hatchstyle) { if (!brush || !hatchstyle) return InvalidParameter; *hatchstyle = brush->hatchStyle; return Ok; } GpStatus GdipGetHatchForegroundColor (GpHatch *brush, ARGB *forecolor) { if (!brush || !forecolor) return InvalidParameter; *forecolor = brush->foreColor; return Ok; } GpStatus GdipGetHatchBackgroundColor (GpHatch *brush, ARGB *backcolor) { if (!brush || !backcolor) return InvalidParameter; *backcolor = brush->backColor; return Ok; } libgdiplus-4.2/src/gdiplus-private.h0000664000175000017500000000556312377405421014535 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __LIBGDIPLUS_H__ #define __LIBGDIPLUS_H__ #include #include #include #include #include FT_TRUETYPE_TABLES_H #include #include #include "config.h" #if HAVE_VISIBILITY_HIDDEN #define GDIP_INTERNAL __attribute__((visibility ("hidden"))) #else #define GDIP_INTERNAL #endif #ifdef USE_INCLUDED_CAIRO #include "cairo-embed.h" #include "cairo.h" #ifdef CAIRO_HAS_FT_FONT #include "cairo-ft.h" #endif #ifdef CAIRO_HAS_XLIB_SURFACE #include "cairo-xlib.h" #endif #else #include #ifdef CAIRO_HAS_FT_FONT #include #endif #ifdef CAIRO_HAS_XLIB_SURFACE #include #endif #endif #include #include "win32structs.h" #include "gdipenums.h" #include "gdipstructs.h" #include "general-private.h" typedef struct _AdjustableArrowCap GpAdjustableArrowCap; typedef struct _Brush GpBrush; typedef struct _CustomLineCap GpCustomLineCap; typedef struct _Font GpFont; typedef struct _FontCollection GpFontCollection; typedef struct _FontFamily GpFontFamily; typedef struct _Graphics GpGraphics; typedef struct _Hatch GpHatch; typedef struct _Image GpImage; typedef struct _ImageAttributes GpImageAttributes; typedef struct _LineGradient GpLineGradient; typedef struct _Metafile GpMetafile; typedef struct _Path GpPath; typedef struct _PathIterator GpPathIterator; typedef struct _PathGradient GpPathGradient; typedef struct _Pen GpPen; typedef struct _Region GpRegion; typedef struct _SolidFill GpSolidFill; typedef struct _StringFormat GpStringFormat; typedef struct _Texture GpTexture; #endif libgdiplus-4.2/src/pen-private.h0000664000175000017500000000545112377405421013644 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __PEN_PRIVATE_H__ #define __PEN_PRIVATE_H__ #include "gdiplus-private.h" #include "matrix-private.h" struct _Pen { int color; GpBrush *brush; BOOL own_brush; float width; float miter_limit; GpLineJoin line_join; GpDashStyle dash_style; GpLineCap line_cap; /* Cairo supports only same kind of end caps for both the ends. */ GpLineCap end_cap; GpDashCap dash_cap; /* not supported */ int compound_count; float *compound_array; GpPenAlignment mode; float dash_offset; int dash_count; BOOL own_dash_array; /* flag to mark if pen maintains its own array or global array */ float *dash_array; GpUnit unit; /* Always set to UnitWorld. */ cairo_matrix_t matrix; BOOL changed; /* flag to mark if pen is changed and needs setup */ GpCustomLineCap *custom_start_cap; GpCustomLineCap *custom_end_cap; }; GpStatus gdip_pen_setup (GpGraphics *graphics, GpPen *pen) GDIP_INTERNAL; GpStatus gdip_pen_draw_custom_start_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2); GpStatus gdip_pen_draw_custom_end_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2); #include "pen.h" #endif libgdiplus-4.2/src/general.h0000664000175000017500000000364212377405421013027 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __GENERAL_H__ #define __GENERAL_H__ #include "win32structs.h" /* Startup / shutdown */ typedef struct { UINT32 GdiplusVersion; /* must be 1 */ void* DebugEventCallback; /* ignored in libgdiplus */ BOOL SuppressBackgroundThread; /* ignored in libgdiplus */ BOOL SuppressExternalCodecs; /* ignored in libgdiplus */ } GdiplusStartupInput; typedef struct { void* NotificationHook; /* ignored in libgdiplus */ void* NotificationUnhook; /* ignored in libgdiplus */ } GdiplusStartupOutput; GpStatus GdiplusStartup (ULONG_PTR *token, const GdiplusStartupInput *input, GdiplusStartupOutput *output); void GdiplusShutdown (ULONG_PTR token); /* Memory / public API */ void* GdipAlloc (size_t size); void GdipFree (void *ptr); #endif libgdiplus-4.2/src/font.c0000664000175000017500000007076512377405421012365 00000000000000/* * Copyright (c) 2004 Ximian * Copyright (c) 2004-2007 Novell, Inc. * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jordi Mas i Hernandez , 2004-2006 * Peter Dennis Bartok * Sebastien Pouliot * Jeffrey Stedfast */ #include #include "gdiplus-private.h" #include "font-private.h" #include "fontcollection-private.h" #include "fontfamily-private.h" #include "graphics-private.h" /* Generic fonts families */ static GStaticMutex generic = G_STATIC_MUTEX_INIT; static GpFontFamily* familySerif = NULL; static GpFontFamily* familySansSerif = NULL; static GpFontFamily* familyMonospace = NULL; static int ref_familySerif = 0; static int ref_familySansSerif = 0; static int ref_familyMonospace = 0; /* Family and collections font functions */ static void gdip_createFontFamily (GpFontFamily **family) { GpFontFamily *result = (GpFontFamily *) GdipAlloc (sizeof (GpFontFamily)); if (result) { result->height = -1; result->linespacing = -1; result->celldescent = -1; result->cellascent = -1; result->pattern = NULL; result->allocated = FALSE; } *family = result; } static GpFontCollection *system_fonts = NULL; // coverity[+alloc : arg-*0] GpStatus GdipNewInstalledFontCollection (GpFontCollection **font_collection) { if (!font_collection) return InvalidParameter; /* * Ensure we leak this data only a single time, because: * (a) there is no API to free it; * (b) other libgdiplus structures depends on that allocated data; */ if (!system_fonts) { FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_FOUNDRY, NULL); FcPattern *pat = FcPatternCreate (); FcValue val; FcFontSet *col; /* Only Scalable fonts for now */ val.type = FcTypeBool; val.u.b = FcTrue; FcPatternAdd (pat, FC_SCALABLE, val, TRUE); FcObjectSetAdd (os, FC_SCALABLE); col = FcFontList (0, pat, os); FcPatternDestroy (pat); FcObjectSetDestroy (os); system_fonts = (GpFontCollection *) GdipAlloc (sizeof (GpFontCollection)); if (system_fonts) { system_fonts->fontset = col; system_fonts->config = NULL; } } *font_collection = system_fonts; return Ok; } // coverity[+alloc : arg-*0] GpStatus GdipNewPrivateFontCollection (GpFontCollection **font_collection) { GpFontCollection *result; if (!font_collection) return InvalidParameter; result = (GpFontCollection *) GdipAlloc (sizeof (GpFontCollection)); if (result) { result->fontset = NULL; result->config = FcConfigCreate (); } *font_collection = result; return Ok; } // coverity[+free : arg-0] GpStatus GdipDeletePrivateFontCollection (GpFontCollection **font_collection) { if (!font_collection) return InvalidParameter; if (*font_collection) { if ((*font_collection)->fontset != NULL) { FcFontSetDestroy ((*font_collection)->fontset); (*font_collection)->fontset = NULL; } if ((*font_collection)->config != NULL) { FcConfigDestroy ((*font_collection)->config); (*font_collection)->config = NULL; } GdipFree ((void *)*font_collection); } return Ok; } GpStatus GdipPrivateAddFontFile (GpFontCollection *font_collection, GDIPCONST WCHAR *filename) { BYTE *file; if (!font_collection || !filename) return InvalidParameter; file = (BYTE*) ucs2_to_utf8 ((const gunichar2 *)filename, -1); if (!file) return OutOfMemory; FcConfigAppFontAddFile (font_collection->config, file); GdipFree (file); return Ok; } GpStatus GdipCloneFontFamily (GpFontFamily *fontFamily, GpFontFamily **clonedFontFamily) { GpFontFamily *result; if (!fontFamily || !clonedFontFamily) return InvalidParameter; gdip_createFontFamily (&result); if (!result) return OutOfMemory; result->height = fontFamily->height; result->linespacing = fontFamily->linespacing; result->celldescent = fontFamily->celldescent; result->cellascent = fontFamily->cellascent; if (fontFamily->pattern) { result->pattern = FcPatternDuplicate (fontFamily->pattern); result->allocated = TRUE; } *clonedFontFamily = result; return Ok; } GpStatus GdipDeleteFontFamily (GpFontFamily *fontFamily) { BOOL delete = TRUE; if (!fontFamily) return InvalidParameter; g_static_mutex_lock (&generic); if (fontFamily == familySerif) { ref_familySerif--; if (ref_familySerif) delete = FALSE; else familySerif = NULL; } if (fontFamily == familySansSerif) { ref_familySansSerif--; if (ref_familySansSerif) delete = FALSE; else familySansSerif = NULL; } if (fontFamily == familyMonospace) { ref_familyMonospace--; if (ref_familyMonospace) delete = FALSE; else familyMonospace = NULL; } g_static_mutex_unlock (&generic); if (delete) { if (fontFamily->allocated) { FcPatternDestroy (fontFamily->pattern); fontFamily->pattern = NULL; } GdipFree (fontFamily); } return Ok; } static void gdip_createPrivateFontSet (GpFontCollection *font_collection) { FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_FOUNDRY, NULL); FcPattern *pat = FcPatternCreate (); FcFontSet *col = FcFontList (font_collection->config, pat, os); if (font_collection->fontset) FcFontSetDestroy (font_collection->fontset); FcPatternDestroy (pat); FcObjectSetDestroy (os); font_collection->fontset = col; } GpStatus GdipGetFontCollectionFamilyCount (GpFontCollection *font_collection, int *numFound) { if (!font_collection || !numFound) return InvalidParameter; if (font_collection->config) gdip_createPrivateFontSet (font_collection); if (font_collection->fontset) *numFound = font_collection->fontset->nfont; else *numFound = 0; return Ok; } GpStatus GdipGetFontCollectionFamilyList (GpFontCollection *font_collection, int num_sought, GpFontFamily *gpfamilies[], int *num_found) { int i; if (!font_collection || !gpfamilies || !num_found) return InvalidParameter; if (font_collection->config) gdip_createPrivateFontSet (font_collection); for (i = 0; i < font_collection->fontset->nfont; i++) { gdip_createFontFamily(&gpfamilies[i]); gpfamilies[i]->pattern = font_collection->fontset->fonts[i]; gpfamilies[i]->allocated = FALSE; } *num_found = font_collection->fontset->nfont; return Ok; } static GpStatus gdip_status_from_fontconfig (FcResult result) { switch (result) { case FcResultMatch: return Ok; case FcResultNoMatch: case FcResultTypeMismatch: case FcResultNoId: return FontFamilyNotFound; default: return GenericError; } } /* note: MUST be executed inside a lock because FcConfig isn't thread-safe */ static FcPattern* create_pattern_from_name (char* name) { FcValue val; /* FcResult must be initialized because it's changed only in error conditions */ FcResult rlt = FcResultMatch; FcPattern *full_pattern = NULL; FcPattern *name_pattern = FcPatternCreate (); if (!name_pattern) return NULL; /* find the family we want */ val.type = FcTypeString; val.u.s = (BYTE*)name; if (!FcPatternAdd (name_pattern, FC_FAMILY, val, TRUE)) { FcPatternDestroy (name_pattern); return NULL; } if (!FcConfigSubstitute (0, name_pattern, FcMatchPattern)) { FcPatternDestroy (name_pattern); return NULL; } FcDefaultSubstitute (name_pattern); full_pattern = FcFontMatch (0, name_pattern, &rlt); if (gdip_status_from_fontconfig (rlt) == Ok) { if (full_pattern == NULL) { full_pattern = name_pattern; } else { FcPatternDestroy (name_pattern); } } else { FcPatternDestroy (name_pattern); if (full_pattern) { FcPatternDestroy (full_pattern); full_pattern = NULL; } } return full_pattern; } static GStaticMutex patterns_mutex = G_STATIC_MUTEX_INIT; static GHashTable *patterns_hashtable = NULL; static GpStatus create_fontfamily_from_name (char* name, GpFontFamily **fontFamily) { GpStatus status = FontFamilyNotFound; GpFontFamily *ff = NULL; FcPattern *pat = NULL; g_static_mutex_lock (&patterns_mutex); if (patterns_hashtable) { pat = (FcPattern*) g_hash_table_lookup (patterns_hashtable, name); } else { patterns_hashtable = g_hash_table_new (g_str_hash, g_str_equal); } if (!pat) { pat = create_pattern_from_name (name); if (pat) { /* create the pattern and store it for further usage */ g_hash_table_insert (patterns_hashtable, g_strdup (name), pat); } } if (pat) { gdip_createFontFamily (&ff); if (ff) { ff->pattern = pat; ff->allocated = FALSE; status = Ok; } else status = OutOfMemory; } *fontFamily = ff; g_static_mutex_unlock (&patterns_mutex); return status; } static BOOL free_cached_pattern (gpointer key, gpointer value, gpointer user) { g_free (key); FcPatternDestroy ((FcPattern*) value); return TRUE; } void gdip_font_clear_pattern_cache (void) { g_static_mutex_lock (&patterns_mutex); if (patterns_hashtable) { g_hash_table_foreach_remove (patterns_hashtable, free_cached_pattern, NULL); g_hash_table_destroy (patterns_hashtable); } g_static_mutex_unlock (&patterns_mutex); } static GpStatus create_fontfamily_from_collection (char* name, GpFontCollection *font_collection, GpFontFamily **fontFamily) { /* note: fontset can be NULL when we supply an empty private collection */ if (font_collection->fontset) { int i; FcChar8 *str; FcPattern **gpfam = font_collection->fontset->fonts; for (i=0; i < font_collection->fontset->nfont; gpfam++, i++) { FcResult rlt = FcPatternGetString (*gpfam, FC_FAMILY, 0, &str); GpStatus status = gdip_status_from_fontconfig (rlt); if (status != Ok) return status; if (strcmp ((char *)name, (const char *)str) == 0) { gdip_createFontFamily (fontFamily); (*fontFamily)->pattern = *gpfam; (*fontFamily)->allocated = FALSE; return Ok; } } } return FontFamilyNotFound; } // coverity[+alloc : arg-*2] GpStatus GdipCreateFontFamilyFromName (GDIPCONST WCHAR *name, GpFontCollection *font_collection, GpFontFamily **fontFamily) { GpStatus status; char *string; if (!name || !fontFamily) return InvalidParameter; string = (char*)ucs2_to_utf8 ((const gunichar2 *)name, -1); if (!string) return OutOfMemory; if (font_collection) { status = create_fontfamily_from_collection (string, font_collection, fontFamily); } else { status = create_fontfamily_from_name (string, fontFamily); } GdipFree (string); return status; } GpStatus GdipGetFamilyName (GDIPCONST GpFontFamily *family, WCHAR name[LF_FACESIZE], int language) { GpStatus status; FcChar8 *fc_str; FcResult r; if (!family) return InvalidParameter; r = FcPatternGetString (family->pattern, FC_FAMILY, 0, &fc_str); status = gdip_status_from_fontconfig (r); if (status != Ok) return status; utf8_to_ucs2((const gchar *)fc_str, (gunichar2 *)name, LF_FACESIZE); return Ok; } // coverity[+alloc : arg-*0] GpStatus GdipGetGenericFontFamilySansSerif (GpFontFamily **nativeFamily) { const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ', 'S','e','r','i','f', 0}; GpStatus status = Ok; g_static_mutex_lock (&generic); if (ref_familySansSerif == 0) status = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &familySansSerif); if (status == Ok) ref_familySansSerif++; else familySansSerif = NULL; g_static_mutex_unlock (&generic); *nativeFamily = familySansSerif; return status; } // coverity[+alloc : arg-*0] GpStatus GdipGetGenericFontFamilySerif (GpFontFamily **nativeFamily) { const WCHAR Serif[] = {'S','e','r','i','f', 0}; GpStatus status = Ok; g_static_mutex_lock (&generic); if (ref_familySerif == 0) status = GdipCreateFontFamilyFromName (Serif, NULL, &familySerif); if (status == Ok) ref_familySerif++; else familySerif = NULL; g_static_mutex_unlock (&generic); *nativeFamily = familySerif; return status; } // coverity[+alloc : arg-*0] GpStatus GdipGetGenericFontFamilyMonospace (GpFontFamily **nativeFamily) { const WCHAR Monospace[] = {'C','o','u','r','i', 'e', 'r', ' ', 'N', 'e', 'w', 0}; GpStatus status = Ok; g_static_mutex_lock (&generic); if (ref_familyMonospace == 0) status = GdipCreateFontFamilyFromName (Monospace, NULL, &familyMonospace); if (status == Ok) ref_familyMonospace++; else familyMonospace = NULL; g_static_mutex_unlock (&generic); *nativeFamily = familyMonospace; return status; } /* OpenType's OS/2 fsSelection Table: * * http://www.microsoft.com/typography/otspec/os2.htm#fss */ enum fsSelection { fsSelectionItalic = (1 << 0), fsSelectionUnderscore = (1 << 1), fsSelectionNegative = (1 << 2), fsSelectionOutlined = (1 << 3), fsSelectionStrikeout = (1 << 4), fsSelectionBold = (1 << 5), fsSelectionRegular = (1 << 6), fsSelectionUseTypoMetrics = (1 << 7), fsSelectionWWS = (1 << 8), fsSelectionOblique = (1 << 9), }; static void gdip_get_fontfamily_details_from_freetype (GpFontFamily *family, FT_Face face) { if (FT_IS_SFNT (face)) { TT_HoriHeader *hhea = FT_Get_Sfnt_Table (face, ft_sfnt_hhea); TT_OS2 *os2 = FT_Get_Sfnt_Table (face, ft_sfnt_os2); if (os2 && (os2->fsSelection & fsSelectionUseTypoMetrics)) { /* Use the typographic Ascender, Descender, and LineGap values for everything. */ family->linespacing = os2->sTypoAscender - os2->sTypoDescender + os2->sTypoLineGap; family->celldescent = -os2->sTypoDescender; family->cellascent = os2->sTypoAscender; } else { /* Calculate the LineSpacing for both the hhea table and the OS/2 table. */ int hhea_linespacing = hhea->Ascender + abs (hhea->Descender) + hhea->Line_Gap; int os2_linespacing = os2 ? (os2->usWinAscent + os2->usWinDescent) : 0; /* The LineSpacing is the maximum of the two sumations. */ family->linespacing = MAX (hhea_linespacing, os2_linespacing); /* If the OS/2 table exists, use usWinDescent as the * CellDescent. Otherwise use hhea's Descender value. */ family->celldescent = os2 ? os2->usWinDescent : hhea->Descender; /* If the OS/2 table exists, use usWinAscent as the * CellAscent. Otherwise use hhea's Ascender value. */ family->cellascent = os2 ? os2->usWinAscent : hhea->Ascender; } } else { /* Fall back to using whatever FreeType2 provides. */ family->celldescent = -face->descender; family->cellascent = face->ascender; family->linespacing = face->height; } family->height = face->units_per_EM; } #ifdef USE_PANGO_RENDERING PangoFontDescription* gdip_get_pango_font_description (GpFont *font) { if (!font->pango) { font->pango = pango_font_description_from_string ((char*)font->face); pango_font_description_set_size (font->pango, font->emSize * PANGO_SCALE); if (font->style & FontStyleBold) pango_font_description_set_weight (font->pango, PANGO_WEIGHT_BOLD); if (font->style & FontStyleItalic) pango_font_description_set_style (font->pango, PANGO_STYLE_ITALIC); } return font->pango; } static GpStatus gdip_get_fontfamily_details (GpFontFamily *family, FontStyle style) { GpFont *font = NULL; GpStatus status = GdipCreateFont (family, 8.0f, style, UnitPoint, &font); if ((status == Ok) && font) { PangoFontMap *map = pango_cairo_font_map_get_default (); /* owned by pango */ PangoContext *context = pango_cairo_font_map_create_context ((PangoCairoFontMap*)map); PangoFont *pf = pango_font_map_load_font (map, context, gdip_get_pango_font_description (font)); FT_Face face = pango_fc_font_lock_face ((PangoFcFont*)pf); if (face) { gdip_get_fontfamily_details_from_freetype (family, face); pango_fc_font_unlock_face ((PangoFcFont*)pf); } else { status = FontFamilyNotFound; } g_object_unref (context); } if (font) GdipDeleteFont (font); return status; } #else cairo_font_face_t* gdip_get_cairo_font_face (GpFont *font) { if (!font->cairofnt) { #if CAIRO_HAS_QUARTZ_FONT FcPattern *pattern = FcPatternBuild ( NULL, FC_FAMILY, FcTypeString, font->face, FC_SLANT, FcTypeInteger, ((font->style & FontStyleItalic) ? FC_SLANT_ITALIC : FC_SLANT_ROMAN), FC_WEIGHT, FcTypeInteger, ((font->style & FontStyleBold) ? FC_WEIGHT_BOLD : FC_WEIGHT_MEDIUM), NULL); font->cairofnt = cairo_ft_font_face_create_for_pattern (pattern); cairo_font_face_reference (font->cairofnt); FcPatternDestroy (pattern); #else cairo_surface_t *surface = cairo_image_surface_create_for_data ((BYTE*)NULL, CAIRO_FORMAT_ARGB32, 0, 0, 0); font->cairo = cairo_create (surface); cairo_select_font_face (font->cairo, (const char *)font->face, (font->style & FontStyleItalic) ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, (font->style & FontStyleBold) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); font->cairofnt = cairo_get_font_face (font->cairo); cairo_font_face_reference (font->cairofnt); cairo_surface_destroy (surface); #endif } return font->cairofnt; } static GpStatus gdip_get_fontfamily_details (GpFontFamily *family, FontStyle style) { GpFont *font = NULL; GpStatus status = GdipCreateFont (family, 0.0f, style, UnitPoint, &font); if ((status == Ok) && font) { cairo_scaled_font_t* scaled_ft; FT_Face face = NULL; cairo_matrix_t matrix1, matrix2; cairo_font_options_t *options = cairo_font_options_create (); cairo_font_face_t* cairofnt = gdip_get_cairo_font_face (font); cairo_matrix_init (&matrix1, 1, 0, 0, 1, 0, 0); cairo_matrix_init (&matrix2, 1, 0, 0, 1, 0, 0); scaled_ft = cairo_scaled_font_create (cairofnt, &matrix1, &matrix2, options); /* a missing fonts.conf will resuls in a NULL *scaled_ft (#78237) */ if (!scaled_ft) { static int flag = 0; if (flag == 0) { g_warning ("couldn't lock the font face. this may be due to a missing fonts.conf on the system."); flag = 1; } status = FontFamilyNotFound; } if (status == Ok) face = cairo_ft_scaled_font_lock_face (scaled_ft); cairo_font_options_destroy (options); if (face) { gdip_get_fontfamily_details_from_freetype (family, face); cairo_ft_scaled_font_unlock_face (scaled_ft); cairo_scaled_font_destroy (scaled_ft); } else { status = FontFamilyNotFound; } } if (font) GdipDeleteFont (font); return status; } #endif GpStatus GdipGetEmHeight (GDIPCONST GpFontFamily *family, int style, guint16 *EmHeight) { GpStatus status = Ok; if (!family || !EmHeight) return InvalidParameter; if (family->height == -1) status = gdip_get_fontfamily_details ((GpFontFamily*)family, style); *EmHeight = family->height; return status; } GpStatus GdipGetCellAscent (GDIPCONST GpFontFamily *family, int style, guint16 *CellAscent) { GpStatus status = Ok; if (!family || !CellAscent) return InvalidParameter; if (family->cellascent == -1) status = gdip_get_fontfamily_details ((GpFontFamily*)family, style); *CellAscent = family->cellascent; return status; } GpStatus GdipGetCellDescent (GDIPCONST GpFontFamily *family, int style, guint16 *CellDescent) { GpStatus status = Ok; if (!family || !CellDescent) return InvalidParameter; if (family->celldescent == -1) status = gdip_get_fontfamily_details ((GpFontFamily*)family, style); *CellDescent = family->celldescent; return status; } GpStatus GdipGetLineSpacing (GDIPCONST GpFontFamily *family, int style, guint16 *LineSpacing) { GpStatus status = Ok; if (!family || !LineSpacing) return InvalidParameter; if (family->linespacing == -1) status = gdip_get_fontfamily_details ((GpFontFamily*)family, style); *LineSpacing = family->linespacing; return status; } GpStatus GdipIsStyleAvailable (GDIPCONST GpFontFamily *family, int style, BOOL *IsStyleAvailable) { if (!family || !IsStyleAvailable) return InvalidParameter; *IsStyleAvailable = TRUE; return Ok; } /* Font functions */ // coverity[+alloc : arg-*4] GpStatus GdipCreateFont (GDIPCONST GpFontFamily* family, float emSize, int style, Unit unit, GpFont **font) { GpStatus status; FcChar8* str; FcResult r; GpFont *result; float sizeInPixels; if (!family || !font || (unit == UnitDisplay)) return InvalidParameter; r = FcPatternGetString (family->pattern, FC_FAMILY, 0, &str); status = gdip_status_from_fontconfig (r); if (status != Ok) return status; sizeInPixels = gdip_unit_conversion (unit, UnitPixel, gdip_get_display_dpi(), gtMemoryBitmap, emSize); result = (GpFont *) GdipAlloc (sizeof (GpFont)); result->sizeInPixels = sizeInPixels; result->face = GdipAlloc(strlen((char *)str) + 1); if (!result->face) { GdipFree(result); return OutOfMemory; } memcpy(result->face, str, strlen((char *)str) + 1); result->style = style; result->emSize = emSize; result->unit = unit; GdipCloneFontFamily ((GpFontFamily*) family, &result->family); result->style = style; #ifdef USE_PANGO_RENDERING result->pango = NULL; #else result->cairofnt = NULL; result->cairo = NULL; gdip_get_cairo_font_face (result); #endif *font = result; return Ok; } GpStatus GdipDeleteFont (GpFont* font) { if (!font) return InvalidParameter; if (font->family) GdipDeleteFontFamily (font->family); #ifdef USE_PANGO_RENDERING if (font->pango) pango_font_description_free (font->pango); #else if (font->cairofnt) cairo_font_face_destroy (font->cairofnt); if (font->cairo) cairo_destroy (font->cairo); #endif GdipFree (font->face); GdipFree (font); return Ok; } GpStatus GdipCreateFontFromDC(void *hdc, GpFont **font) { return(NotImplemented); } static GpStatus gdip_logfont_from_font (GpFont *font, GpGraphics *graphics, void *lf, BOOL ucs2) { LOGFONTA *logFont; if (!lf) return InvalidParameter; logFont = (LOGFONTA *)lf; /* will be changed back to 1 inside System.Drawing */ logFont->lfCharSet = 0; if (!font || !graphics) { int size = (ucs2) ? 2 * LF_FACESIZE : LF_FACESIZE; memset (logFont->lfFaceName, 0, size); return InvalidParameter; } logFont->lfHeight = -(font->sizeInPixels); logFont->lfWidth = 0; logFont->lfEscapement = 0; // FIXME logFont->lfOrientation = logFont->lfEscapement; if (font->style & FontStyleBold) { logFont->lfWeight = 700; } else { logFont->lfWeight = 400; } if (font->style & FontStyleItalic) { logFont->lfItalic = 1; } else { logFont->lfItalic = 0; } if (font->style & FontStyleUnderline) { logFont->lfUnderline = 1; } else { logFont->lfUnderline = 0; } if (font->style & FontStyleStrikeout) { logFont->lfStrikeOut = 1; } else { logFont->lfStrikeOut = 0; } logFont->lfOutPrecision = 0; logFont->lfClipPrecision = 0; switch (graphics->text_mode) { case TextRenderingHintSystemDefault: { logFont->lfQuality = 0; break; } case TextRenderingHintSingleBitPerPixelGridFit: case TextRenderingHintSingleBitPerPixel: case TextRenderingHintAntiAliasGridFit: case TextRenderingHintAntiAlias: { logFont->lfQuality = 3; // ANTIALIASED_QUALITY; break; } case TextRenderingHintClearTypeGridFit: { logFont->lfQuality = 5; // CLEARTYPE_QUALITY break; } } logFont->lfPitchAndFamily = 0; if (ucs2) { utf8_to_ucs2((const gchar *)font->face, (gunichar2 *)logFont->lfFaceName, LF_FACESIZE); } else { int len = strlen ((char*)font->face); memset (logFont->lfFaceName, 0, LF_FACESIZE); memcpy (logFont->lfFaceName, font->face, len < LF_FACESIZE ? len : LF_FACESIZE - 1); } return Ok; } // coverity[+alloc : arg-*1] GpStatus GdipCreateFontFromHfontA(void *hfont, GpFont **font, void *lf) { GpFont *src_font; GpFont *result; src_font = (GpFont *)hfont; result = (GpFont *) GdipAlloc (sizeof (GpFont)); if (!result) return OutOfMemory; result->sizeInPixels = src_font->sizeInPixels; result->style = src_font->style; GdipCloneFontFamily (src_font->family, &result->family); result->style = src_font->style; result->emSize = src_font->emSize; result->unit = src_font->unit; result->face = GdipAlloc(strlen((char *)src_font->face) + 1); if (!result->face) { GdipFree(result); return OutOfMemory; } memcpy(result->face, src_font->face, strlen((char *)src_font->face) + 1); *font = result; return gdip_logfont_from_font (result, NULL, lf, FALSE); } GpStatus GdipGetLogFontW (GpFont *font, GpGraphics *graphics, LOGFONTW *logfontW) { return gdip_logfont_from_font (font, graphics, logfontW, TRUE); } GpStatus GdipGetLogFontA (GpFont *font, GpGraphics *graphics, LOGFONTA *logfontA) { return gdip_logfont_from_font (font, graphics, logfontA, FALSE); } static GpStatus gdip_create_font_from_logfont (void *hdc, void *lf, GpFont **font, BOOL ucs2) { GpFont *result = (GpFont*) GdipAlloc (sizeof (GpFont)); LOGFONTA *logfont = (LOGFONTA *)lf; if (logfont->lfHeight < 0) { result->sizeInPixels = fabs (logfont->lfHeight); } else { result->sizeInPixels = logfont->lfHeight; // Fixme - convert units } result->style = 0; result->family = NULL; /* Fixme - this is wrong, but I don't know of a quick way to get the emSize */ result->emSize = result->sizeInPixels; result->unit = UnitPixel; if (logfont->lfItalic) { result->style |= FontStyleItalic; } if (logfont->lfWeight > 400) { result->style |= FontStyleBold; } if (logfont->lfUnderline) { result->style |= FontStyleUnderline; } if (logfont->lfStrikeOut) { result->style |= FontStyleStrikeout; } if (ucs2) { result->face = (BYTE*) ucs2_to_utf8 ((const gunichar2 *)logfont->lfFaceName, -1); if (!result->face){ GdipFree (result); return OutOfMemory; } } else { result->face = GdipAlloc(LF_FACESIZE); if (!result->face){ GdipFree (result); return OutOfMemory; } memcpy(result->face, logfont->lfFaceName, LF_FACESIZE); result->face[LF_FACESIZE - 1] = '\0'; } *font = result; return Ok; } // coverity[+alloc : arg-*2] GpStatus GdipCreateFontFromLogfontA(void *hdc, GDIPCONST LOGFONTA *logfont, GpFont **font) { return gdip_create_font_from_logfont(hdc, (void *)logfont, font, FALSE); } // coverity[+alloc : arg-*2] GpStatus GdipCreateFontFromLogfontW(void *hdc, GDIPCONST LOGFONTW *logfont, GpFont **font) { return gdip_create_font_from_logfont(hdc, (void *)logfont, font, TRUE); } GpStatus GdipPrivateAddMemoryFont(GpFontCollection *fontCollection, GDIPCONST void *memory, int length) { FcBool result; FcChar8 fontfile[256]; int f; if (!memory) return InvalidParameter; strcpy((char *) fontfile, "/tmp/ffXXXXXX"); f = mkstemp((char*)fontfile); if (f == -1) return FileNotFound; if (write(f, memory, length)!=length) { close(f); return FileNotFound; } close(f); /* FIXME - this doesn't seems to catch "bad" (e.g. invalid) font files */ result = FcConfigAppFontAddFile (fontCollection->config, fontfile); /* FIXME - May we delete our temporary font file or does FcConfigAppFontAddFile just reference our file? */ /* unlink(fontfile); */ return result ? Ok : FileNotFound; } GpStatus GdipGetFontHeight (GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, float *height) { GpStatus status; guint16 emHeight, lineSpacing; float emSize, h; if (!font || !height || !graphics) return InvalidParameter; status = GdipGetEmHeight (font->family, font->style, &emHeight); if (status != Ok) return status; status = GdipGetLineSpacing (font->family, font->style, &lineSpacing); if (status != Ok) return status; /* Operations in display dpi's */ emSize = gdip_unit_conversion (font->unit, UnitPixel, gdip_get_display_dpi (), gtMemoryBitmap, font->emSize); h = lineSpacing * (emSize / emHeight); *height = gdip_unit_conversion (UnitPixel, graphics->page_unit, gdip_get_display_dpi (), graphics->type, h); return Ok; } GpStatus GdipGetFontHeightGivenDPI (GDIPCONST GpFont *font, float dpi, float *height) { GpStatus status; guint16 emHeight, lineSpacing; float h; if (!font || !height) return InvalidParameter; status = GdipGetEmHeight (font->family, font->style, &emHeight); if (status != Ok) return status; status = GdipGetLineSpacing (font->family, font->style, &lineSpacing); if (status != Ok) return status; h = lineSpacing * (font->emSize / emHeight); *height = gdip_unit_conversion (font->unit, UnitInch, dpi, gtMemoryBitmap, h) * dpi; return Ok; } GpStatus GdipGetFontSize (GpFont *font, float *size) { if (!font ||!size) return InvalidParameter; *size = font->emSize; return Ok; } libgdiplus-4.2/src/lineargradientbrush-private.h0000664000175000017500000000423212377405421017112 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __LINEARGRADIENT_PRIVATE_H__ #define __LINEARGRADIENT_PRIVATE_H__ #include "gdiplus-private.h" #include "brush-private.h" #include "matrix-private.h" #define DEFAULT_GRADIENT_ANGLE 45.0f typedef struct _LineGradient { GpBrush base; ARGB lineColors [2]; GpPointF points [2]; GpRectF rectangle; GpMatrix matrix; GpWrapMode wrapMode; float angle; Blend *blend; InterpolationColors *presetColors; cairo_pattern_t *pattern; BOOL isAngleScalable; BOOL gammaCorrection; /* FIXME: Not used */ } LineGradient; #include "lineargradientbrush.h" #endif libgdiplus-4.2/src/pngcodec.c0000664000175000017500000006026412377405421013172 00000000000000/* * pngcodec.c : Contains function definitions for encoding decoding png images * * Copyright (C) 2003-2004,2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic * Jonathan Gilbert (logic@deltaq.org) * */ #if HAVE_CONFIG_H #include #endif #include "win32structs.h" GUID gdip_png_image_format_guid = {0xb96b3cafU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; #ifdef HAVE_LIBPNG #include #include "gdiplus-private.h" #include "pngcodec.h" #include /* Codecinfo related data*/ static ImageCodecInfo png_codec; static const WCHAR png_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'P', 'N', 'G', 0}; /* Built-in PNG */ static const WCHAR png_extension[] = {'*', '.', 'P', 'N', 'G', 0}; /* *.PNG */ static const WCHAR png_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'p', 'n', 'g', 0}; /* image/png */ static const WCHAR png_format[] = {'P', 'N', 'G', 0}; /* PNG */ static const BYTE png_sig_pattern[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; static const BYTE png_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; ImageCodecInfo * gdip_getcodecinfo_png () { png_codec.Clsid = (CLSID) { 0x557cf406, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; png_codec.FormatID = gdip_png_image_format_guid; png_codec.CodecName = (const WCHAR*) png_codecname; png_codec.DllName = NULL; png_codec.FormatDescription = (const WCHAR*) png_format; png_codec.FilenameExtension = (const WCHAR*) png_extension; png_codec.MimeType = (const WCHAR*) png_mimetype; png_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; png_codec.Version = 1; png_codec.SigCount = 1; png_codec.SigSize = 8; png_codec.SigPattern = png_sig_pattern; png_codec.SigMask = png_sig_mask; return &png_codec; } #if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp) #define sigjmp_buf jmp_buf #define sigsetjmp(jb, x) setjmp(jb) #define siglongjmp longjmp #endif static void _gdip_png_stream_read_data (png_structp png_ptr, png_bytep data, png_size_t length) { GetBytesDelegate getBytesFunc; int bytesRead; int res; getBytesFunc = (GetBytesDelegate) png_get_io_ptr (png_ptr); /* In png parlance, it is an error to read less than length */ bytesRead = 0; while (bytesRead != length) { res = getBytesFunc (data + bytesRead, length - bytesRead, 0); if (res <= 0) { png_error(png_ptr, "Read failed"); } bytesRead += res; } } static void _gdip_png_stream_write_data (png_structp png_ptr, png_bytep data, png_size_t length) { PutBytesDelegate putBytesFunc = (PutBytesDelegate) png_get_io_ptr (png_ptr); putBytesFunc (data, length); } static void _gdip_png_stream_flush_data (png_structp png_ptr) { /* nothing */ } static GpStatus gdip_load_png_properties (png_structp png_ptr, png_infop info_ptr, png_infop end_ptr, BitmapData *bitmap_data) { #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) bitmap_data->image_flags |= ImageFlagsHasRealDPI; bitmap_data->dpi_horz = png_get_x_pixels_per_inch(png_ptr, info_ptr); bitmap_data->dpi_vert = png_get_y_pixels_per_inch(png_ptr, info_ptr); #elif defined(PNG_pHYs_SUPPORTED) { int unit_type; png_uint_32 res_x; png_uint_32 res_y; png_get_pHYs( png_ptr, info_ptr, &res_x, &res_y, &unit_type ); if (unit_type == PNG_RESOLUTION_METER) { bitmap_data->image_flags |= ImageFlagsHasRealDPI; bitmap_data->dpi_horz = res_x * 0.0254; bitmap_data->dpi_vert = res_y * 0.0254; } } #endif /* default to screen resolution (if nothing was provided or available) */ if (bitmap_data->dpi_horz == 0 || bitmap_data->dpi_vert == 0) { bitmap_data->dpi_horz = bitmap_data->dpi_vert = gdip_get_display_dpi (); } #if defined(PNG_iCCP_SUPPORTED) { png_charp name; png_charp profile; png_uint_32 proflen; int compression_type; if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, &proflen)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagICCProfileDescriptor, (BYTE*)name); gdip_bitmapdata_property_add_byte(bitmap_data, PropertyTagICCProfile, (BYTE)compression_type); } } #endif #if defined(PNG_gAMA_SUPPORTED) { double gamma; if (png_get_gAMA(png_ptr, info_ptr, &gamma)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagGamma, 100000, gamma * 100000); } } #endif #if defined(PNG_cHRM_SUPPORTED) { double white_x; double white_y; double red_x; double red_y; double green_x; double green_y; double blue_x; double blue_y; if (png_get_cHRM(png_ptr, info_ptr, &white_x, &white_y, &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y)) { BYTE *buffer; guint32 *ptr; buffer = GdipAlloc(6 * (sizeof(png_uint_32) + sizeof(png_uint_32))); if (buffer != NULL) { ptr = (guint32 *)buffer; ptr[0] = (guint32)(red_x * 100000); ptr[1] = 1000000; ptr[2] = (guint32)(red_y * 100000); ptr[3] = 100000; ptr[4] = (guint32)(green_x * 100000); ptr[5] = 1000000; ptr[6] = (guint32)(green_y * 100000); ptr[7] = 100000; ptr[8] = (guint32)(blue_x * 100000); ptr[9] = 100000; ptr[10] = (guint32)(blue_y * 100000); ptr[11] = 100000; gdip_bitmapdata_property_add (bitmap_data, PropertyTagPrimaryChromaticities, 6 * (sizeof(guint32) + sizeof(guint32)), PropertyTagTypeRational, buffer); ptr[0] = (guint32)(white_x * 100000); ptr[1] = 1000000; ptr[2] = (guint32)(white_y * 100000); ptr[3] = 100000; gdip_bitmapdata_property_add (bitmap_data, PropertyTagWhitePoint, 2 * (sizeof(guint32) + sizeof(guint32)), PropertyTagTypeRational, buffer); GdipFree(buffer); } } } #endif #if defined(PNG_pHYs_SUPPORTED) { int unit_type; png_uint_32 res_x; png_uint_32 res_y; if (png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, &unit_type)) { gdip_bitmapdata_property_add_byte(bitmap_data, PropertyTagPixelUnit, (BYTE)unit_type); gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagPixelPerUnitX, res_x); gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagPixelPerUnitY, res_y); } } #endif #if defined(PNG_TEXT_SUPPORTED) { int num_text; png_textp text_ptr; if (png_get_text(png_ptr, info_ptr, &text_ptr, &num_text)) { if (num_text > 0) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagExifUserComment, (BYTE*)text_ptr[0].text); } } } #endif return Ok; } static GpStatus gdip_load_png_image_from_file_or_stream (FILE *fp, GetBytesDelegate getBytesFunc, GpImage **image) { png_structp png_ptr = NULL; png_infop info_ptr = NULL; png_infop end_info_ptr = NULL; BYTE *rawdata = NULL; GpImage *result = NULL; GpStatus status = InvalidParameter; int bit_depth; int channels; BYTE color_type; int num_palette; png_colorp png_palette; png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { goto error; } if (setjmp(png_jmpbuf(png_ptr))) { /* png detected error occured */ goto error; } info_ptr = png_create_info_struct (png_ptr); if (info_ptr == NULL) { goto error; } end_info_ptr = png_create_info_struct (png_ptr); if (end_info_ptr == NULL) { goto error; } if (fp != NULL) { png_init_io (png_ptr, fp); } else { png_set_read_fn (png_ptr, getBytesFunc, _gdip_png_stream_read_data); } png_read_png (png_ptr, info_ptr, 0, NULL); bit_depth = png_get_bit_depth (png_ptr, info_ptr); channels = png_get_channels (png_ptr, info_ptr); color_type = png_get_color_type (png_ptr, info_ptr); png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette ); /* 2bpp is a special case (promoted to 32bpp ARGB by MS GDI+) */ if ((bit_depth <= 8) && (bit_depth != 2) && (channels == 1) && ((color_type == PNG_COLOR_TYPE_PALETTE) || (color_type == PNG_COLOR_TYPE_GRAY))) { int width; int height; int source_stride; int dest_stride; png_bytep *row_pointers; BYTE *rawptr; int num_colours; int palette_entries; ColorPalette *palette; ImageFlags colourspace_flag; int i; int j; width = png_get_image_width (png_ptr, info_ptr); height = png_get_image_height (png_ptr, info_ptr); source_stride = (width * bit_depth + 7) / 8; dest_stride = source_stride; gdip_align_stride (dest_stride); /* Copy image data. */ row_pointers = png_get_rows (png_ptr, info_ptr); rawdata = GdipAlloc(dest_stride * height); for (i=0; i < height; i++) { memcpy (rawdata + i * dest_stride, row_pointers[i], source_stride); } /* Copy palette. */ num_colours = 1 << bit_depth; if (png_get_color_type (png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY) { /* A gray-scale image; generate a palette fading from black to white. */ colourspace_flag = ImageFlagsColorSpaceGRAY; palette = gdip_create_greyscale_palette (num_colours); palette->Flags = PaletteFlagsGrayScale; } else { /* Copy the palette data into the GDI+ structure. */ colourspace_flag = ImageFlagsColorSpaceRGB; palette_entries = num_colours; if (palette_entries > num_palette) { palette_entries = num_palette; } palette = GdipAlloc (sizeof(ColorPalette) + (num_colours - 1) * sizeof(ARGB)); palette->Flags = 0; palette->Count = num_colours; for (i=0; i < palette_entries; i++) { set_pixel_bgra (&palette->Entries[i], 0, png_palette[i].blue, png_palette[i].green, png_palette[i].red, 0xFF); /* alpha */ } } if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) { png_bytep trans_alpha; int num_trans; png_color_16p trans_color; /* Make sure transparency is respected. */ png_get_tRNS( png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color ); if (num_trans > 0) { palette->Flags |= PaletteFlagsHasAlpha; colourspace_flag |= ImageFlagsHasAlpha; if (num_trans > num_palette) { num_trans = num_palette; } for (i=0; i < num_trans; i++) { set_pixel_bgra(&palette->Entries[i], 0, png_palette[i].blue, png_palette[i].green, png_palette[i].red, #if PNG_LIBPNG_VER > 10399 trans_alpha [i]); /* alpha */ #else info_ptr->trans[i]); /* alpha */ #endif } } } result = gdip_bitmap_new_with_frame (&gdip_image_frameDimension_page_guid, TRUE); result->type = ImageTypeBitmap; result->active_bitmap->stride = dest_stride; result->active_bitmap->width = width; result->active_bitmap->height = height; result->active_bitmap->scan0 = rawdata; result->active_bitmap->reserved = GBD_OWN_SCAN0; switch (bit_depth) { case 1: result->active_bitmap->pixel_format = PixelFormat1bppIndexed; result->cairo_format = CAIRO_FORMAT_A1; break; // note: 2bpp is a special case as the format is "promoted" to PixelFormat32bppARGB / CAIRO_FORMAT_ARGB32 // we deal with this later... case 4: result->active_bitmap->pixel_format = PixelFormat4bppIndexed; result->cairo_format = CAIRO_FORMAT_A8; break; case 8: result->active_bitmap->pixel_format = PixelFormat8bppIndexed; result->cairo_format = CAIRO_FORMAT_A8; break; } result->active_bitmap->image_flags = ImageFlagsReadOnly | ImageFlagsHasRealPixelSize | colourspace_flag; /* assigned when the palette is loaded */ result->active_bitmap->dpi_horz = 0; result->active_bitmap->dpi_vert = 0; result->active_bitmap->palette = palette; } /* 2bpp needs to enter here too */ if (!result) { int width; int height; BYTE bit_depth; int stride; int interlace; png_bytep *row_pointers; BYTE *rawptr; int i, j; width = png_get_image_width (png_ptr, info_ptr); height = png_get_image_height (png_ptr, info_ptr); /* 24 and 32bpp are supported, 48, 64bpp aren't, see http://bugzilla.ximian.com/show_bug.cgi?id=80693 */ bit_depth = png_get_bit_depth (png_ptr, info_ptr); if (bit_depth > 8) { g_warning ("PNG images with %dbpp aren't supported by libgdiplus.", channels * bit_depth); status = UnknownImageFormat; goto error; } interlace = png_get_interlace_type (png_ptr, info_ptr); /* According to the libpng manual, this sequence is equivalent to * using the PNG_TRANSFORM_EXPAND flag in png_read_png. */ if (color_type == PNG_COLOR_TYPE_PALETTE) { png_set_palette_to_rgb (png_ptr); } if ((color_type == PNG_COLOR_TYPE_GRAY) && (bit_depth < 8)) { #if PNG_LIBPNG_VER > 10399 png_set_expand_gray_1_2_4_to_8 (png_ptr); #else png_set_gray_1_2_4_to_8(png_ptr); #endif } if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { png_set_tRNS_to_alpha(png_ptr); } stride = (width * 4); gdip_align_stride (stride); row_pointers = png_get_rows (png_ptr, info_ptr); rawdata = GdipAlloc (stride * height); rawptr = rawdata; switch (channels) { case 4: { for (i = 0; i < height; i++) { png_bytep rowp = row_pointers[i]; for (j = 0; j < width; j++) { BYTE a = rowp[3]; if (a == 0) { set_pixel_bgra (rawptr, 0, 0, 0, 0, 0); } else { BYTE b = rowp[2]; BYTE g = rowp[1]; BYTE r = rowp[0]; set_pixel_bgra (rawptr, 0, b, g, r, a); } rowp += 4; rawptr += 4; } } break; } case 3: { for (i = 0; i < height; i++) { png_bytep rowp = row_pointers[i]; for (j = 0; j < width; j++) { set_pixel_bgra (rawptr, 0, rowp[2], rowp[1], rowp[0], 0xff); rowp += 3; rawptr += 4; } } break; } case 1: for (i = 0; i < height; i++) { png_bytep rowp = row_pointers[i]; if (bit_depth == 2) { // 4 pixels for each byte for (j = 0; j < (width >> bit_depth); j++) { png_byte palette = 0; png_byte pix = *rowp++; palette = (pix >> 6) & 0x03; set_pixel_bgra (rawptr, 0, png_palette[palette].blue, png_palette[palette].green, png_palette[palette].red, 0xFF); /* alpha */ palette = (pix >> 4) & 0x03; set_pixel_bgra (rawptr, 4, png_palette[palette].blue, png_palette[palette].green, png_palette[palette].red, 0xFF); /* alpha */ palette = (pix >> 2) & 0x03; set_pixel_bgra (rawptr, 8, png_palette[palette].blue, png_palette[palette].green, png_palette[palette].red, 0xFF); /* alpha */ palette = pix & 0x03; set_pixel_bgra (rawptr, 12, png_palette[palette].blue, png_palette[palette].green, png_palette[palette].red, 0xFF); /* alpha */ rawptr += 16; } } else { for (j = 0; j < width; j++) { png_byte pix = *rowp++; set_pixel_bgra (rawptr, 0, pix, pix, pix, 0xff); rawptr += 4; } } } break; } result = gdip_bitmap_new_with_frame (&gdip_image_frameDimension_page_guid, TRUE); result->type = ImageTypeBitmap; result->cairo_format = CAIRO_FORMAT_ARGB32; result->active_bitmap->stride = stride; result->active_bitmap->pixel_format = PixelFormat32bppARGB; result->active_bitmap->width = width; result->active_bitmap->height = height; result->active_bitmap->scan0 = rawdata; result->active_bitmap->reserved = GBD_OWN_SCAN0; result->surface = cairo_image_surface_create_for_data ((BYTE*)rawdata, result->cairo_format, result->active_bitmap->width, result->active_bitmap->height, result->active_bitmap->stride); if (channels == 3) { result->active_bitmap->pixel_format = PixelFormat24bppRGB; result->active_bitmap->image_flags = ImageFlagsColorSpaceRGB; } else if (channels == 4) { result->active_bitmap->pixel_format = PixelFormat32bppARGB; result->active_bitmap->image_flags = ImageFlagsColorSpaceRGB; } else if ((channels == 1) && (color_type == PNG_COLOR_TYPE_GRAY)) { // doesn't apply to 2bpp images result->active_bitmap->pixel_format = PixelFormat8bppIndexed; result->active_bitmap->image_flags = ImageFlagsColorSpaceGRAY; } if (color_type & PNG_COLOR_MASK_ALPHA) result->active_bitmap->image_flags |= ImageFlagsHasAlpha; result->active_bitmap->image_flags |= ImageFlagsReadOnly | ImageFlagsHasRealPixelSize; result->active_bitmap->dpi_horz = 0; result->active_bitmap->dpi_vert = 0; } gdip_load_png_properties(png_ptr, info_ptr, end_info_ptr, result->active_bitmap); png_destroy_read_struct (&png_ptr, &info_ptr, &end_info_ptr); *image = result; return Ok; error: /* coverity[dead_error_line] */ if (rawdata) { GdipFree (rawdata); } if (png_ptr) { png_destroy_read_struct (&png_ptr, info_ptr ? &info_ptr : (png_infopp) NULL, end_info_ptr ? &end_info_ptr : (png_infopp) NULL); } *image = NULL; return status; } GpStatus gdip_load_png_image_from_file (FILE *fp, GpImage **image) { return gdip_load_png_image_from_file_or_stream (fp, NULL, image); } GpStatus gdip_load_png_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seeknFunc, GpImage **image) { return gdip_load_png_image_from_file_or_stream (NULL, getBytesFunc, image); } static GpStatus gdip_save_png_image_to_file_or_stream (FILE *fp, PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { png_structp png_ptr = NULL; png_infop info_ptr = NULL; int i; int bit_depth; int color_type; png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { goto error; } if (setjmp(png_jmpbuf(png_ptr))) { /* png detected error occured */ goto error; } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { goto error; } if (fp != NULL) { png_init_io (png_ptr, fp); } else { png_set_write_fn (png_ptr, putBytesFunc, _gdip_png_stream_write_data, _gdip_png_stream_flush_data); } switch (image->active_bitmap->pixel_format) { case PixelFormat32bppARGB: case PixelFormat32bppPARGB: case PixelFormat32bppRGB: color_type = PNG_COLOR_TYPE_RGB_ALPHA; bit_depth = 8; break; case PixelFormat24bppRGB: color_type = PNG_COLOR_TYPE_RGB; /* FIXME - we should be able to write grayscale PNGs */ bit_depth = 8; break; case PixelFormat8bppIndexed: color_type = PNG_COLOR_TYPE_PALETTE; bit_depth = 8; break; case PixelFormat4bppIndexed: color_type = PNG_COLOR_TYPE_PALETTE; bit_depth = 4; break; case PixelFormat1bppIndexed: color_type = PNG_COLOR_TYPE_PALETTE; bit_depth = 1; break; /* We're not going to even try to save these images, for now */ case PixelFormat64bppARGB: case PixelFormat64bppPARGB: case PixelFormat48bppRGB: case PixelFormat16bppARGB1555: case PixelFormat16bppGrayScale: case PixelFormat16bppRGB555: case PixelFormat16bppRGB565: default: color_type = -1; bit_depth = -1; break; } if (bit_depth == -1) { goto error; } png_set_IHDR (png_ptr, info_ptr, image->active_bitmap->width, image->active_bitmap->height, bit_depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format)) { png_color palette[256]; int palette_entries = image->active_bitmap->palette->Count; if (image->active_bitmap->pixel_format == PixelFormat4bppIndexed) { palette_entries = 16; } for (i=0; i < palette_entries; i++) { ARGB entry = image->active_bitmap->palette->Entries[i]; int dummy; get_pixel_bgra(entry, palette[i].blue, palette[i].green, palette[i].red, dummy); } png_set_PLTE (png_ptr, info_ptr, palette, palette_entries); } png_set_filter (png_ptr, 0, PNG_NO_FILTERS); png_set_sRGB_gAMA_and_cHRM (png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL); png_write_info (png_ptr, info_ptr); #if 0 if ((image->active_bitmap->pixel_format == Format24bppRGB) || (image->active_bitmap->pixel_format == Format32bppRGB)) { png_set_filler (png_ptr, 0, PNG_FILLER_AFTER); } else if (image->active_bitmap->pixel_format == Format8bppIndexed) { png_set_filler (png_ptr, 0, PNG_FILLER_AFTER); } #endif png_set_bgr(png_ptr); if (gdip_is_an_indexed_pixelformat (image->active_bitmap->pixel_format)) { for (i = 0; i < image->active_bitmap->height; i++) { png_write_row (png_ptr, image->active_bitmap->scan0 + i * image->active_bitmap->stride); } } else if (image->active_bitmap->pixel_format == PixelFormat24bppRGB) { int j; BYTE *row_pointer = GdipAlloc (image->active_bitmap->width * 3); for (i = 0; i < image->active_bitmap->height; i++) { for (j = 0; j < image->active_bitmap->width; j++) { #ifdef WORDS_BIGENDIAN row_pointer[j*3 ] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 3); row_pointer[j*3+1] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 2); row_pointer[j*3+2] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 1); #else row_pointer[j*3 ] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 0); row_pointer[j*3+1] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 1); row_pointer[j*3+2] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 2); #endif /* WORDS_BIGENDIAN */ } png_write_row (png_ptr, row_pointer); } GdipFree (row_pointer); } else { #ifdef WORDS_BIGENDIAN int j; BYTE *row_pointer = GdipAlloc (image->active_bitmap->width * 4); for (i = 0; i < image->active_bitmap->height; i++) { for (j = 0; j < image->active_bitmap->width; j++) { row_pointer[j*4] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 3); row_pointer[j*4+1] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 2); row_pointer[j*4+2] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 1); row_pointer[j*4+3] = *((BYTE*)image->active_bitmap->scan0 + (image->active_bitmap->stride * i) + (j*4) + 0); } png_write_row (png_ptr, row_pointer); } GdipFree (row_pointer); #else for (i = 0; i < image->active_bitmap->height; i++) { png_write_row (png_ptr, image->active_bitmap->scan0 + (image->active_bitmap->stride * i)); } #endif } png_write_end (png_ptr, NULL); png_destroy_write_struct (&png_ptr, &info_ptr); return Ok; error: if (png_ptr) { png_destroy_write_struct (&png_ptr, info_ptr ? &info_ptr : NULL); } return GenericError; } GpStatus gdip_save_png_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) { return gdip_save_png_image_to_file_or_stream (fp, NULL, image, params); } GpStatus gdip_save_png_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return gdip_save_png_image_to_file_or_stream (NULL, putBytesFunc, image, params); } #else #include "pngcodec.h" GpStatus gdip_load_png_image_from_file (FILE *fp, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_load_png_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seeknFunc, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_save_png_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } GpStatus gdip_save_png_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } ImageCodecInfo * gdip_getcodecinfo_png () { return NULL; } #endif /* HAVE_LIBPNG */ libgdiplus-4.2/src/gifcodec.h0000664000175000017500000000161512377405421013153 00000000000000/* * gifcodec.h : Contains function declarations for encoding decoding gif images * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef _GIFCODEC_H #define _GIFCODEC_H #include "bitmap-private.h" #include "bmpcodec.h" GpStatus gdip_load_gif_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_gif_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seekFunc, GpImage **image) GDIP_INTERNAL; GpStatus gdip_save_gif_image_to_file (unsigned char *filename, GpImage *image) GDIP_INTERNAL; GpStatus gdip_save_gif_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; ImageCodecInfo *gdip_getcodecinfo_gif () GDIP_INTERNAL; #endif /* _GIFCODEC_H */ libgdiplus-4.2/src/graphics-cairo.c0000664000175000017500000010200512377405421014271 00000000000000/* * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #include "graphics-cairo-private.h" #include "graphics-private.h" #include "graphics-path-private.h" /* * NOTE: all parameter's validations are done inside graphics.c */ /* helper functions to avoid a lot of repetitive code */ static GpStatus fill_graphics_with_brush (GpGraphics *graphics, GpBrush *brush, BOOL stroke) { /* We do brush setup just before filling. */ gdip_brush_setup (graphics, brush); /* don't stroke if scaled (since the pen thickness will be scaled too!) */ if (stroke && !gdip_is_scaled (graphics)) { /* stroke only using 1 pixel width - see #413461 */ double width = cairo_get_line_width (graphics->ct); cairo_set_line_width (graphics->ct, 1.0); cairo_stroke_preserve (graphics->ct); cairo_set_line_width (graphics->ct, width); } cairo_close_path (graphics->ct); cairo_fill (graphics->ct); /* Set the matrix back to graphics->copy_of_ctm for other functions. * This overwrites the matrix set by brush setup. */ cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); return gdip_get_status (cairo_status (graphics->ct)); } static GpStatus stroke_graphics_with_pen (GpGraphics *graphics, GpPen *pen) { /* We do pen setup just before stroking. */ gdip_pen_setup (graphics, pen); cairo_stroke (graphics->ct); /* Set the matrix back to graphics->copy_of_ctm for other functions. * This overwrites the matrix set by pen setup. */ cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); return gdip_get_status (cairo_status (graphics->ct)); } cairo_fill_rule_t gdip_convert_fill_mode (FillMode fill_mode) { if (fill_mode == FillModeAlternate) return CAIRO_FILL_RULE_EVEN_ODD; else return CAIRO_FILL_RULE_WINDING; } static void make_ellipse (GpGraphics *graphics, float x, float y, float width, float height, BOOL convert_units, BOOL antialiasing) { double rx, ry, cx, cy; /* if required deal, once and for all, with unit conversion */ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); width = gdip_unitx_convgr (graphics, width); height = gdip_unity_convgr (graphics, height); } rx = width / 2; ry = height / 2; cx = x + rx; cy = y + ry; /* if required deal, once and for all, with antialiasing */ if (antialiasing && !gdip_is_scaled (graphics)) { cx += graphics->aa_offset_x; cy += graphics->aa_offset_y; } gdip_cairo_move_to (graphics, cx + rx, cy, FALSE, FALSE); /* an approximate of the ellipse by drawing a curve in each * quadrants */ gdip_cairo_curve_to (graphics, cx + rx, cy - C1 * ry, cx + C1 * rx, cy - ry, cx, cy - ry, FALSE, FALSE); gdip_cairo_curve_to (graphics, cx - C1 * rx, cy - ry, cx - rx, cy - C1 * ry, cx - rx, cy, FALSE, FALSE); gdip_cairo_curve_to (graphics, cx - rx, cy + C1 * ry, cx - C1 * rx, cy + ry, cx, cy + ry, FALSE, FALSE); gdip_cairo_curve_to (graphics, cx + C1 * rx, cy + ry, cx + rx, cy + C1 * ry, cx + rx, cy, FALSE, FALSE); cairo_close_path (graphics->ct); } /* * Based on the algorithm described in * http://www.stillhq.com/ctpfaq/2002/03/c1088.html#AEN1212 */ static void make_arc (GpGraphics *graphics, BOOL start, float x, float y, float width, float height, float startAngle, float endAngle, BOOL antialiasing) { float delta, bcp; double sin_alpha, sin_beta, cos_alpha, cos_beta; float rx = width / 2; float ry = height / 2; /* center */ float cx = x + rx; float cy = y + ry; /* angles in radians */ float alpha = startAngle * PI / 180; float beta = endAngle * PI / 180; /* adjust angles for ellipses */ alpha = atan2 (rx * sin (alpha), ry * cos (alpha)); beta = atan2 (rx * sin (beta), ry * cos (beta)); if (fabs (beta - alpha) > M_PI){ if (beta > alpha) beta -= 2 * PI; else alpha -= 2 * PI; } delta = beta - alpha; bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta /2); sin_alpha = sin (alpha); sin_beta = sin (beta); cos_alpha = cos (alpha); cos_beta = cos (beta); /* don't move to starting point if we're continuing an existing curve */ if (start) { /* starting point */ double sx = cx + rx * cos_alpha; double sy = cy + ry * sin_alpha; gdip_cairo_move_to (graphics, sx, sy, FALSE, antialiasing); } gdip_cairo_curve_to (graphics, cx + rx * (cos_alpha - bcp * sin_alpha), cy + ry * (sin_alpha + bcp * cos_alpha), cx + rx * (cos_beta + bcp * sin_beta), cy + ry * (sin_beta - bcp * cos_beta), cx + rx * cos_beta, cy + ry * sin_beta, FALSE, antialiasing); } static void make_arcs (GpGraphics *graphics, float x, float y, float width, float height, float startAngle, float sweepAngle, BOOL convert_units, BOOL antialiasing) { int i; float drawn = 0; float endAngle; BOOL enough = FALSE; /* if required deal, once and for all, with unit conversions */ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); width = gdip_unitx_convgr (graphics, width); height = gdip_unity_convgr (graphics, height); } if (fabs (sweepAngle) >= 360) { /* FALSE -> units are already converted */ make_ellipse (graphics, x, y, width, height, FALSE, antialiasing); return; } endAngle = startAngle + sweepAngle; /* if we end before the start then reverse positions (to keep increment positive) */ if (endAngle < startAngle) { double temp = endAngle; endAngle = startAngle; startAngle = temp; } /* i is the number of sub-arcs drawn, each sub-arc can be at most 90 degrees.*/ /* there can be no more then 4 subarcs, ie. 90 + 90 + 90 + (something less than 90) */ for (i = 0; i < 4; i++) { float current = startAngle + drawn; float additional; if (enough) return; additional = endAngle - current; /* otherwise, add the remainder */ if (additional > 90) { additional = 90.0; } else { /* a near zero value will introduce bad artefact in the drawing (#78999) */ if (gdip_near_zero (additional)) return; enough = TRUE; } make_arc (graphics, (i == 0), /* only move to the starting pt in the 1st iteration */ x, y, width, height, /* bounding rectangle */ current, current + additional, antialiasing); drawn += additional; } } GpStatus cairo_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { /* We use graphics->copy_of_ctm matrix for path creation. We should * have it set already. */ make_arcs (graphics, x, y, width, height, startAngle, sweepAngle, TRUE, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) { return cairo_DrawArc (graphics, pen, x, y, width, height, startAngle, sweepAngle); } GpStatus cairo_DrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, x1, y1, TRUE, TRUE); gdip_cairo_curve_to (graphics, x2, y2, x3, y3, x4, y4, TRUE, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { return cairo_DrawBezier (graphics, pen, x1, y1, x2, y2, x3, y3, x4, y4); } GpStatus cairo_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { int i, j, k; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE); for (i = 0, j = 1, k = 2; i < count - 3; i += 3, j += 3, k += 3) { gdip_cairo_curve_to (graphics, points [i].X, points [i].Y, points [j].X, points [j].Y, points [k].X, points [k].Y, TRUE, TRUE); } return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { int i, j, k; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE); for (i = 0, j = 1, k = 2; i < count - 3; i += 3, j += 3, k += 3) { gdip_cairo_curve_to (graphics, points [i].X, points [i].Y, points [j].X, points [j].Y, points [k].X, points [k].Y, TRUE, TRUE); } return stroke_graphics_with_pen (graphics, pen); } static void make_curve (GpGraphics *graphics, GDIPCONST GpPointF *points, GpPointF *tangents, int offset, int length, _CurveType type, BOOL antialiasing) { int i; gdip_cairo_move_to (graphics, points [offset].X, points [offset].Y, FALSE, antialiasing); for (i = offset; i < offset + length; i++) { int j = i + 1; double x1 = points [i].X + tangents [i].X; double y1 = points [i].Y + tangents [i].Y; double x2 = points [j].X - tangents [j].X; double y2 = points [j].Y - tangents [j].Y; double x3 = points [j].X; double y3 = points [j].Y; gdip_cairo_curve_to (graphics, x1, y1, x2, y2, x3, y3, FALSE, antialiasing); } if (type == CURVE_CLOSE) { /* complete (close) the curve using the first point */ double x1 = points [i].X + tangents [i].X; double y1 = points [i].Y + tangents [i].Y; double x2 = points [0].X - tangents [0].X; double y2 = points [0].Y - tangents [0].Y; double x3 = points [0].X; double y3 = points [0].Y; gdip_cairo_curve_to (graphics, x1, y1, x2, y2, x3, y3, FALSE, antialiasing); cairo_close_path (graphics->ct); } } GpStatus cairo_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension) { GpStatus status; GpPointF *tangents = gdip_closed_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; make_curve (graphics, points, tangents, 0, count - 1, CURVE_CLOSE, TRUE); status = stroke_graphics_with_pen (graphics, pen); GdipFree (tangents); return status; } GpStatus cairo_DrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension) { GpStatus status; GpPointF *pt = convert_points (points, count); if (!pt) return OutOfMemory; status = cairo_DrawClosedCurve2 (graphics, pen, pt, count, tension); GdipFree (pt); return status; } GpStatus cairo_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension) { GpStatus status; GpPointF *tangents = gdip_closed_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; make_curve (graphics, points, tangents, 0, count - 1, CURVE_CLOSE, FALSE); status = fill_graphics_with_brush (graphics, brush, FALSE); GdipFree (tangents); return status; } GpStatus cairo_FillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension) { GpStatus status; GpPointF *pt = convert_points (points, count); if (!pt) return OutOfMemory; status = GdipFillClosedCurve2 (graphics, brush, pt, count, tension); GdipFree (pt); return status; } GpStatus cairo_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension) { GpStatus status; GpPointF *tangents = gdip_open_curve_tangents (CURVE_MIN_TERMS, points, count, tension); if (!tangents) return OutOfMemory; make_curve (graphics, points, tangents, offset, numOfSegments, CURVE_OPEN, TRUE); status = stroke_graphics_with_pen (graphics, pen); GdipFree (tangents); return status; } GpStatus cairo_DrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension) { GpStatus status; GpPointF *pt = convert_points (points, count); if (!pt) return OutOfMemory; status = cairo_DrawCurve3 (graphics, pen, pt, count, offset, numOfSegments, tension); GdipFree (pt); return status; } /* * Ellipses */ GpStatus cairo_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ make_ellipse (graphics, x, y, width, height, TRUE, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) { return cairo_DrawEllipse (graphics, pen, x, y, width, height); } GpStatus cairo_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ make_ellipse (graphics, x, y, width, height, TRUE, FALSE); return fill_graphics_with_brush (graphics, brush, FALSE); } GpStatus cairo_FillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) { return cairo_FillEllipse (graphics, brush, x, y, width, height); } GpStatus cairo_DrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) { GpStatus ret; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, x1, y1, TRUE, TRUE); gdip_cairo_line_to (graphics, x2, y2, TRUE, TRUE); ret = stroke_graphics_with_pen (graphics, pen); gdip_pen_draw_custom_start_cap (graphics, pen, x1, y1, x2, y2); gdip_pen_draw_custom_end_cap (graphics, pen, x2, y2, x1, y1); return ret; } GpStatus cairo_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { int i; float last_x, last_y, prev_x, prev_y; GpStatus ret; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE); for (i = 1; i < count; i++) { gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, TRUE); prev_x = points [i - 1].X; prev_y = points [i - 1].Y; last_x = points [i].X; last_y = points [i].Y; } ret = stroke_graphics_with_pen (graphics, pen); if (count > 1) { gdip_pen_draw_custom_start_cap (graphics, pen, points [0].X, points [0].Y, points [1].X, points [1].Y); gdip_pen_draw_custom_end_cap (graphics, pen, last_x, last_y, prev_x, prev_y); } return ret; } GpStatus cairo_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { int i; float last_x, last_y, prev_x, prev_y; GpStatus ret; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE); for (i = 1; i < count; i++) { gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, TRUE); prev_x = points [i - 1].X; prev_y = points [i - 1].Y; last_x = points [i].X; last_y = points [i].Y; } ret = stroke_graphics_with_pen (graphics, pen); if (count > 1) { gdip_pen_draw_custom_start_cap (graphics, pen, points [0].X, points [0].Y, points [1].X, points [1].Y); gdip_pen_draw_custom_end_cap (graphics, pen, last_x, last_y, prev_x, prev_y); } return ret; } GpStatus gdip_plot_path (GpGraphics *graphics, GpPath *path, BOOL antialiasing) { int length = path->count; int i, idx = 0; for (i = 0; i < length; ++i) { GpPointF pt = g_array_index (path->points, GpPointF, i); BYTE type = g_array_index (path->types, BYTE, i); GpPointF pts [3]; /* mask the bits so that we get only the type value not the other flags */ switch (type & PathPointTypePathTypeMask) { case PathPointTypeStart: gdip_cairo_move_to (graphics, pt.X, pt.Y, TRUE, antialiasing); break; case PathPointTypeLine: gdip_cairo_line_to (graphics, pt.X, pt.Y, TRUE, antialiasing); break; case PathPointTypeBezier: /* make sure we only add at most 3 points to pts */ if (idx < 3) { pts [idx] = pt; idx ++; } /* once we've added 3 pts, we can draw the curve */ if (idx == 3) { gdip_cairo_curve_to (graphics, pts[0].X, pts[0].Y, pts[1].X, pts[1].Y, pts[2].X, pts[2].Y, TRUE, antialiasing); idx = 0; } break; default: g_warning ("Unknown PathPointType %d", type); return NotImplemented; } /* close the subpath */ if (type & PathPointTypeCloseSubpath) cairo_close_path (graphics->ct); } return Ok; } GpStatus cairo_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) { GpStatus ret; int count; GpPointF *points; /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ GpStatus status = gdip_plot_path (graphics, path, TRUE); if (status != Ok) return status; ret = stroke_graphics_with_pen (graphics, pen); /* Draw any custom pen end caps */ status = GdipGetPointCount (path, &count); /* To know the angle of the end cap, we need the penultimate point. Unfortunately there's no way of getting it without getting all the points :-( */ if (status == Ok && count > 1) { points = gdip_calloc (count, sizeof(GpPointF)); if (points == NULL) { return OutOfMemory; } status = GdipGetPathPoints (path, points, count); if (status == Ok) { gdip_pen_draw_custom_start_cap (graphics, pen, points [0].X, points [0].Y, points [1].X, points [1].Y); gdip_pen_draw_custom_end_cap (graphics, pen, points [count - 1].X, points [count - 1].Y, points [count - 2].X, points [count - 2].Y); } GdipFree (points); } return ret; } /* FIXME - this doesn't match MS behaviour when we use really complex paths with internal intersections */ GpStatus cairo_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) { /* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */ GpStatus status = gdip_plot_path (graphics, path, TRUE); if (status != Ok) return status; cairo_set_fill_rule (graphics->ct, gdip_convert_fill_mode (path->fill_mode)); // filled paths includes the stroke return fill_graphics_with_brush (graphics, brush, TRUE); } static void make_pie (GpGraphics *graphics, float x, float y, float width, float height, float startAngle, float sweepAngle, BOOL antialiasing) { float rx, ry, cx, cy, alpha; double sin_alpha, cos_alpha; /* if required deal, once and for all, with unit conversions */ if (!OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); width = gdip_unitx_convgr (graphics, width); height = gdip_unity_convgr (graphics, height); } rx = width / 2; ry = height / 2; /* center */ cx = x + rx; cy = y + ry; /* angles in radians */ alpha = startAngle * PI / 180; /* adjust angle for ellipses */ alpha = atan2 (rx * sin (alpha), ry * cos (alpha)); sin_alpha = sin (alpha); cos_alpha = cos (alpha); /* if required deal, once and for all, with antialiasing */ if (antialiasing && !gdip_is_scaled (graphics)) { cx += graphics->aa_offset_x; cy += graphics->aa_offset_y; } /* draw pie edge */ if (fabs (sweepAngle) >= 360) gdip_cairo_move_to (graphics, cx + rx * cos_alpha, cy + ry * sin_alpha, FALSE, FALSE); else { gdip_cairo_move_to (graphics, cx, cy, FALSE, FALSE); gdip_cairo_line_to (graphics, cx + rx * cos_alpha, cy + ry * sin_alpha, FALSE, FALSE); } /* draw the arcs */ make_arcs (graphics, x, y, width, height, startAngle, sweepAngle, FALSE, antialiasing); /* draws line back to center */ if (fabs (sweepAngle) >= 360) gdip_cairo_move_to (graphics, cx, cy, FALSE, FALSE); else gdip_cairo_line_to (graphics, cx, cy, FALSE, FALSE); } GpStatus cairo_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { make_pie (graphics, x, y, width, height, startAngle, sweepAngle, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { make_pie (graphics, x, y, width, height, startAngle, sweepAngle, FALSE); return fill_graphics_with_brush (graphics, brush, FALSE); } /* * Polygons */ static void make_polygon (GpGraphics *graphics, GDIPCONST GpPointF *points, int count, BOOL antialiasing) { int i; gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, antialiasing); for (i = 0; i < count; i++) { gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, antialiasing); } /* * Draw a line from the last point back to the first point if * they're not the same */ if (points [0].X != points [count-1].X && points [0].Y != points [count-1].Y) { gdip_cairo_line_to (graphics, points [0].X, points [0].Y, TRUE, antialiasing); } cairo_close_path (graphics->ct); } static void make_polygon_from_integers (GpGraphics *graphics, GDIPCONST GpPoint *points, int count, BOOL antialiasing) { int i; gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, antialiasing); for (i = 0; i < count; i++) { gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, antialiasing); } /* * Draw a line from the last point back to the first point if * they're not the same */ if (points [0].X != points [count-1].X && points [0].Y != points [count-1].Y) { gdip_cairo_line_to (graphics, points [0].X, points [0].Y, TRUE, antialiasing); } cairo_close_path (graphics->ct); } GpStatus cairo_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { make_polygon (graphics, points, count, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { make_polygon_from_integers (graphics, points, count, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode) { make_polygon (graphics, points, count, FALSE); cairo_set_fill_rule (graphics->ct, gdip_convert_fill_mode (fillMode)); return fill_graphics_with_brush (graphics, brush, FALSE); } GpStatus cairo_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode) { make_polygon_from_integers (graphics, points, count, FALSE); cairo_set_fill_rule (graphics->ct, gdip_convert_fill_mode (fillMode)); return fill_graphics_with_brush (graphics, brush, FALSE); } /* * Rectangle(s) */ GpStatus cairo_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { /* wide pen position can be different between cairo and gdi+ */ if (gdip_cairo_pen_width_needs_adjustment (pen)) { x -= 1.0f; y -= 1.0f; } gdip_cairo_rectangle (graphics, x, y, width, height, TRUE); return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_FillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { gdip_cairo_rectangle (graphics, x, y, width, height, FALSE); return fill_graphics_with_brush (graphics, brush, FALSE); } GpStatus cairo_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) { BOOL draw = FALSE; BOOL adjust = gdip_cairo_pen_width_needs_adjustment (pen); int i; for (i = 0; i < count; i++) { float x = rects [i].X; float y = rects [i].Y; float w = rects [i].Width; float h = rects [i].Height; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((w < 0) || (h < 0)) continue; /* wide pen position can be different between cairo and gdi+ */ if (adjust) { x -= 1.0f; y -= 1.0f; } gdip_cairo_rectangle (graphics, x, y, w, h, TRUE); draw = TRUE; } if (!draw) return Ok; return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_DrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) { BOOL draw = FALSE; BOOL adjust = gdip_cairo_pen_width_needs_adjustment (pen); int i; for (i = 0; i < count; i++) { int x = rects [i].X; int y = rects [i].Y; int w = rects [i].Width; int h = rects [i].Height; /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((w < 0) || (h < 0)) continue; /* wide pen position can be different between cairo and gdi+ */ if (adjust) { x -= 1; y -= 1; } gdip_cairo_rectangle (graphics, x, y, w, h, TRUE); draw = TRUE; } if (!draw) return Ok; return stroke_graphics_with_pen (graphics, pen); } GpStatus cairo_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) { BOOL draw = FALSE; int i; /* We use graphics->copy_of_ctm matrix for path creation. We * should have it set already. */ for (i = 0; i < count; i++) { /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((rects [i].Width < 0) || (rects [i].Height < 0)) continue; gdip_cairo_rectangle (graphics, rects [i].X, rects [i].Y, rects [i].Width, rects [i].Height, FALSE); draw = TRUE; } /* shortcut if no rectangles were drawn into the graphics */ if (!draw) return Ok; return fill_graphics_with_brush (graphics, brush, FALSE); } GpStatus cairo_FillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) { BOOL draw = FALSE; int i; /* We use graphics->copy_of_ctm matrix for path creation. We * should have it set already. */ for (i = 0; i < count; i++) { /* don't draw/fill rectangles with negative width/height (bug #77129) */ if ((rects [i].Width < 0) || (rects [i].Height < 0)) continue; gdip_cairo_rectangle (graphics, rects [i].X, rects [i].Y, rects [i].Width, rects [i].Height, FALSE); draw = TRUE; } /* shortcut if no rectangles were drawn into the graphics */ if (!draw) return Ok; return fill_graphics_with_brush (graphics, brush, FALSE); } /* * Regions */ GpStatus cairo_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) { /* if this is a region with a complex path */ if (region->type == RegionTypePath) { GpStatus status; GpBitmap *bitmap = NULL; /* (optimization) if if the path is empty, return immediately */ if (!region->tree) return Ok; /* (optimization) if there is only one path, then we do not need the bitmap */ if (region->tree->path) { /* if the path is empty, return OK */ if (region->tree->path->count == 0) return Ok; /* else fill the single path */ return cairo_FillPath (graphics, brush, region->tree->path); } gdip_region_bitmap_ensure (region); if (!region->bitmap) return OutOfMemory; status = GdipCreateBitmapFromGraphics (region->bitmap->Width, region->bitmap->Height, graphics, &bitmap); if (status == Ok) { GpGraphics *bitgraph = NULL; status = GdipGetImageGraphicsContext ((GpImage*)bitmap, &bitgraph); if (status == Ok) { /* fill the "full" rectangle using the specified brush */ cairo_FillRectangle (bitgraph, brush, 0, 0, region->bitmap->Width, region->bitmap->Height); /* adjust bitmap alpha (i.e. shape the brushed-rectangle like the region) */ gdip_region_bitmap_apply_alpha (bitmap, region->bitmap); /* draw the region */ status = GdipDrawImageRect (graphics, (GpImage*)bitmap, region->bitmap->X, region->bitmap->Y, region->bitmap->Width, region->bitmap->Height); } if (bitgraph) GdipDeleteGraphics (bitgraph); } if (bitmap) GdipDisposeImage ((GpImage*)bitmap); return status; } /* if there's no rectangles, we can return directly */ if (!region->rects || (region->cnt == 0)) return Ok; return cairo_FillRectangles (graphics, brush, region->rects, region->cnt); } /* * */ GpStatus cairo_GraphicsClear (GpGraphics *graphics, ARGB color) { double blue = color & 0xff; double green = (color >> 8) & 0xff; double red = (color >> 16) & 0xff; double alpha = (color >> 24); /* Save the existing color/alpha/pattern settings */ cairo_save (graphics->ct); cairo_set_source_rgba (graphics->ct, red / 255, green / 255, blue / 255, alpha / 255); cairo_set_operator (graphics->ct, CAIRO_OPERATOR_SOURCE); cairo_paint (graphics->ct); /* Restore the color/alpha/pattern settings */ cairo_restore (graphics->ct); return gdip_get_status (cairo_status (graphics->ct)); } GpStatus cairo_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) { switch (compositingMode) { case CompositingModeSourceOver: cairo_set_operator (graphics->ct, CAIRO_OPERATOR_OVER); break; case CompositingModeSourceCopy: cairo_set_operator (graphics->ct, CAIRO_OPERATOR_SOURCE); break; } return Ok; } GpStatus cairo_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) { switch (mode) { case SmoothingModeAntiAlias: case SmoothingModeHighQuality: cairo_set_antialias (graphics->ct, CAIRO_ANTIALIAS_DEFAULT); graphics->aa_offset_x = 0.5; graphics->aa_offset_y = 0.5; break; case SmoothingModeNone: case SmoothingModeDefault: case SmoothingModeHighSpeed: default: cairo_set_antialias (graphics->ct, CAIRO_ANTIALIAS_NONE); graphics->aa_offset_x = CAIRO_AA_OFFSET_X; graphics->aa_offset_y = CAIRO_AA_OFFSET_Y; break; } return Ok; } /* * Clipping */ /* Since cairo does autoclipping and it hides the clipping rectangles from the API, the best thing for now is keep track of what the user wants and let Cairo do its autoclipping */ GpStatus cairo_SetGraphicsClip (GpGraphics *graphics) { GpRegion *work; GpRectF* rect; int i; cairo_reset_clip (graphics->ct); if (gdip_is_InfiniteRegion (graphics->clip)) return Ok; if (gdip_is_matrix_empty (graphics->clip_matrix)) { work = graphics->clip; } else { GdipCloneRegion (graphics->clip, &work); GdipTransformRegion (work, graphics->clip_matrix); } switch (work->type) { case RegionTypeRectF: for (i = 0, rect = work->rects; i < work->cnt; i++, rect++) { gdip_cairo_rectangle (graphics, rect->X, rect->Y, rect->Width, rect->Height, FALSE); } break; case RegionTypePath: if (work->tree && work->tree->path) gdip_plot_path (graphics, work->tree->path, FALSE); else { int count; /* I admit that's a (not so cute) hack - anyone with a better idea ? */ if ((GdipGetRegionScansCount (work, &count, NULL) == Ok) && (count > 0)) { GpRectF *rects = (GpRectF*) GdipAlloc (count * sizeof (GpRectF)); if (rects) { GdipGetRegionScans (work, rects, &count, NULL); for (i = 0, rect = rects; i < count; i++, rect++) { gdip_cairo_rectangle (graphics, rect->X, rect->Y, rect->Width, rect->Height, FALSE); } GdipFree (rects); } } } break; default: g_warning ("Unknown region type %d", work->type); break; } cairo_clip (graphics->ct); /* destroy the clone, if one was needed */ if (work != graphics->clip) GdipDeleteRegion (work); return Ok; } GpStatus cairo_ResetClip (GpGraphics *graphics) { cairo_reset_clip (graphics->ct); return gdip_get_status (cairo_status (graphics->ct)); } /* * World Transforms */ GpStatus cairo_ResetWorldTransform (GpGraphics *graphics) { cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); cairo_reset_clip (graphics->ct); cairo_SetGraphicsClip (graphics); return gdip_get_status (cairo_status (graphics->ct)); } GpStatus cairo_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) { cairo_set_matrix (graphics->ct, graphics->copy_of_ctm); cairo_SetGraphicsClip (graphics); return gdip_get_status (cairo_status (graphics->ct)); } libgdiplus-4.2/src/dstream.c0000664000175000017500000001063012377405421013037 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "gdiplus-private.h" #include "dstream.h" struct _dstream_pvt { GetBytesDelegate read; SeekDelegate seek; BYTE *buffer; int allocated; int position; int used; /* EXIF APP1 buffer */ BYTE *exif_buffer; unsigned int exif_datasize; BOOL keep_exif_buffer; }; /* dstream_t */ dstream_t * dstream_input_new (GetBytesDelegate read, SeekDelegate seek) { dstream_t *st; st = GdipAlloc (sizeof (dstream_t)); if (st == NULL) return NULL; st->pvt = GdipAlloc (sizeof (dstream_private)); if (st->pvt == NULL) { GdipFree (st); return NULL; } memset (st->pvt, 0, sizeof (dstream_private)); st->pvt->read = read; st->pvt->seek = seek; return st; } void dstream_free (dstream_t *st) { if (st) { dstream_private *loader = st->pvt; if (loader->buffer) GdipFree (loader->buffer); if (loader->exif_buffer) GdipFree (loader->exif_buffer); memset (loader, 0, sizeof (dstream_t)); GdipFree (loader); GdipFree (st); } } static int read_from_buffer (dstream_private *loader, void *buffer, int size) { int nbytes = loader->used - loader->position; if (nbytes > size) nbytes = size; memcpy (buffer, loader->buffer + loader->position, nbytes); loader->position += nbytes; return nbytes; } static void fill_buffer (dstream_private *loader) { int offset; int nbytes = loader->used - loader->position; if (nbytes > 0) return; if (loader->allocated == 0) { loader->allocated = 65536; loader->buffer = GdipAlloc (loader->allocated); if (loader->buffer == NULL) { /* what? */ return; } } offset = 0; do { nbytes = loader->read (loader->buffer + offset, loader->allocated - offset, 0); if (nbytes > 0) offset += nbytes; } while (nbytes > 0 && ((loader->allocated - offset) > 0)); if (offset != 0) { loader->position = 0; loader->used = offset; } /* First chunk read */ if (nbytes > 0 && loader->keep_exif_buffer && loader->exif_buffer == NULL) { loader->exif_buffer = GdipAlloc (offset); loader->exif_datasize = offset; memcpy (loader->exif_buffer, loader->buffer, offset); } } int dstream_read (dstream_t *st, void *buffer, int size, char peek) { int nbytes; int offset; dstream_private *loader = st->pvt; offset = 0; do { fill_buffer (loader); nbytes = read_from_buffer (loader, buffer + offset, size); offset += nbytes; size -= nbytes; } while (size > 0 && nbytes > 0); return offset; } void dstream_skip (dstream_t *st, int nbytes) { dstream_private *loader = st->pvt; if (loader->seek != NULL) { loader->seek (nbytes, SEEK_CUR); } else { int remain = loader->used - loader->position; if (remain > 0) { if (nbytes >= remain) { nbytes -= remain; loader->used = 0; loader->position = 0; } else { loader->position += nbytes; nbytes = 0; } } /* 'read' ignores reads into a NULL buffer */ while (nbytes > 0) { nbytes -= loader->read (NULL, nbytes, 0); } } /* Invalidate buffer */ loader->used = 0; loader->position = 0; } void dstream_keep_exif_buffer (dstream_t *st) { dstream_private *loader = st->pvt; loader->keep_exif_buffer = TRUE; } void dstream_get_exif_buffer (dstream_t *st, BYTE **ptr, unsigned int *length) { dstream_private *loader = st->pvt; if (loader->keep_exif_buffer) { *ptr = loader->exif_buffer; *length = loader->exif_datasize; } else { *ptr = NULL; *length = 0; } } libgdiplus-4.2/src/customlinecap-private.h0000664000175000017500000000536012377405421015727 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __CUSTOMLINECAP_PRIVATE_H__ #define __CUSTOMLINECAP_PRIVATE_H__ #include "gdiplus-private.h" typedef struct _CapClass { CustomLineCapType type; GpStatus (*setup) (GpGraphics *graphics, GpCustomLineCap *cap); GpStatus (*clone_cap) (GpCustomLineCap *cap, GpCustomLineCap **clonedCap); GpStatus (*destroy) (GpCustomLineCap *cap); GpStatus (*draw) (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *cap, float x, float y, float otherend_x, float otherend_y); } CapClass; typedef struct _CustomLineCap { CapClass *vtable; GpPath *fill_path; GpPath *stroke_path; GpLineCap base_cap; GpLineCap start_cap; GpLineCap end_cap; GpLineJoin stroke_join; float base_inset; float width_scale; } CustomLineCap; void gdip_custom_linecap_init (GpCustomLineCap *cap, CapClass *vt) GDIP_INTERNAL; GpStatus gdip_linecap_setup (GpGraphics *graphics, GpCustomLineCap *customCap) GDIP_INTERNAL; GpStatus gdip_linecap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *customCap, float x, float y, float otherend_x, float otherend_y) GDIP_INTERNAL; double gdip_custom_linecap_angle (float x, float y, float otherend_x, float otherend_y); #include "customlinecap.h" #endif libgdiplus-4.2/src/matrix-private.h0000664000175000017500000000461212377405421014364 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __MATRIX_PRIVATE_H__ #define __MATRIX_PRIVATE_H__ #include "gdiplus-private.h" typedef cairo_matrix_t GpMatrix; #define gdip_matrix_get_x_translation(matrix) (matrix->x0) #define gdip_matrix_get_y_translation(matrix) (matrix->y0) #define gdip_matrix_get_x_scale(matrix) (matrix->xx) #define gdip_matrix_get_y_scale(matrix) (matrix->yy) #define gdip_matrix_reverse_order(order) ((order == MatrixOrderPrepend) ? MatrixOrderAppend : MatrixOrderPrepend) #define gdip_cairo_matrix_copy(m1,m2) memcpy (m1, m2, sizeof (cairo_matrix_t)) BOOL gdip_is_matrix_a_translation (GpMatrix *matrix) GDIP_INTERNAL; BOOL gdip_is_matrix_empty (GpMatrix* matrix) GDIP_INTERNAL; GpStatus gdip_matrix_init_from_rect_3points (GpMatrix *matrix, const GpRectF *rect, const GpPointF *dstplg) GDIP_INTERNAL; #include "matrix.h" #endif libgdiplus-4.2/src/bitmap-private.h0000664000175000017500000001775512377405421014350 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __BITMAP_PRIVATE_H__ #define __BITMAP_PRIVATE_H__ #include "gdiplus-private.h" #include "image-private.h" #define COLOR_PALETTE_FLAGS_DEFAULT 0 #define COLOR_PALETTE_FLAGS_HAS_ALPHA 1 #define COLOR_PALETTE_FLAGS_GREYSCALE 2 #define COLOR_PALETTE_FLAGS_HALFTONE 4 /* LockMode (reserved) flags */ #define GBD_OWN_SCAN0 (1<<8) #define GBD_WRITE_OK (1<<9) #define GBD_LOCKED (1<<10) #define GBD_TRUE24BPP (1<<11) #ifdef WORDS_BIGENDIAN #define set_pixel_bgra(pixel,index,b,g,r,a) do { \ ((unsigned char *)(pixel))[index] = a; \ ((unsigned char *)(pixel))[index+1] = r; \ ((unsigned char *)(pixel))[index+2] = g; \ ((unsigned char *)(pixel))[index+3] = b; \ } while (0) #else #define set_pixel_bgra(pixel,index,b,g,r,a) do { \ ((unsigned char *)(pixel))[index] = b; \ ((unsigned char *)(pixel))[index+1] = g; \ ((unsigned char *)(pixel))[index+2] = r; \ ((unsigned char *)(pixel))[index+3] = a; \ } while (0) #endif #define get_pixel_bgra(color, b, g, r, a) do { \ a = ((color & 0xff000000) >> 24); \ r = ((color & 0x00ff0000) >> 16); \ g = ((color & 0x0000ff00) >> 8); \ b = (color & 0x000000ff); \ } while(0) /* This structure is mirrored in System.Drawing.Imaging.BitmapData. Any changes here must also be made to BitmapData.cs */ typedef struct { unsigned int width; unsigned int height; int stride; int pixel_format; BYTE *scan0; unsigned int reserved; /* the rest of the structure isn't part of MS GDI+ definition */ ColorPalette *palette; int property_count; /* Number of properties */ PropertyItem *property; /* Properties associated with image */ float dpi_horz; /* */ float dpi_vert; /* */ ImageFlags image_flags; /* Alpha, ColorSpace, etc. */ unsigned int left; /* left display coordinate of frame */ unsigned int top; /* top display coordinate of frame */ unsigned int x; /* LockBits: left coordinate of locked rectangle */ unsigned int y; /* LockBits: top coordinate of locked rectangle */ int transparent; /* Index of transparent color (<24bit only) */ } BitmapData; typedef struct { int count; /* Number of bitmaps contained in this frame */ BitmapData *bitmap; /* Bitmaps for this frame */ GUID frame_dimension; /* GUID describing the frame type */ } FrameData; typedef struct _Image { /* Image Description */ ImageType type; /* Undefined, Bitmap, MetaFile */ ImageFormat image_format; /* BMP, TIF, GIF, PNG, etc. */ /* Image Data */ int num_of_frames; /* Number of frames */ FrameData *frames; /* Array of frames (Page, Time, Resolution) for the image */ /* Tracking of active image */ int active_frame; /* Index of frame currently used */ int active_bitmap_no; /* Index of active bitmap in current frame */ BitmapData *active_bitmap; /* Pointer to active frame/bitmap; DO NOT free() */ /* Internal fields */ int cairo_format; cairo_surface_t *surface; } GpBitmap; void gdip_bitmap_init (GpBitmap *bitmap) GDIP_INTERNAL; GpBitmap *gdip_bitmap_new (void) GDIP_INTERNAL; GpBitmap *gdip_bitmap_new_with_frame (const GUID *dimension, BOOL add_bitmapdata) GDIP_INTERNAL; FrameData *gdip_frame_add(GpBitmap *bitmap, const GUID *dimension) GDIP_INTERNAL; BitmapData *gdip_frame_add_bitmapdata(FrameData *frame) GDIP_INTERNAL; GpStatus gdip_bitmap_dispose (GpBitmap *bitmap) GDIP_INTERNAL; GpStatus gdip_bitmap_clone (GpBitmap *bitmap, GpBitmap **clonedbitmap) GDIP_INTERNAL; GpStatus gdip_bitmap_setactive (GpBitmap *bitmap, const GUID *dimension, int index) GDIP_INTERNAL; GpStatus gdip_bitmapdata_clone (BitmapData *src, BitmapData **dest, int count) GDIP_INTERNAL; ColorPalette *gdip_palette_clone(ColorPalette *original) GDIP_INTERNAL; GpStatus gdip_property_get_short (int offset, void *value, unsigned short *result) GDIP_INTERNAL; GpStatus gdip_property_get_long (int offset, void *value, guint32 *result) GDIP_INTERNAL; GpStatus gdip_property_get_srational (int offset, void *value, unsigned short *numerator, unsigned short *denominator) GDIP_INTERNAL; GpStatus gdip_property_get_rational (int offset, void *value, guint32 *numerator, guint32 *denominator) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add (BitmapData *bitmap_data, PROPID id, ULONG length, WORD type, VOID *value) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_byte (BitmapData *bitmap_data, PROPID id, BYTE value) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_short (BitmapData *bitmap_data, PROPID id, unsigned short value) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_long (BitmapData *bitmap_data, PROPID id, guint32 value) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_ASCII (BitmapData *bitmap_data, PROPID id, unsigned char *value) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_rational (BitmapData *bitmap_data, PROPID id, guint32 numerator, guint32 denominator) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_add_srational (BitmapData *bitmap_data, PROPID id, unsigned short numerator, unsigned short denominator) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_remove_id (BitmapData *bitmap_data, PROPID id) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_remove_index (BitmapData *bitmap_data, int index) GDIP_INTERNAL; GpStatus gdip_bitmapdata_property_find_id (BitmapData *bitmap_data, PROPID id, int *index) GDIP_INTERNAL; cairo_surface_t* gdip_bitmap_ensure_surface (GpBitmap *bitmap) GDIP_INTERNAL; GpBitmap* gdip_convert_indexed_to_rgb (GpBitmap *bitmap) GDIP_INTERNAL; BOOL gdip_bitmap_format_needs_premultiplication (GpBitmap *bitmap) GDIP_INTERNAL; BYTE* gdip_bitmap_get_premultiplied_scan0 (GpBitmap *bitmap) GDIP_INTERNAL; void gdip_process_bitmap_attributes (GpBitmap *bitmap, void **dest, GpImageAttributes* attr, BOOL *allocated) GDIP_INTERNAL; ColorPalette* gdip_create_greyscale_palette (int num_colors) GDIP_INTERNAL; typedef struct { Rect region; int x, y; /* the offset of the next byte that will be loaded, once the buffer is depleted */ unsigned short buffer; int p; /* index of pixel within 'buffer' that was returned by the last call to gdip_pixel_stream_get_next () */ int one_pixel_mask; int one_pixel_shift; int pixels_per_byte; /* a negative value is used to indicate a count of bytes per pixel for depths of more than 8 bits */ BitmapData *data; BYTE *scan; } StreamingState; GpStatus gdip_init_pixel_stream (StreamingState *state, BitmapData *data, int x, int y, int w, int h) GDIP_INTERNAL; unsigned int gdip_pixel_stream_get_next (StreamingState *state) GDIP_INTERNAL; #include "bitmap.h" #endif libgdiplus-4.2/src/solidbrush.h0000664000175000017500000000274512377405421013573 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef __SOLIDBRUSH_H__ #define __SOLIDBRUSH_H__ #include "brush.h" GpStatus GdipCreateSolidFill (ARGB color, GpSolidFill **brush); GpStatus GdipGetSolidFillColor (GpSolidFill *brush, ARGB *color); GpStatus GdipSetSolidFillColor (GpSolidFill *brush, ARGB color); #endif libgdiplus-4.2/src/codecs-private.h0000664000175000017500000000477712377405421014334 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __CODECS_PRIVATE_H__ #define __CODECS_PRIVATE_H__ #include "gdipstructs.h" #include "codecs.h" /* Maximum CODEC signature length, which is the minimum size we need to read from an image file to detect it's type */ #define MAX_CODEC_SIG_LENGTH 44 typedef enum { File, DStream, Memory } ImageSource; typedef struct { BYTE* ptr; int size; int pos; } MemorySource; static const CLSID gdip_image_frameDimension_page_guid = {0x7462dc86U, 0x6180U, 0x4c7eU, {0x8e, 0x3f, 0xee, 0x73, 0x33, 0xa7, 0xa4, 0x83}}; static const CLSID gdip_image_frameDimension_time_guid = {0x6aedbd6dU, 0x3fb5U, 0x418aU, {0x83, 0xa6, 0x7f, 0x45, 0x22, 0x9d, 0xc8, 0x72}}; static const CLSID gdip_image_frameDimension_resolution_guid = {0x84236f7bU, 0x3bd3U, 0x428fU, {0x8d, 0xab, 0x4e, 0xa1, 0x43, 0x9c, 0xa3, 0x15}}; const EncoderParameter *gdip_find_encoder_parameter (GDIPCONST EncoderParameters *eps, const GUID *guid) GDIP_INTERNAL; GpStatus initCodecList (void) GDIP_INTERNAL; void releaseCodecList (void) GDIP_INTERNAL; #endif libgdiplus-4.2/src/graphics-metafile.c0000664000175000017500000004047712377405421015000 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "graphics-metafile-private.h" /* * NOTE: all parameter's validations are done inside graphics.c */ #define FIT_IN_INT16(x) (((x) >= G_MININT16) && ((x) <= G_MAXINT16)) #define EMFPLUS_FLAGS_USE_SINGLE 0x0000 #define EMFPLUS_FLAGS_FILLMODE_WINDING 0x2000 #define EMFPLUS_FLAGS_USE_INT16 0x4000 #define EMFPLUS_FLAGS_USE_ARGB 0x8000 static BOOL RectFitInInt16 (int x, int y, int width, int height) { return (FIT_IN_INT16(x) && FIT_IN_INT16(y) && FIT_IN_INT16(width) && FIT_IN_INT16(height)); } static BOOL GpRectFitInInt16 (GDIPCONST GpRect *rect) { return (FIT_IN_INT16(rect->X) && FIT_IN_INT16(rect->Y) && FIT_IN_INT16(rect->Width) && FIT_IN_INT16(rect->Height)); } static BOOL GpRectArrayFitInInt16 (GDIPCONST GpRect *rects, int count) { GpRect *r = (GpRect*) rects; int i; for (i = 0; i < count; i++, r++) { if (!GpRectFitInInt16 (r)) return FALSE; } return TRUE; } static GpRectF * convert_rects (GDIPCONST GpRect *rects, int count) { int i; GpRectF *result = (GpRectF *) GdipAlloc (sizeof (GpRectF) * count); if (!result) return NULL; for (i = 0; i < count; i++) { result [i].X = rects [i].X; result [i].Y = rects [i].Y; result [i].Width = rects [i].Width; result [i].Height = rects [i].Height; } return result; } static BOOL GetARGBFromBrush (GDIPCONST GpBrush* brush, ARGB *color) { /* if brush is a solid brush we can use (and return) it's color, otherwise it must be treated as an object */ return FALSE; } /* DrawArcs - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawArc.html */ GpStatus metafile_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { /* TODO */ return Ok; } GpStatus metafile_DrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_DrawArc (graphics, pen, x, y, width, height, startAngle, sweepAngle); /* TODO */ return Ok; } /* DrawBeziers - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawBeziers.html */ GpStatus metafile_DrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { /* TODO */ return Ok; } GpStatus metafile_DrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { /* TODO */ return Ok; } GpStatus metafile_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { /* TODO */ return Ok; } GpStatus metafile_DrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { /* TODO */ return Ok; } /* * DrawClosedCurve - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawClosedCurve.html */ GpStatus metafile_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, float tension) { /* TODO */ return Ok; } GpStatus metafile_DrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count, float tension) { /* TODO */ return Ok; } /* * FillClosedCurve - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillClosedCurve.html */ GpStatus metafile_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, float tension) { /* TODO */ return Ok; } GpStatus metafile_FillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, float tension) { /* TODO */ return Ok; } /* * DrawCurve - ? */ GpStatus metafile_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, int numOfSegments, float tension) { /* TODO */ return Ok; } GpStatus metafile_DrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset, int numOfSegments, float tension) { /* TODO */ return Ok; } /* * DrawEllipse - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawEllipse.html */ GpStatus metafile_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { /* TODO */ return Ok; } GpStatus metafile_DrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_DrawEllipse (graphics, pen, x, y, width, height); /* TODO */ return Ok; } /* * FillEllipse - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillEllipse.html */ GpStatus metafile_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { /* TODO */ return Ok; } GpStatus metafile_FillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_FillEllipse (graphics, brush, x, y, width, height); /* TODO */ return Ok; } /* * DrawLines - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawLines.html */ GpStatus metafile_DrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) { /* TODO */ return Ok; } GpStatus metafile_DrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2) { /* TODO */ return Ok; } GpStatus metafile_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { /* TODO */ return Ok; } GpStatus metafile_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { /* TODO */ return Ok; } /* * DrawPath - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawPath.html */ GpStatus metafile_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) { /* TODO */ return Ok; } /* * FillPath - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillPath.html */ GpStatus metafile_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) { /* TODO */ return Ok; } /* * DrawPie - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawPie.html */ GpStatus metafile_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle) { /* TODO */ return Ok; } GpStatus metafile_DrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_DrawPie (graphics, pen, x, y, width, height, startAngle, sweepAngle); /* TODO */ return Ok; } /* * FillPie - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillPie.html */ GpStatus metafile_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, float startAngle, float sweepAngle) { /* TODO */ return Ok; } GpStatus metafile_FillPieI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height, float startAngle, float sweepAngle) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_FillPie (graphics, brush, x, y, width, height, startAngle, sweepAngle); /* TODO */ return Ok; } /* * DrawPolygon - ? */ GpStatus metafile_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) { /* TODO */ return Ok; } GpStatus metafile_DrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) { /* TODO */ return Ok; } /* * FillPolygon - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillPolygon.html */ GpStatus metafile_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, FillMode fillMode) { /* TODO */ return Ok; } GpStatus metafile_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count, FillMode fillMode) { /* TODO */ return Ok; } /* * DrawRects - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawRects.html */ GpStatus metafile_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) { /* TODO */ return Ok; } GpStatus metafile_DrawRectangleI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_DrawRectangleI (graphics, pen, x, y, width, height); /* TODO */ return Ok; } GpStatus metafile_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) { /* TODO */ return Ok; } GpStatus metafile_DrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!GpRectArrayFitInInt16 (rects, count)) { GpStatus status; GpRectF *rf = convert_rects (rects, count); if (!rf) return OutOfMemory; status = metafile_DrawRectangles (graphics, pen, rf, count); GdipFree (rf); return status; } /* TODO */ return Ok; } /* * FillRects - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillRects.html */ GpStatus metafile_FillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) { /* TODO */ return Ok; } GpStatus metafile_FillRectangleI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!RectFitInInt16 (x, y, width, height)) return metafile_FillRectangle (graphics, brush, x, y, width, height); /* TODO */ return Ok; } GpStatus metafile_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) { /* TODO */ return Ok; } GpStatus metafile_FillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) { /* every rectangle must fit into a INT16 or we must use the float version */ if (!GpRectArrayFitInInt16 (rects, count)) { GpStatus status; GpRectF *rf = convert_rects (rects, count); if (!rf) return OutOfMemory; status = metafile_FillRectangles (graphics, brush, rf, count); GdipFree (rf); return status; } /* TODO */ return Ok; } /* * FillRegion - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillRegion.html */ GpStatus metafile_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) { /* TODO */ return Ok; } /* * Clear - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/Clear.html */ GpStatus metafile_GraphicsClear (GpGraphics *graphics, ARGB color) { /* TODO */ return Ok; } /* * SetCompositingMode - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetCompositingMode.html */ GpStatus metafile_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) { /* TODO */ return Ok; } /* * SetCompositingQuality - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetCompositingQuality.html */ GpStatus metafile_SetCompositingQuality (GpGraphics *graphics, CompositingQuality compositingQuality) { /* TODO */ return Ok; } /* * SetInterpolationMode - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetInterpolationMode.html */ GpStatus metafile_SetInterpolationMode (GpGraphics *graphics, InterpolationMode interpolationMode) { /* TODO */ return Ok; } /* * SetPixelOffsetMode - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetPixelOffsetMode.html */ GpStatus metafile_SetPixelOffsetMode (GpGraphics *graphics, PixelOffsetMode pixelOffsetMode) { /* TODO */ return Ok; } /* * SetPageTransform (SetPageUnit+SetPageScale) - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetPageTransform.html */ GpStatus metafile_SetPageTransform (GpGraphics *graphics, GpUnit unit, float scale) { /* TODO */ return Ok; } /* * SetRenderingOrigin - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetRenderingOrigin.html */ GpStatus metafile_SetRenderingOrigin (GpGraphics *graphics, int x, int y) { /* TODO */ return Ok; } /* * SetSmoothingMode - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetAntiAliasMode.html */ GpStatus metafile_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) { /* TODO */ return Ok; } /* * GdipSetTextContrast - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetTextContrast.html */ GpStatus metafile_SetTextContrast (GpGraphics *graphics, UINT contrast) { /* TODO */ return Ok; } /* * SetTextRenderingHint - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetTextRenderingHint.html */ GpStatus metafile_SetTextRenderingHint (GpGraphics *graphics, TextRenderingHint mode) { /* TODO */ return Ok; } /* * ResetClip - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ResetClip.html */ GpStatus metafile_ResetClip (GpGraphics *graphics) { /* TODO */ return Ok; } /* * SetClipPath - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetClipPath.html */ GpStatus metafile_SetClipPath (GpGraphics *graphics, GpPath *path, CombineMode combineMode) { /* TODO */ return Ok; } /* * SetClipRect - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetClipRect.html */ GpStatus metafile_SetClipRect (GpGraphics *graphics, float x, float y, float width, float height, CombineMode combineMode) { /* TODO */ return Ok; } /* * SetClipRegion - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetClipRegion.html */ GpStatus metafile_SetClipRegion (GpGraphics *graphics, GpRegion *region, CombineMode combineMode) { /* TODO */ return Ok; } /* * OffsetClip - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/OffsetClip.html */ GpStatus metafile_TranslateClip (GpGraphics *graphics, float dx, float dy) { /* TODO */ return Ok; } /* * ResetWorldTransform - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ResetWorldTransform.html */ GpStatus metafile_ResetWorldTransform (GpGraphics *graphics) { /* TODO */ return Ok; } /* * SetWorldTransform - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/SetWorldTransform.html */ GpStatus metafile_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) { /* TODO */ return Ok; } /* * http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/MultiplyWorldTransform.html */ GpStatus metafile_MultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order) { /* TODO */ return Ok; } /* * RotateWorldTransform - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/RotateWorldTransform.html */ GpStatus metafile_RotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order) { /* TODO */ return Ok; } /* * ScaleWorldTransform - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ScaleWorldTransform.html */ GpStatus metafile_ScaleWorldTransform (GpGraphics *graphics, float sx, float sy, GpMatrixOrder order) { /* TODO */ return Ok; } /* * TranslateWorldTransform - http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/TranslateWorldTransform.html */ GpStatus metafile_TranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order) { /* TODO */ return Ok; } libgdiplus-4.2/src/text-cairo-private.h0000664000175000017500000000675412377405421015150 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __TEXT_CAIRO_PRIVATE_H__ #define __TEXT_CAIRO_PRIVATE_H__ #include "gdiplus-private.h" #include "graphics-private.h" #include "stringformat-private.h" /* Flags and Support structure for MeasureOrDrawString */ #define STRING_DETAIL_TAB (1<<0) #define STRING_DETAIL_LF (1<<1) #define STRING_DETAIL_HOTKEY (1<<2) #define STRING_DETAIL_BREAK (1<<3) #define STRING_DETAIL_HIDDEN (1<<4) #define STRING_DETAIL_LINESTART (1<<5) #define text_DrawString cairo_DrawString #define text_MeasureString cairo_MeasureString #define text_MeasureCharacterRanges cairo_MeasureCharacterRanges /* cache for computed information during MeasureString that can be reused during DrawString */ typedef struct { BOOL has_hotkeys; int align_horz; int align_vert; int line_height; int max_y; int descent; } GpDrawTextData; typedef struct { unsigned long Flags; unsigned long Linefeeds; float PosX; /* We call it X, even though it might become Y for vertical drawing */ float PosY; /* We call it Y, even though it might become X for vertical drawing */ float Width; /* Width of the character; height is defined in font structure */ int LineLen; /* If LineStart how many chars is the line long? */ } GpStringDetailStruct; GpStatus cairo_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; GpStatus cairo_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, int *codepointsFitted, int *linesFilled) GDIP_INTERNAL; GpStatus cairo_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, int regionCount, GpRegion **regions) GDIP_INTERNAL; #endif libgdiplus-4.2/src/icocodec.h0000664000175000017500000000357712377405421013171 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __ICOCODEC_H__ #define __ICOCODEC_H__ #include "bitmap-private.h" #include "bmpcodec.h" /* Information about the icon format can be found @ http://www.daubnet.com/formats/ICO.html */ typedef struct { BYTE bWidth; BYTE bHeight; BYTE bColorCount; BYTE bReserved; WORD wPlanes; WORD wBitCount; DWORD dwBytesInRes; DWORD dwImageOffset; } ICONDIRENTRY; #define gdip_read_ico_data gdip_read_bmp_data GpStatus gdip_load_ico_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_ico_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; /* no save functions as the ICO "codec" is a decoder only */ ImageCodecInfo* gdip_getcodecinfo_ico () GDIP_INTERNAL; #endif libgdiplus-4.2/src/region-path-tree.h0000664000175000017500000000422112377405421014556 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef _REGION_PATH_TREE_H_ #define _REGION_PATH_TREE_H_ #include "gdiplus-private.h" #include "matrix-private.h" /* internal (private) API for regions path trees */ #define REGION_TAG_PATH 1 #define REGION_TAG_TREE 2 typedef struct GpPathTree { CombineMode mode; GpPath* path; struct GpPathTree* branch1; struct GpPathTree* branch2; } GpPathTree; void gdip_region_clear_tree (GpPathTree *tree) GDIP_INTERNAL; void gdip_region_copy_tree (GpPathTree *source, GpPathTree *dest) GDIP_INTERNAL; UINT gdip_region_get_tree_size (GpPathTree *tree) GDIP_INTERNAL; BOOL gdip_region_deserialize_tree (BYTE *data, int size, GpPathTree *tree) GDIP_INTERNAL; BOOL gdip_region_serialize_tree (GpPathTree *tree, BYTE *buffer, UINT bufferSize, UINT *sizeFilled) GDIP_INTERNAL; void gdip_region_translate_tree (GpPathTree *tree, float dx, float dy) GDIP_INTERNAL; GpStatus gdip_region_transform_tree (GpPathTree *tree, GpMatrix *matrix) GDIP_INTERNAL; #endif /* _REGION_PATH_TREE_H_ */ libgdiplus-4.2/src/graphics-pathiterator-private.h0000664000175000017500000000403712377405421017365 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __GRAPHICS_PATHITERATOR_PRIVATE__ #define __GRAPHICS_PATHITERATOR_PRIVATE__ #include "gdiplus-private.h" struct _PathIterator { GpPath *path; int markerPosition; /* The start position of next marker, index of (marker type) + 1 */ int subpathPosition; /* The start position of next subpath, index of (start type) */ int pathTypePosition; /* The position to get the next path type inside a subpath */ }; #include "graphics-pathiterator.h" #endif libgdiplus-4.2/src/customlinecap.h0000664000175000017500000000265112377405421014257 00000000000000/* * customlinecap.h * * Authors: * Ravindra (rkumar@novell.com) * * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef __CUSTOMLINECAP_H__ #define __CUSTOMLINECAP_H__ /* CustomLineCap functions */ GpStatus GdipCreateCustomLineCap (GpPath *fillPath, GpPath *strokePath, GpLineCap baseCap, float baseInset, GpCustomLineCap **customCap); GpStatus GdipDeleteCustomLineCap (GpCustomLineCap *customCap); GpStatus GdipCloneCustomLineCap (GpCustomLineCap *customCap, GpCustomLineCap **clonedCap); GpStatus GdipSetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap startCap, GpLineCap endCap); GpStatus GdipGetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap *startCap, GpLineCap *endCap); GpStatus GdipSetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin lineJoin); GpStatus GdipGetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin *lineJoin); GpStatus GdipSetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap baseCap); GpStatus GdipGetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap *baseCap); GpStatus GdipSetCustomLineCapBaseInset (GpCustomLineCap *customCap, float inset); GpStatus GdipGetCustomLineCapBaseInset (GpCustomLineCap *customCap, float *inset); GpStatus GdipSetCustomLineCapWidthScale (GpCustomLineCap *customCap, float widthScale); GpStatus GdipGetCustomLineCapWidthScale (GpCustomLineCap *customCap, float *widthScale); #endif libgdiplus-4.2/src/emfcodec.h0000664000175000017500000000765612377405421013170 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __EMFCODEC_H__ #define __EMFCODEC_H__ #include "gdiplus-private.h" #include "metafile-private.h" #include "graphics-private.h" /* * Some interesting links... * http://wvware.sourceforge.net/caolan/ora-wmf.html * http://www.undocprint.org/formats/winspool/emf */ #define EMF_MIN_RECORD_SIZE 8 #define EMF_CHECK_PARAMS(x) do { \ if (params < (x)) goto cleanup; \ } while (0) #define EMF_FUNCTION 0 #define EMF_RECORDSIZE 4 #define DWP1 8 #define DWP2 12 #define DWP3 16 #define DWP4 20 #define DWP5 24 #define DWP6 28 #define DWP7 32 #define DWP8 36 #define DWP9 40 #define DWP10 44 #define DWP11 48 #define DWP(y) (8 + ((y) << 2)) #define EMR_HEADER 1 #define EMR_POLYBEZIER 2 #define EMR_POLYGON 3 #define EMR_POLYPOLYGON 8 #define EMR_SETWINDOWEXTEX 9 #define EMR_SETWINDOWORGEX 10 #define EMR_SETVIEWPORTEXTEX 11 #define EMR_SETVIEWPORTORGEX 12 #define EMR_SETBRUSHORGEX 13 #define EMR_EOF 14 #define EMR_SETMAPMODE 17 #define EMR_SETBKMODE 18 #define EMR_SETPOLYFILLMODE 19 #define EMR_SETROP2 20 #define EMR_SETSTRETCHBLTMODE 21 #define EMR_SETTEXTALIGN 22 #define EMR_SETTEXTCOLOR 24 #define EMR_MOVETOEX 27 #define EMR_INTERSECTCLIPRECT 30 #define EMR_SAVEDC 33 #define EMR_RESTOREDC 34 #define EMR_SETWORLDTRANSFORM 35 #define EMR_MODIFYWORLDTRANSFORM 36 #define EMR_SELECTOBJECT 37 #define EMR_CREATEPEN 38 #define EMR_CREATEBRUSHINDIRECT 39 #define EMR_DELETEOBJECT 40 #define EMR_LINETO 54 #define EMR_SETMITERLIMIT 58 #define EMR_BEGINPATH 59 #define EMR_ENDPATH 60 #define EMR_CLOSEFIGURE 61 #define EMR_FILLPATH 62 #define EMR_STROKEANDFILLPATH 63 #define EMR_STROKEPATH 64 #define EMR_SELECTCLIPPATH 67 #define EMR_GDICOMMENT 70 #define EMR_EXTSELECTCLIPRGN 75 #define EMR_EXTCREATEFONTINDIRECTW 82 #define EMR_EXTTEXTOUTA 83 #define EMR_EXTTEXTOUTW 84 #define EMR_POLYGON16 86 #define EMR_POLYBEZIERTO16 88 #define EMR_POLYPOLYGON16 91 #define EMR_EXTCREATEPEN 95 /* some old GDI cruft we need to consider... */ #define ENHMETA_STOCK_OBJECT 0x80000000 #define WHITE_BRUSH 0 #define LTGRAY_BRUSH 1 #define GRAY_BRUSH 2 #define DKGRAY_BRUSH 3 #define BLACK_BRUSH 4 #define NULL_BRUSH 5 #define WHITE_PEN 6 #define BLACK_PEN 7 #define NULL_PEN 8 #define OEM_FIXED_FONT 10 #define ANSI_FIXED_FONT 11 #define ANSI_VAR_FONT 12 #define SYSTEM_FONT 13 #define DEVICE_DEFAULT_FONT 14 #define DEFAULT_PALETTE 15 #define SYSTEM_FIXED_FONT 16 #define gdip_read_emf_data gdip_read_bmp_data GpStatus gdip_load_emf_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_emf_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; /* no save functions as the EMF "codec" is a decoder only */ ImageCodecInfo* gdip_getcodecinfo_emf () GDIP_INTERNAL; #endif libgdiplus-4.2/src/general-private.h0000664000175000017500000001230512377405421014473 00000000000000/* * general-private.h * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __GENERAL_PRIVATE_H__ #define __GENERAL_PRIVATE_H__ #include "gdiplus-private.h" #define PI 3.14159265358979323846 #define DEGTORAD (PI / 180.0) /* looks like they are not available everywhere :( */ #ifndef G_MAXINT32 #define G_MAXINT32 2147483647 #define G_MININT16 -32768 #define G_MAXINT16 32767 #endif #define MAKE_ARGB_RGB(r,g,b) (((r&0xff) << 16) | ((g&0xff) << 8) | (b&0xff)) #define MAKE_ARGB_ARGB(a,r,g,b) (((a&0xff) << 24) | ((r&0xff) << 16) | ((g&0xff) << 8) | (b&0xff)) #define min(a,b) (a < b ? a : b) #define max(a,b) (a > b ? a : b) /* avoid direct floating point comparison */ #define gdip_near_zero(value) ((value >= -0.0001f) && (value <= 0.0001f)) #define gdip_near_one(value) ((value >= 0.9999f) && (value <= 1.0001f)) /* avoid integer overflows when int/float/int conversion are used (see #79643) */ #define SAFE_FLOAT_TO_UINT32(value) ((value < 0) ? 0 : (value >= G_MAXINT32) ? G_MAXINT32 : (((int)value) < 0 ? G_MAXINT32 : (int)value)) /* avoid fp division and multiplication that would return the same number */ #define OPTIMIZE_CONVERSION(g) ((g->type != gtPostScript) && ((g->page_unit == UnitPixel) || (g->page_unit == UnitWorld))) /* macros for common conversions, i.e. to or from UnitCairoPoint */ #define gdip_unitx_convgr(g,f) (gdip_unit_conversion (g->page_unit, UnitCairoPoint, g->dpi_x, g->type, f)) #define gdip_unity_convgr(g,f) (gdip_unit_conversion (g->page_unit, UnitCairoPoint, g->dpi_y, g->type, f)) #define gdip_convgr_unitx(g,f) (gdip_unit_conversion (UnitCairoPoint, g->page_unit, g->dpi_x, g->type, f)) #define gdip_convgr_unity(g,f) (gdip_unit_conversion (UnitCairoPoint, g->page_unit, g->dpi_y, g->type, f)) /* pixman always use 32bits for pixman_bits_t */ #define gdip_align_stride(s) { s += (sizeof(guint32)-1); s &= ~(sizeof(guint32)-1); } /* avoid floating point division/multiplications when pre-multiplying the alpha channel with R, G and B values */ extern const BYTE pre_multiplied_table[256][256]; #if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1,6,0) /* older cairo has a (signed) 15(1)/16(2)bits pixel positioning, while GDI+ use (signed) 23 bits (infinity). * Using larger values confuse the bits used for subpixel positioning. * (1) http://lists.freedesktop.org/archives/cairo/2006-June/007251.html * (2) testing shows artefacts if using more than 15 bits */ #define CAIRO_LOW_LIMIT -16384 #define CAIRO_HIGH_LIMIT 16383 #define CAIRO_LIMIT(v) ((v < CAIRO_LOW_LIMIT) ? CAIRO_LOW_LIMIT : (v > CAIRO_HIGH_LIMIT) ? CAIRO_HIGH_LIMIT : v) #else /* since cairo 1.6 values are split 24/8 */ #define CAIRO_LIMIT(v) v #endif /* other shared functions */ int iround (float d) GDIP_INTERNAL; float gdip_erf (float x, float std, float mean) GDIP_INTERNAL; float gdip_get_display_dpi () GDIP_INTERNAL; GpStatus gdip_get_status (cairo_status_t status) GDIP_INTERNAL; GpStatus gdip_get_pattern_status (cairo_pattern_t *pat) GDIP_INTERNAL; gchar *ucs2_to_utf8 (const gunichar2 *ucs2, int length) GDIP_INTERNAL; BOOL utf8_to_ucs2 (const gchar *utf8, gunichar2 *ucs2, int ucs2_len) GDIP_INTERNAL; int utf8_encode_ucs2char (gunichar2 unichar, unsigned char *dest) GDIP_INTERNAL; /* for drawing curves */ GpPointF *convert_points (const GpPoint *points, int count) GDIP_INTERNAL; GpPointF *gdip_closed_curve_tangents (int terms, const GpPointF *points, int count, float tension) GDIP_INTERNAL; GpPointF *gdip_open_curve_tangents (int terms, const GpPointF *points, int count, float tension) GDIP_INTERNAL; /* memory */ void* gdip_realloc (void *org, int size) GDIP_INTERNAL; void* gdip_calloc (size_t nelem, size_t elsize) GDIP_INTERNAL; #include "general.h" #endif libgdiplus-4.2/src/bitmap.h0000664000175000017500000000627712377405421012675 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __BITMAP_H__ #define __BITMAP_H__ GpStatus GdipCreateBitmapFromFile (GDIPCONST WCHAR* filename, GpBitmap **bitmap); GpStatus GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap); GpStatus GdipCreateBitmapFromScan0 (INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap **bitmap); GpStatus GdipCreateBitmapFromGraphics (INT width, INT height, GpGraphics *target, GpBitmap **bitmap); GpStatus GdipCreateBitmapFromHBITMAP (HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap); GpStatus GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, HBITMAP *hbmReturn, ARGB background); GpStatus GdipCreateBitmapFromHICON (HICON hicon, GpBitmap** bitmap); GpStatus GdipCreateHICONFromBitmap (GpBitmap* bitmap, HICON *hbmReturn); GpStatus GdipCreateBitmapFromResource (HINSTANCE hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap); GpStatus GdipBitmapLockBits (GpBitmap *bitmap, GDIPCONST Rect *rect, UINT flags, PixelFormat format, BitmapData *lockedBitmapData); GpStatus GdipBitmapUnlockBits (GpBitmap *bitmap, BitmapData *lockedBitmapData); GpStatus GdipBitmapSetPixel (GpBitmap *bitmap, INT x, INT y, ARGB color); GpStatus GdipBitmapGetPixel (GpBitmap *bitmap, INT x, INT y, ARGB *color); GpStatus GdipCloneBitmapArea (REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); GpStatus GdipCloneBitmapAreaI (INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); GpStatus GdipBitmapSetResolution (GpBitmap *bitmap, REAL xdpi, REAL ydpi); /* missing API GdipCreateBitmapFromStream GdipCreateBitmapFromDirectDrawSurface GdipCreateBitmapFromGdiDib GdipCreateBitmapFromGdiDib */ #endif libgdiplus-4.2/src/tiffcodec.h0000664000175000017500000000215512377405421013336 00000000000000/* * tiffcodec.h : Contains function declarations for encoding decoding tiff images * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef _TIFFCODEC_H #define _TIFFCODEC_H #include "bitmap-private.h" #include "bmpcodec.h" GpStatus gdip_load_tiff_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_tiff_image_from_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image) GDIP_INTERNAL; GpStatus gdip_save_tiff_image_to_file (unsigned char *filename, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; GpStatus gdip_save_tiff_image_to_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; ImageCodecInfo* gdip_getcodecinfo_tiff () GDIP_INTERNAL; #endif /* _TIFFCODEC_H */ libgdiplus-4.2/src/emfcodec.c0000664000175000017500000004605112377405421013153 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "emfcodec.h" //#define DEBUG_EMF_ALL #ifdef DEBUG_EMF_ALL #define DEBUG_EMF #define DEBUG_EMF_2 #define DEBUG_EMF_3 #define DEBUG_EMF_NOTIMPLEMENTED #endif #ifdef DEBUG_EMF_NOTIMPLEMENTED #define NOTIMPLEMENTED(s) printf(s) #define NOTIMPLEMENTED1(s,p1) printf(s, (p1)) #define NOTIMPLEMENTED2(s,p1,p2) printf(s, (p1), (p2)) #define NOTIMPLEMENTED3(s,p1,p2,p3) printf(s, (p1), (p2), (p3)) #define NOTIMPLEMENTED4(s,p1,p2,p3,p4) printf(s, (p1), (p2), (p3), (p4)) #define NOTIMPLEMENTED5(s,p1,p2,p3,p4,p5) printf(s, (p1), (p2), (p3), (p4), (p5)) #define NOTIMPLEMENTED6(s,p1,p2,p3,p4,p5,p6) printf(s, (p1), (p2), (p3), (p4), (p5), (p6)) #else #define NOTIMPLEMENTED(s) #define NOTIMPLEMENTED1(s,p1) #define NOTIMPLEMENTED2(s,p1,p2) #define NOTIMPLEMENTED3(s,p1,p2,p3) #define NOTIMPLEMENTED4(s,p1,p2,p3,p4) #define NOTIMPLEMENTED5(s,p1,p2,p3,p4,p5) #define NOTIMPLEMENTED6(s,p1,p2,p3,p4,p5,p6) #endif GUID gdip_emf_image_format_guid = {0xb96b3cacU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; /* Codecinfo related data*/ static ImageCodecInfo emf_codec; static const WCHAR emf_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'E', 'M', 'F', 0}; /* Built-in EMF */ static const WCHAR emf_extension[] = {'*','.','E', 'M', 'F', 0}; /* *.EMF */ static const WCHAR emf_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'x', '-', 'e', 'm', 'f', 0}; /* image/x-emf */ static const WCHAR emf_format[] = {'E', 'M', 'F', 0}; /* EMF */ static const BYTE emf_sig_pattern[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x45, 0x4D, 0x46 }; static const BYTE emf_sig_mask[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF }; ImageCodecInfo* gdip_getcodecinfo_emf () { emf_codec.Clsid = (CLSID) { 0x557cf403, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; emf_codec.FormatID = gdip_emf_image_format_guid; emf_codec.CodecName = (const WCHAR*) emf_codecname; emf_codec.DllName = NULL; emf_codec.FormatDescription = (const WCHAR*) emf_format; emf_codec.FilenameExtension = (const WCHAR*) emf_extension; emf_codec.MimeType = (const WCHAR*) emf_mimetype; emf_codec.Flags = ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; emf_codec.Version = 1; emf_codec.SigCount = 1; emf_codec.SigSize = 44; emf_codec.SigPattern = emf_sig_pattern; emf_codec.SigMask = emf_sig_mask; return &emf_codec; } #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define GETDW(x) (*(DWORD*)(data + (x))) #define GETFLOAT(x) (*(float*)(data + (x))) #else #define GETDW(x) (GUINT32_FROM_LE(*(DWORD*)(data + (x)))) #define GETFLOAT(x) ((float)GETDW(x)) #endif static DWORD GetColor (DWORD color) { BYTE *p = (BYTE*)&color; BYTE temp = p[0]; p[0] = p[2]; p[2] = temp; return color; } static GpStatus PolyBezier (MetafilePlayContext *context, BYTE *data, int len, BOOL compact) { DWORD num; GpPointF *points, *pt; GpStatus status; int p, n = 0; RECTL bounds; bounds.left = GETDW(DWP(n)); n++; bounds.top = GETDW(DWP(n)); n++; bounds.right = GETDW(DWP(n)); n++; bounds.bottom = GETDW(DWP(n)); n++; /* make sure we're not reading more data than what's available in this record */ num = GETDW(DWP(n)); n++; if (compact) { /* len = bounds (4 * DWORD) + num (DWORD) + 2 * num * (x WORD + y WORD) */ if (num > ((len - 5 * sizeof (DWORD)) >> 2)) return InvalidParameter; } else { /* len = bounds (4 * DWORD) + num (DWORD) + 2 * num * (x DWORD + y DWORD) */ if (num > ((len - 5 * sizeof (DWORD)) >> 3)) return InvalidParameter; } #ifdef DEBUG_EMF printf ("PolyBezier%s bounds [%d, %d, %d, %d] with %d points", (compact ? "16" : ""), bounds.left, bounds.top, bounds.right, bounds.bottom, num); #endif /* we need to supply the current x,y position */ points = (GpPointF*) GdipAlloc ((num + 1) * sizeof (GpPointF)); if (!points) return OutOfMemory; pt = points; pt->X = context->current_x; pt->Y = context->current_y; #ifdef DEBUG_EMF_2 printf ("\n\tmoveto to %g,%g", pt->X, pt->Y); #endif context->path_x = pt->X; context->path_y = pt->Y; pt++; for (p = 0; p < num; p++, pt++) { if (compact) { DWORD xy = GETDW(DWP(n)); n++; pt->X = (xy & 0x0000FFFF); pt->Y = (xy >> 16); } else { pt->X = GETDW(DWP(n)); n++; pt->Y = GETDW(DWP(n)); n++; } #ifdef DEBUG_EMF_2 printf ("\n\tbezier to %g,%g", pt->X, pt->Y); #endif } /* keep last point of the path so we can close the figure as GDI does (line) */ pt--; context->current_x = pt->X; context->current_y = pt->Y; /* PolyBezier doesn't use the current point (GDI wise) but metafiles seems different */ status = gdip_metafile_PolyBezier (context, points, num + 1); GdipFree (points); return status; } /* the structure is different from WMF (16 or 32bits, RECTL bounds) */ static GpStatus Polygon (MetafilePlayContext *context, BYTE *data, int len, BOOL compact) { DWORD num; GpPointF *points, *pt; GpStatus status; int p, n = 0; RECTL bounds; bounds.left = GETDW(DWP(n)); n++; bounds.top = GETDW(DWP(n)); n++; bounds.right = GETDW(DWP(n)); n++; bounds.bottom = GETDW(DWP(n)); n++; /* make sure we're not reading more data than what's available in this record */ num = GETDW(DWP(n)); n++; if (compact) { /* len = bounds (4 * DWORD) + num (DWORD) + 2 * num * (x WORD + y WORD) */ if (num > ((len - 5 * sizeof (DWORD)) >> 2)) return InvalidParameter; } else { /* len = bounds (4 * DWORD) + num (DWORD) + 2 * num * (x DWORD + y DWORD) */ if (num > ((len - 5 * sizeof (DWORD)) >> 3)) return InvalidParameter; } #ifdef DEBUG_EMF printf ("Polygon%s bounds [%d, %d, %d, %d] with %d points", (compact ? "16" : ""), bounds.left, bounds.top, bounds.right, bounds.bottom, num); #endif points = (GpPointF*) GdipAlloc (num * sizeof (GpPointF)); if (!points) return OutOfMemory; for (p = 0, pt = points; p < num; p++, pt++) { if (compact) { DWORD xy = GETDW(DWP(n)); n++; pt->X = (xy & 0x0000FFFF); pt->Y = (xy >> 16); } else { pt->X = GETDW(DWP(n)); n++; pt->Y = GETDW(DWP(n)); n++; } #ifdef DEBUG_EMF_2 printf ("\n\tpoly to %g,%g", pt->X, pt->Y); #endif } status = gdip_metafile_Polygon (context, points, num); GdipFree (points); return status; } /* the structure is different from WMF */ static GpStatus PolyPolygon (MetafilePlayContext *context, BYTE *data, BOOL compact) { GpStatus status = Ok; int poly_num; int n = 0; RECTL bounds; bounds.left = GETDW(DWP(n)); n++; bounds.top = GETDW(DWP(n)); n++; bounds.right = GETDW(DWP(n)); n++; bounds.bottom = GETDW(DWP(n)); n++; /* variable number of polygons */ poly_num = GETDW(DWP(n)); n++; /* total number of points (in all polygons)*/ int total = GETDW(DWP(n)); n++; int i; PointFList *list = GdipAlloc (poly_num * sizeof (PointFList)); PointFList *current = list; #ifdef DEBUG_EMF printf ("PolyPolygon%s bounds [%d, %d, %d, %d] with %d polygons", (compact ? "16" : ""), bounds.left, bounds.top, bounds.right, bounds.bottom, poly_num); #endif /* read size of each polygon and allocate the required memory */ for (i = 0; i < poly_num; i++) { current->num = GETDW(DWP(n)); n++; current->points = (GpPointF*) GdipAlloc (current->num * sizeof (GpPointF)); #ifdef DEBUG_EMF_2 printf ("\n\tSub Polygon #%d has %d points", i, current->num); #endif current++; } /* read the points for each polygons */ current = list; for (i = 0; i < poly_num; i++) { GpPointF *pt = current->points; int p; for (p = 0; p < current->num; p++) { if (compact) { DWORD xy = GETDW(DWP(n)); n++; pt->X = (xy & 0x0000FFFF); pt->Y = (xy >> 16); } else { pt->X = GETDW(DWP(n)); n++; pt->Y = GETDW(DWP(n)); n++; } #ifdef DEBUG_EMF_3 printf ("\n\t\tpoly to %g,%g", pt->X, pt->Y); #endif pt++; } GpStatus s = gdip_metafile_Polygon (context, current->points, current->num); if (s != Ok) status = s; /* free points */ GdipFree (current->points); current++; } /* all points were freed, after being drawn, so we just have to free the polygon list*/ GdipFree (list); return status; } static GpStatus EndOfFile (MetafilePlayContext *context, DWORD value, BYTE* data) { /* TODO - process extra stuff if any */ return Ok; } /* http://wvware.sourceforge.net/caolan/ora-wmf.html */ GpStatus GdiComment (MetafilePlayContext *context, BYTE* data, DWORD size) { #ifdef DEBUG_EMF printf ("GdiComment record size %d", size); #endif DWORD length = GETDW(DWP1); if (length >= 4) { DWORD header = GETDW(DWP2); if ((header == 0x2B464D45) && (size >= 8)) { #ifdef DEBUG_EMF_2 printf (", EMF+ length %d", length); #endif /* move past func, size, comment length, remove EMF+ comment header */ data += sizeof (DWORD) * 4; /* remove EMF+ header from length */ length -= sizeof (DWORD); /* play the EMF+ comment-embedded block */ return gdip_metafile_play_emfplus_block (context, data, length); } } #ifdef DEBUG_EMF_NOTIMPLEMENTED int i; printf (" - "); for (i = 0; i < size; i++) printf ("%2X ", *data++); #endif return Ok; } static GpStatus ExtCreatePen (MetafilePlayContext *context, BYTE *data, int size) { LOGBRUSH lb; #ifdef DEBUG_EMF printf ("EMR_EXTCREATEPEN"); #endif if ((GETDW(DWP2) != size) || (GETDW(DWP3) != 0) || (GETDW(DWP4) != size) || (GETDW(DWP5) != 0)) return InvalidParameter; lb.lbStyle = GETDW(DWP8); lb.lbColor = GetColor(GETDW(DWP9)); lb.lbHatch = GETDW(DWP10); return gdip_metafile_ExtCreatePen (context, GETDW(DWP6), GETDW(DWP7), &lb, GETDW(DWP11), NULL); } static GpStatus ModifyWorldTransform (MetafilePlayContext *context, float eM11, float eM12, float eM21, float eM22, float eDx, float eDy, DWORD iMode) { XFORM xf; xf.eM11 = eM11; xf.eM12 = eM12; xf.eM21 = eM21; xf.eM22 = eM22; xf.eDx = eDx; xf.eDy = eDy; return gdip_metafile_ModifyWorldTransform (context, &xf, iMode); } /* * This is very similar in design to the WMF parser, the biggest changes being... * * - The EMF records are based on 32bits units (unlike WMF records which are 16bits); * - The order the size and function parameter is reversed (from WMF); * - The size parameter is represented in bytes (not in WORD like WMF); * - Minimum record size is 8 bytes (function DWORD + size DWORD); * - There are now a record types to start (1) and end (14) the metafiles; */ GpStatus gdip_metafile_play_emf (MetafilePlayContext *context) { GpStatus status = Ok; GpMetafile *metafile = context->metafile; GpGraphics *graphics = context->graphics; BYTE *data = metafile->data; BYTE *end = data + metafile->length; #ifdef DEBUG_EMF int i = 1, j; #endif /* check for empty or recording metafile */ if (!data) return Ok; /* reality check - each record is, at minimum, 8 bytes long (when size == 0) */ while (data < end - EMF_MIN_RECORD_SIZE) { /* record */ DWORD func = GETDW(EMF_FUNCTION); DWORD size = GETDW(EMF_RECORDSIZE); int params = (size - EMF_MIN_RECORD_SIZE) / sizeof (DWORD); #ifdef DEBUG_EMF printf ("\n[#%d] size %d ", i++, size); #endif switch (func) { case EMR_POLYBEZIER: status = PolyBezier (context, data, size - EMF_MIN_RECORD_SIZE, FALSE); break; case EMR_POLYGON: status = Polygon (context, data, size - EMF_MIN_RECORD_SIZE, FALSE); break; case EMR_POLYPOLYGON: status = PolyPolygon (context, data, FALSE); break; case EMR_SETWINDOWEXTEX: EMF_CHECK_PARAMS(2); status = gdip_metafile_SetWindowExt (context, GETDW(DWP1), GETDW(DWP2)); break; case EMR_SETWINDOWORGEX: EMF_CHECK_PARAMS(2); status = gdip_metafile_SetWindowOrg (context, GETDW(DWP1), GETDW(DWP2)); break; case EMR_SETVIEWPORTEXTEX: EMF_CHECK_PARAMS(2); NOTIMPLEMENTED2("EMR_SETVIEWPORTEXTEX not implemented %d, %d", GETDW(DWP1), GETDW(DWP2)); break; case EMR_SETVIEWPORTORGEX: EMF_CHECK_PARAMS(2); NOTIMPLEMENTED2("EMR_SETVIEWPORTORGEX not implemented %d, %d", GETDW(DWP1), GETDW(DWP2)); break; case EMR_SETBRUSHORGEX: EMF_CHECK_PARAMS(2); NOTIMPLEMENTED2("EMR_SETBRUSHORGEX not implemented %d, %d", GETDW(DWP1), GETDW(DWP2)); break; case EMR_EOF: EMF_CHECK_PARAMS(3); #ifdef DEBUG_EMF printf ("EndOfRecord %d %d %d", GETDW(DWP1), GETDW(DWP2), GETDW(DWP3)); #endif status = Ok; /* rest of the metafile can contains other stuff than records (e.g. palette information) */ data += size; goto cleanup; case EMR_SETMAPMODE: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetMapMode (context, GETDW(DWP1)); break; case EMR_SETBKMODE: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetBkMode (context, GETDW(DWP1)); break; case EMR_SETPOLYFILLMODE: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetPolyFillMode (context, GETDW(DWP1)); break; case EMR_SETROP2: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetROP2 (context, GETDW(DWP1)); break; case EMR_SETSTRETCHBLTMODE: NOTIMPLEMENTED("EMR_SETSTRETCHBLTMODE not implemented"); break; case EMR_SETTEXTALIGN: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetTextAlign (context, GETDW(DWP1)); break; case EMR_SETTEXTCOLOR: EMF_CHECK_PARAMS(1); NOTIMPLEMENTED1("EMR_SETTEXTCOLOR %d not implemented", GETDW(DWP1)); break; case EMR_MOVETOEX: EMF_CHECK_PARAMS(2); status = gdip_metafile_MoveTo (context, GETDW(DWP1), GETDW(DWP2)); break; case EMR_INTERSECTCLIPRECT: EMF_CHECK_PARAMS(4); NOTIMPLEMENTED4("EMR_INTERSECTCLIPRECT %d, %d, %d, %d not implemented", GETDW(DWP1), GETDW(DWP1), GETDW(DWP3), GETDW(DWP4)); break; case EMR_SAVEDC: EMF_CHECK_PARAMS(0); NOTIMPLEMENTED("EMR_SAVEDC not implemented"); break; case EMR_RESTOREDC: EMF_CHECK_PARAMS(1); NOTIMPLEMENTED1("EMR_RESTOREDC %d not implemented", GETDW(DWP1)); break; case EMR_SETWORLDTRANSFORM: EMF_CHECK_PARAMS(6); NOTIMPLEMENTED6("EMR_SETWORLDTRANSFORM %d not implemented", GETDW(DWP1), GETDW(DWP2), GETDW(DWP3), GETDW(DWP4), GETDW(DWP5), GETDW(DWP6)); break; case EMR_MODIFYWORLDTRANSFORM: EMF_CHECK_PARAMS(7); status = ModifyWorldTransform (context, GETFLOAT(DWP1), GETFLOAT(DWP2), GETFLOAT(DWP3), GETFLOAT(DWP4), GETFLOAT(DWP5), GETFLOAT(DWP6), GETDW(DWP7)); break; case EMR_SELECTOBJECT: EMF_CHECK_PARAMS(1); status = gdip_metafile_SelectObject (context, GETDW(DWP1)); break; case EMR_CREATEPEN: EMF_CHECK_PARAMS(5); status = gdip_metafile_CreatePenIndirect (context, GETDW(DWP2), GETDW(DWP3), GETDW(DWP4)); break; case EMR_CREATEBRUSHINDIRECT: EMF_CHECK_PARAMS(4); /* 4 parameters provided, only 3 required in LOGBRUSH structure used in CreateBrushIndirect */ status = gdip_metafile_CreateBrushIndirect (context, GETDW(DWP4), GetColor(GETDW(DWP3)), GETDW(DWP2)); break; case EMR_DELETEOBJECT: EMF_CHECK_PARAMS(1); status = gdip_metafile_DeleteObject (context, GETDW(DWP1)); break; case EMR_LINETO: EMF_CHECK_PARAMS(2); status = gdip_metafile_LineTo (context, GETDW(DWP1), GETDW(DWP2)); break; case EMR_SETMITERLIMIT: EMF_CHECK_PARAMS(1); status = gdip_metafile_SetMiterLimit (context, GETDW(DWP1), NULL); break; case EMR_BEGINPATH: EMF_CHECK_PARAMS(0); status = gdip_metafile_BeginPath (context); break; case EMR_ENDPATH: EMF_CHECK_PARAMS(0); status = gdip_metafile_EndPath (context); break; case EMR_CLOSEFIGURE: EMF_CHECK_PARAMS(0); status = gdip_metafile_CloseFigure (context); break; case EMR_FILLPATH: EMF_CHECK_PARAMS(4); /* TODO - deal with all parameters, we have what looks like a rectangle (bounds?) */ status = gdip_metafile_FillPath (context); break; case EMR_STROKEANDFILLPATH: EMF_CHECK_PARAMS(4); /* TODO - deal with all parameters, we have what looks like a rectangle (bounds?) */ status = gdip_metafile_StrokeAndFillPath (context); break; case EMR_STROKEPATH: EMF_CHECK_PARAMS(4); /* TODO - deal with all parameters, we have what looks like a rectangle (bounds?) */ status = gdip_metafile_StrokePath (context); break; case EMR_SELECTCLIPPATH: EMF_CHECK_PARAMS(1); NOTIMPLEMENTED1("EMR_SELECTCLIPPATH %d not implemented", GETDW(DWP1)); break; case EMR_GDICOMMENT: EMF_CHECK_PARAMS(1); /* record contains at least the size of the comment */ status = GdiComment (context, data, size); break; case EMR_EXTSELECTCLIPRGN: EMF_CHECK_PARAMS(2); NOTIMPLEMENTED2("EMR_EXTSELECTCLIPRGN %d, %d not implemented", GETDW(DWP1), GETDW(DWP2)); break; case EMR_EXTCREATEFONTINDIRECTW: NOTIMPLEMENTED("EMR_EXTCREATEFONTINDIRECTW"); break; case EMR_EXTTEXTOUTA: NOTIMPLEMENTED("EMR_EXTTEXTOUTA"); break; case EMR_EXTTEXTOUTW: NOTIMPLEMENTED("EMR_EXTTEXTOUTW"); break; case EMR_POLYGON16: status = Polygon (context, data, size - EMF_MIN_RECORD_SIZE, TRUE); break; case EMR_POLYBEZIERTO16: status = PolyBezier (context, data, size - EMF_MIN_RECORD_SIZE, TRUE); break; case EMR_POLYPOLYGON16: status = PolyPolygon (context, data, TRUE); break; case EMR_EXTCREATEPEN: EMF_CHECK_PARAMS(11); status = ExtCreatePen (context, data, size); break; default: /* unprocessed records, ignore the data */ #ifdef DEBUG_EMF_NOTIMPLEMENTED printf ("Unimplemented_%d (", func); for (j = 0; j < params; j++) { printf (" %d", GETDW(DWP(j))); } printf (" )"); #endif break; } if (status != Ok) { g_warning ("Parsing interupted, status %d returned from function %d.", status, func); goto cleanup; } data += size; } cleanup: return status; end_of_record: /* TODO : process extra stuff residing after the records */ return status; } GpStatus gdip_load_emf_image_from_file (FILE *fp, GpImage **image) { return gdip_get_metafile_from ((void*)fp, (GpMetafile**)image, File); } GpStatus gdip_load_emf_image_from_stream_delegate (dstream_t *loader, GpImage **image) { return gdip_get_metafile_from ((void *)loader, (GpMetafile**)image, DStream); } libgdiplus-4.2/src/solidbrush-private.h0000664000175000017500000000354512377405421015242 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __SOLIDBRUSH_PRIVATE_H__ #define __SOLIDBRUSH_PRIVATE_H__ #include "brush-private.h" typedef struct _SolidFill { Brush base; int color; /* We cache the color components */ double A; double R; double G; double B; } SolidFill; #include "solidbrush.h" #endif libgdiplus-4.2/src/general.c0000664000175000017500000003644412377405421013030 00000000000000/* * general.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2006, 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine(pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Sebastien Pouliot */ #include "general-private.h" #include "codecs-private.h" #include "graphics-private.h" #include "font-private.h" #include "carbon-private.h" /* large table to avoid a division and three multiplications when premultiplying alpha into R, G and B */ #include "alpha-premul-table.inc" static BOOL startup = FALSE; GpStatus GdiplusStartup (ULONG_PTR *token, const GdiplusStartupInput *input, GdiplusStartupOutput *output) { GpStatus status = Ok; /* don't initialize multiple time, e.g. for each appdomain */ if (!startup) { startup = TRUE; status = initCodecList (); if (status != Ok) return status; FcInit (); *token = 1; gdip_get_display_dpi(); } return status; } void GdiplusShutdown (ULONG_PTR token) { if (startup) { releaseCodecList (); gdip_font_clear_pattern_cache (); #if HAVE_FCFINI FcFini (); #endif startup = FALSE; /* in case we want to restart it */ } } /* Memory */ void * GdipAlloc (size_t size) { return malloc (size); } void * gdip_calloc (size_t nelem, size_t elsize) { return calloc (nelem, elsize); } void * gdip_realloc (void *org, int size) { return realloc (org, size); } void GdipFree (void *ptr) { free (ptr); } /* Helpers */ GpStatus gdip_get_status (cairo_status_t status) { if (status == CAIRO_STATUS_SUCCESS) return Ok; else { switch (status) { case CAIRO_STATUS_NO_MEMORY: return OutOfMemory; case CAIRO_STATUS_INVALID_MATRIX: case CAIRO_STATUS_INVALID_RESTORE: case CAIRO_STATUS_INVALID_POP_GROUP: return InvalidParameter; case CAIRO_STATUS_NO_CURRENT_POINT: return WrongState; default: return GenericError; } } } float gdip_get_display_dpi () { static float dpis = 0; Display* display; if (dpis == 0) { #if __APPLE__ float h_dpi, v_dpi; gdip_get_display_dpi_carbon (&h_dpi, &v_dpi); dpis = h_dpi; return dpis; #else char *val; display = XOpenDisplay (0); /* If the display is openable lets try to read dpi from it; otherwise use a default of 96.0f */ if (display) { val = XGetDefault (display, "Xft", "dpi"); if (val) { dpis = atof (val); } else { dpis = 96.0f; } XCloseDisplay (display); } else { dpis = 96.0f; } #endif } return dpis; } /* Curve handling * * See Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in * Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584. * * and the Tangent class in JPT (http://www.ccs.neu.edu/jpt/jpt_2_3/index.htm) * */ GpPointF * convert_points (const GpPoint *point, int count) { int i; GpPointF *retval = (GpPointF *) GdipAlloc (sizeof (GpPointF) * count); if (!retval) return NULL; for (i = 0; i < count; i++) { retval [i].X = (float) point [i].X; retval [i].Y = (float) point [i].Y; } return retval; } GpPointF * gdip_open_curve_tangents (int terms, const GpPointF *points, int count, float tension) { float coefficient = tension / 3.0; int i; GpPointF *tangents = (GpPointF *) GdipAlloc (sizeof (GpPointF) * count); if (!tangents) return NULL; /* initialize everything to zero to begin with */ for (i = 0; i < count; i++) { tangents [i].X = 0; tangents [i].Y = 0; } if (count <= 2) return tangents; for (i = 0; i < count; i++) { int r = i + 1; int s = i - 1; if (r >= count) r = count - 1; if (s < 0) s = 0; tangents [i].X += (coefficient * (points [r].X - points [s].X)); tangents [i].Y += (coefficient * (points [r].Y - points [s].Y)); } return tangents; } GpPointF * gdip_closed_curve_tangents (int terms, const GpPointF *points, int count, float tension) { float coefficient = tension / 3.0; int i; GpPointF *tangents = (GpPointF *) GdipAlloc (sizeof (GpPointF) * count); if (!tangents) return NULL; /* initialize everything to zero to begin with */ for (i = 0; i < count; i++) { tangents [i].X = 0; tangents [i].Y = 0; } if (count <= 2) return tangents; for (i = 0; i < count; i++) { int r = i + 1; int s = i - 1; if (r >= count) r -= count; if (s < 0) s += count; tangents [i].X += (coefficient * (points [r].X - points [s].X)); tangents [i].Y += (coefficient * (points [r].Y - points [s].Y)); } return tangents; } /* re-enabled if/when required */ #if FALSE /* this function comes from fcmp.sf.net */ int fcmp (double x1, double x2, double epsilon) { int exponent; double delta; double difference; /* Get exponent(max(fabs(x1), fabs(x2))) and store it in exponent. */ /* If neither x1 nor x2 is 0, */ /* this is equivalent to max(exponent(x1), exponent(x2)). */ /* If either x1 or x2 is 0, its exponent returned by frexp would be 0, */ /* which is much larger than the exponents of numbers close to 0 in */ /* magnitude. But the exponent of 0 should be less than any number */ /* whose magnitude is greater than 0. */ /* So we only want to set exponent to 0 if both x1 and */ /* x2 are 0. Hence, the following works for all x1 and x2. */ frexp (fabs (x1) > fabs (x2) ? x1 : x2, &exponent); /* Do the comparison. */ /* delta = epsilon * pow(2, exponent) */ /* Form a neighborhood around x2 of size delta in either direction. */ /* If x1 is within this delta neighborhood of x2, x1 == x2. */ /* Otherwise x1 > x2 or x1 < x2, depending on which side of */ /* the neighborhood x1 is on. */ delta = ldexp (epsilon, exponent); difference = x1 - x2; if (difference > delta) return 1; /* x1 > x2 */ else if (difference < -delta) return -1; /* x1 < x2 */ else /* -delta <= difference <= delta */ return 0; /* x1 == x2 */ } #endif /* note: round[f] is C99 */ int iround (float d) { double int_part = floor (d); return ((d - int_part) >= 0.5) ? int_part + 1.0 : int_part; } /* This function is used by gradient brushes for calculating the erf required for * calculating the integral of the normal distribution equation. */ float gdip_erf (float x, float std, float mean) { /* std refers to standard deviation * * ERF: http://mathworld.wolfram.com/Erf.html * * erf (z) = (2 / sqrt (pi)) * infinite sum of [(pow (-1, n) * pow (z, 2n+1))/(n! * (2n+1))] * using Maclaurin series. */ float series; float constant = 2.0 / sqrt (PI); float z = (x - mean) / std; z /= sqrt (2.0); series = (z - pow (z, 3) / 3.0 + pow (z, 5) / 10.0 - pow (z, 7) / 42.0 + pow (z, 9) / 216.0 - pow (z, 11) / 1420.0); return constant * series; } /* convert a ucs2 string to utf8 length = number of characters to convert, -1 to indicate the whole string */ gchar * ucs2_to_utf8(const gunichar2 *ucs2, int length) { const gunichar2 *ptr; const gunichar2 *end; gunichar *dest; gunichar *uni; gchar *utf8; /* Count length */ if (length == -1) { ptr = ucs2; length = 0; while (*ptr != 0) { ptr++; length++; } } uni = GdipAlloc((length + 1) * sizeof(gunichar)); if (uni == NULL) { return NULL; } dest = uni; ptr = ucs2; end = ptr + length; while (ptr != end) { if (*ptr < 0xd800 || *ptr >= 0xe000) { *dest = *ptr; dest++; } ptr++; } *dest = 0; dest++; utf8 = (gchar *) g_ucs4_to_utf8 ((const gunichar *)uni, -1, NULL, NULL, NULL); GdipFree(uni); return utf8; } BOOL utf8_to_ucs2(const gchar *utf8, gunichar2 *ucs2, int ucs2_len) { int i; glong items_read; glong count; gunichar *ucs4; gunichar2 *ptr; items_read = 0; count = 0; ucs2_len--; /* Space for null terminator */ ucs4 = g_utf8_to_ucs4(utf8, -1, &items_read, &count, NULL); if (ucs4 == NULL) { return FALSE; } ptr = (gunichar2 *)ucs2; for (i = 0; (i < count) && (i < ucs2_len); i++) { if (ucs4[i] < 0x10000 && !(ucs4[i] >= 0xd800 && ucs4[i] < 0xe000)) { *ptr = (gunichar2)ucs4[i]; ptr++; } /* we're simply ignoring any chars that don't fit into ucs2 */ } ucs2[i] = 0; /* terminate */ /* free the intermediate ucs4 string */ GdipFree(ucs4); return TRUE; } int utf8_encode_ucs2char(gunichar2 unichar, BYTE *dest) { if (unichar < 0x0080) { /* 0000-007F */ dest[0] = (BYTE)(unichar); return (1); } if(unichar < 0x0800) { /* 0080-07FF */ dest[0] = (BYTE)(0xC0 | ((unichar & 0x07C0) >> 6)); dest[1] = (BYTE)(0x80 | (unichar & 0x003F)); return (2); } /* 0800-FFFF */ dest[0] = (BYTE)(0xE0 | ((unichar & 0xF000) >> 12)); dest[1] = (BYTE)(0x80 | ((unichar & 0x0FC0) >> 6)); dest[2] = (BYTE)(0x80 | (unichar & 0x003F)); return (3); } /* re-enabled if/when required */ #if FALSE /* This function only handles UCS-2 */ int utf8_decode_ucs2char (const BYTE *src, gunichar2 *uchar) { if (src[0] <= 0x7F) { /* 0000-007F: one byte (0xxxxxxx) */ *uchar = (gunichar2)src[0]; return (1); } if (src[0] <= 0xDF) { /* 0080-07FF: two bytes (110xxxxx 10xxxxxx) */ *uchar = ((((gunichar2)src[0]) & 0x001F) << 6) | ((((gunichar2)src[1]) & 0x003F) << 0); return (2); } /* 0800-FFFF: three bytes (1110xxxx 10xxxxxx 10xxxxxx) */ *uchar = ((((gunichar2)src[0]) & 0x000F) << 12) | ((((gunichar2)src[1]) & 0x003F) << 6) | ((((gunichar2)src[2]) & 0x003F) << 0); return (3); } #endif GpStatus gdip_get_pattern_status (cairo_pattern_t *pat) { if (!pat) return OutOfMemory; switch (cairo_pattern_status (pat)) { case CAIRO_STATUS_SUCCESS: return Ok; case CAIRO_STATUS_NO_MEMORY: cairo_pattern_destroy (pat); return OutOfMemory; default: cairo_pattern_destroy (pat); return InvalidParameter; } } /* * Our anti-aliasing hack (adding an X and Y offset when drawing) cannot work if the current matrix * scales the coordinates. E.g. 0 scale 100 == 0, while (0 + 0.5) scale 100 == 50. */ BOOL gdip_is_scaled (GpGraphics *graphics) { cairo_matrix_t matrix; cairo_get_matrix (graphics->ct, &matrix); return ((matrix.xx != 1.0f) || (matrix.yy != 1.0f)); } /* cairo has a (signed) 15(1)/16(2)bits pixel positioning, while GDI+ use (signed) 23 bits (infinity). * Using larger values confuse the bits used for subpixel positioning. * (1) http://lists.freedesktop.org/archives/cairo/2006-June/007251.html * (2) testing shows artefacts if using more than 15 *signed* bits (i.e. -16384 to 16383) */ void gdip_cairo_rectangle (GpGraphics *graphics, double x, double y, double width, double height, BOOL antialiasing) { double x2, y2; /* avoid unit conversion whenever possible */ if (!OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); width = gdip_unitx_convgr (graphics, width); height = gdip_unity_convgr (graphics, height); } /* apply antialiasing offset (if required and if no scaling is in effect) */ if (antialiasing && !gdip_is_scaled (graphics)) { x += graphics->aa_offset_x; y += graphics->aa_offset_y; } /* ensure that each point (x,y and x+width,y+height) are within the 16 bits bounds */ x2 = x + width; y2 = y + height; /* put everything between cairo limits */ x = CAIRO_LIMIT (x); y = CAIRO_LIMIT (y); x2 = CAIRO_LIMIT (x2); y2 = CAIRO_LIMIT (y2); /* and recompute the final width and length */ cairo_rectangle (graphics->ct, x, y, (x2 - x), (y2 - y)); } void gdip_cairo_move_to (GpGraphics *graphics, double x, double y, BOOL convert_units, BOOL antialiasing) { /* avoid unit conversion whenever possible */ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); } /* apply antialiasing offset (if required and if no scaling is in effect) */ if (antialiasing && !gdip_is_scaled (graphics)) { /* note that we can't add AA to a 0 position (or scaling will not work) */ x += graphics->aa_offset_x; y += graphics->aa_offset_y; } /* put everything between cairo limits */ x = CAIRO_LIMIT (x); y = CAIRO_LIMIT (y); cairo_move_to (graphics->ct, x, y); } void gdip_cairo_line_to (GpGraphics *graphics, double x, double y, BOOL convert_units, BOOL antialiasing) { /* avoid unit conversion whenever possible */ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) { x = gdip_unitx_convgr (graphics, x); y = gdip_unity_convgr (graphics, y); } /* apply antialiasing offset (if required and if no scaling is in effect) */ if (antialiasing && !gdip_is_scaled (graphics)) { x += graphics->aa_offset_x; y += graphics->aa_offset_y; } /* put everything between cairo limits */ x = CAIRO_LIMIT (x); y = CAIRO_LIMIT (y); cairo_line_to (graphics->ct, x, y); } void gdip_cairo_curve_to (GpGraphics *graphics, double x1, double y1, double x2, double y2, double x3, double y3, BOOL convert_units, BOOL antialiasing) { /* avoid unit conversion whenever possible */ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) { x1 = gdip_unitx_convgr (graphics, x1); y1 = gdip_unity_convgr (graphics, y1); x2 = gdip_unitx_convgr (graphics, x2); y2 = gdip_unity_convgr (graphics, y2); x3 = gdip_unitx_convgr (graphics, x3); y3 = gdip_unity_convgr (graphics, y3); } /* apply antialiasing offset (if required and if no scaling is in effect) */ if (antialiasing && !gdip_is_scaled (graphics)) { x1 += graphics->aa_offset_x; y1 += graphics->aa_offset_y; x2 += graphics->aa_offset_x; y2 += graphics->aa_offset_y; x3 += graphics->aa_offset_x; y3 += graphics->aa_offset_y; } /* put everything between cairo limits */ x1 = CAIRO_LIMIT (x1); y1 = CAIRO_LIMIT (y1); x2 = CAIRO_LIMIT (x2); y2 = CAIRO_LIMIT (y2); x3 = CAIRO_LIMIT (x3); y3 = CAIRO_LIMIT (y3); cairo_curve_to (graphics->ct, x1, y1, x2, y2, x3, y3); } libgdiplus-4.2/src/bmpcodec.h0000664000175000017500000000572512377405421013172 00000000000000/* * bmpcodec.h : Contains function declarations for encoding decoding bmp images * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Mark Steele (ms@rapidsys.com) * * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef _BMPCODEC_H #define _BMPCODEC_H #include "bitmap-private.h" //#include "codecs-private.h" #include "dstream.h" #define BI_RGB 0 #define BI_RLE8 1 #define BI_RLE4 2 #define BI_BITFIELDS 3 #define BITMAPINFOHEADER_SIZE 40 #define BITMAPCOREHEADER_SIZE 12 #ifndef __GNUC__ #pragma pack(2) #endif typedef struct #ifdef __GNUC__ __attribute__ ((packed)) #endif { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER, *PBITMAPFILEHEADER, *LPBITMAPFILEHEADER; #ifndef __GNUC__ #pragma pack() #endif #define BFT_BITMAP 0x4d42 typedef struct { BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved; } RGBQUAD, *LPRGBQUAD; typedef struct { DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER; typedef long FXPT2DOT30; typedef struct { FXPT2DOT30 ciexyzX; FXPT2DOT30 ciexyzY; FXPT2DOT30 ciexyzZ; } CIEXYZ; typedef struct { CIEXYZ ciexyzRed; CIEXYZ ciexyzGreen; CIEXYZ ciexyzBlue; } CIEXYZTRIPLE; typedef struct { DWORD bV4Size; LONG bV4Width; LONG bV4Height; WORD bV4Planes; WORD bV4BitCount; DWORD bV4Compression; DWORD bV4SizeImage; LONG bV4XPelsPerMeter; LONG bV4YPelsPerMeter; DWORD bV4ClrUsed; DWORD bV4ClrImportant; DWORD bV4RedMask; DWORD bV4GreenMask; DWORD bV4BlueMask; DWORD bV4AlphaMask; DWORD bV4CSType; CIEXYZTRIPLE bV4Endpoints; DWORD bV4GammaRed; DWORD bV4GammaGreen; DWORD bV4GammaBlue; } BITMAPV4HEADER, *PBITMAPV4HEADER; typedef struct { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } BITMAPINFO, *PBITMAPINFO, *LPBITMAPINFO; #include "gdiplus-private.h" GpStatus gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source) GDIP_INTERNAL; GpStatus gdip_load_bmp_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_bmp_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; GpStatus gdip_save_bmp_image_to_file (FILE *fp, GpImage *image) GDIP_INTERNAL; GpStatus gdip_save_bmp_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image) GDIP_INTERNAL; ImageCodecInfo *gdip_getcodecinfo_bmp () GDIP_INTERNAL; /* helper functions / shared with ICOn codec */ GpStatus gdip_read_BITMAPINFOHEADER (void *pointer, BITMAPINFOHEADER *bmi, ImageSource source, BOOL *os2format, BOOL *upsidedown) GDIP_INTERNAL; int gdip_read_bmp_data (void *pointer, BYTE *data, int size, ImageSource source) GDIP_INTERNAL; #endif /* _BMPCODEC_H */ libgdiplus-4.2/src/tiffcodec.c0000664000175000017500000012341212377405421013331 00000000000000/* * * tiffcodec.c : Contains function definitions for encoding decoding tiff images * * * Copyright (C) Novell, Inc. 2003-2004. * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Jordi Mas (jordi@ximian.com) * * Copyright (C) Novell, Inc. 2003-2004. */ #if HAVE_CONFIG_H #include #endif #include "gdiplus-private.h" GUID gdip_tif_image_format_guid = {0xb96b3cb1U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; #ifdef HAVE_LIBTIFF /* Thankfully, libtiff sucks far less than libjpeg */ #include #ifdef HAVE_BYTESWAP_H #include #endif #include "tiffcodec.h" #ifndef TIFFTAG_EXIFIFD #define TIFFTAG_EXIFIFD 34665 #endif /* Codecinfo related data*/ static ImageCodecInfo tiff_codec; static const WCHAR tiff_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'T', 'I', 'F', 'F', 0}; /* Built-in TIFF */ static const WCHAR tiff_extension[] = {'*', '.', 'T', 'I', 'F',';', '*', '.', 'T', 'I', 'F','F', 0}; /* *.TIF;*.TIFF */ static const WCHAR tiff_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 't', 'i', 'f', 'f', 0}; /* image/gif */ static const WCHAR tiff_format[] = {'T', 'I', 'F', 'F', 0}; /* TIFF */ static const BYTE tiff_sig_pattern[] = { 0x49, 0x49, 0x4D, 0x4D }; static const BYTE tiff_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF }; /*Wrapper functions and client data strucutre for delegate functions from StreamHelper class of System.Drawing Namespace*/ typedef struct { GetBytesDelegate getBytesFunc; PutBytesDelegate putBytesFunc; SeekDelegate seekFunc; CloseDelegate closeFunc; SizeDelegate sizeFunc; } gdip_tiff_clientData; static tsize_t gdip_tiff_fileread (thandle_t clientData, tdata_t buffer, tsize_t size) { return (tsize_t)fread(buffer, 1, size, (FILE*)clientData); } static tsize_t gdip_tiff_fileread_none (thandle_t clientData, tdata_t buffer, tsize_t size) { return 0; } static tsize_t gdip_tiff_filewrite (thandle_t clientData, tdata_t buffer, tsize_t size) { return (tsize_t)fwrite (buffer, 1, size, (FILE*)clientData); } static toff_t gdip_tiff_fileseek (thandle_t clientData, toff_t offSet, int whence) { int seek_ok = fseek ((FILE*)clientData, offSet, whence); if (seek_ok == 0) return offSet; return -1; } static int gdip_tiff_fileclose (thandle_t clientData) { /* This is a TIFF cleanup function; but we own the FILE* and close it in image.c so this is a null op */ return 0; } static toff_t gdip_tiff_filesize (thandle_t clientData) { long ret; long cur_pos = ftell ((FILE*)clientData); fseek ((FILE*)clientData, 0, SEEK_END); ret = ftell ((FILE*)clientData); fseek ((FILE*)clientData, cur_pos, SEEK_SET); return (toff_t)ret; } static int gdip_tiff_filedummy_map (thandle_t clientData, tdata_t *phase, toff_t* size) { return 0; } static void gdip_tiff_filedummy_unmap (thandle_t clientData, tdata_t base, toff_t size) { } static tsize_t gdip_tiff_read (thandle_t clientData, tdata_t buffer, tsize_t size) { return (tsize_t)((gdip_tiff_clientData *) clientData)->getBytesFunc (buffer, size, 0); } static tsize_t gdip_tiff_read_none (thandle_t clientData, tdata_t buffer, tsize_t size) { return 0; } static tsize_t gdip_tiff_write (thandle_t clientData, tdata_t buffer, tsize_t size) { return (tsize_t)((gdip_tiff_clientData *) clientData)->putBytesFunc (buffer, size); } static toff_t gdip_tiff_seek (thandle_t clientData, toff_t offSet, int whence) { return (toff_t)((gdip_tiff_clientData *) clientData)->seekFunc (offSet, whence); } static int gdip_tiff_close (thandle_t clientData) { /* We should not close the user provided streams */ /* ((gdip_tiff_clientData *) clientData)->closeFunc (); */ return 1; } static toff_t gdip_tiff_size (thandle_t clientData) { return (toff_t)((gdip_tiff_clientData *) clientData)->sizeFunc (); } static int gdip_tiff_dummy_map (thandle_t clientData, tdata_t *phase, toff_t* size) { return 0; } static void gdip_tiff_dummy_unmap (thandle_t clientData, tdata_t base, toff_t size) { } ImageCodecInfo * gdip_getcodecinfo_tiff () { tiff_codec.Clsid = (CLSID) { 0x557cf405, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; tiff_codec.FormatID = gdip_tif_image_format_guid; tiff_codec.CodecName = (const WCHAR*) tiff_codecname; tiff_codec.DllName = NULL; tiff_codec.FormatDescription = (const WCHAR*) tiff_format; tiff_codec.FilenameExtension = (const WCHAR*) tiff_extension; tiff_codec.MimeType = (const WCHAR*) tiff_mimetype; tiff_codec.Flags = ImageCodecFlagsEncoder | ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; tiff_codec.Version = 1; tiff_codec.SigCount = 2; tiff_codec.SigSize = 2; tiff_codec.SigPattern = tiff_sig_pattern; tiff_codec.SigMask = tiff_sig_mask; /* Mute the lib */ TIFFSetErrorHandler(NULL); TIFFSetWarningHandler(NULL); return &tiff_codec; } static GpStatus gdip_load_tiff_properties (TIFF *tiff, BitmapData *bitmap_data) { BYTE *text; uint32 i; uint16 s; uint16 s2; char c; double d; float f; uint16 samples_per_pixel; uint16 bits_per_sample; uint16 planar_configuration; uint32 image_length; uint16 strips_per_image; uint32 rows_per_strip; uint32 tile_length; uint32 tile_width; uint16 compression = 0; samples_per_pixel = 0; bits_per_sample = 0; planar_configuration = 0; image_length = 0; strips_per_image = 0; rows_per_strip = 0; tile_length = 0; tile_width = 0; i = 0; s = 0; s2 = 0; if (TIFFGetField(tiff, TIFFTAG_ARTIST, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagArtist, text); } if (TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bits_per_sample)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagBitsPerSample, bits_per_sample); } { uint16 *rmap; uint16 *gmap; uint16 *bmap; if (TIFFGetField(tiff, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) { BYTE *buffer; uint16 *ptr; if ((rmap != NULL) && (gmap != NULL) && (bmap != NULL)) { buffer = GdipAlloc (3 * bits_per_sample * sizeof (uint16)); if (buffer != NULL) { ptr = (uint16 *)buffer; for (i = 0; i < bits_per_sample; i++) { ptr[0] = rmap[i]; ptr[1] = gmap[i]; ptr[2] = bmap[i]; ptr += 3; } gdip_bitmapdata_property_add(bitmap_data, PropertyTagColorMap, 3 * bits_per_sample * sizeof(uint16), PropertyTagTypeShort, buffer); GdipFree(buffer); } } } } if (TIFFGetField(tiff, TIFFTAG_COMPRESSION, &s)) { compression = s; gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagCompression, s); } if (TIFFGetField(tiff, TIFFTAG_COPYRIGHT, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagCopyright, text); } if (TIFFGetField(tiff, TIFFTAG_DATETIME, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagDateTime, text); } if (TIFFGetField(tiff, TIFFTAG_DOCUMENTNAME, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagDocumentName, text); } if (TIFFGetField(tiff, TIFFTAG_DOTRANGE, &s, &s2)) { gdip_bitmapdata_property_add_srational(bitmap_data, PropertyTagDotRange, s, s2); } { uint16 count; uint16 *samples; if (TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &count, &samples)) { if ((count > 0) && (samples != NULL)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagExtraSamples, count * sizeof(uint16), PropertyTagTypeShort, samples); } } } if (TIFFGetField(tiff, TIFFTAG_FILLORDER, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagFillOrder, s); } if (TIFFGetField(tiff, TIFFTAG_GROUP3OPTIONS, &i, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagT4Option, i); } if (TIFFGetField(tiff, TIFFTAG_GROUP4OPTIONS, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagT6Option, i); } if (TIFFGetField(tiff, TIFFTAG_HALFTONEHINTS, &s, &s2)) { gdip_bitmapdata_property_add_srational(bitmap_data, PropertyTagHalftoneHints, s, s2); } if (TIFFGetField(tiff, TIFFTAG_HOSTCOMPUTER, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagHostComputer, text); } if (TIFFGetField(tiff, TIFFTAG_IMAGEDESCRIPTION, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagImageDescription, text); } if (TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagImageWidth, i); } if (TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &image_length)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagImageHeight, image_length); } if (TIFFGetField(tiff, TIFFTAG_INKNAMES, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagInkNames, text); } if (TIFFGetField(tiff, TIFFTAG_INKSET, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagInkSet, s); } #ifdef NotImplemented /* Don't know how this property should be stored, datatype is void */ { uint32 count; void *tables; if (TIFFGetField(tiff, TIFFTAG_JPEGTABLES, &count, &tables)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagJPEGTables, text); } } #endif if (TIFFGetField(tiff, TIFFTAG_JPEGQUALITY, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagJPEGQuality, i); } if (TIFFGetField(tiff, TIFFTAG_MAKE, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagEquipMake, text); } if (TIFFGetField(tiff, TIFFTAG_MAXSAMPLEVALUE, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagMaxSampleValue, s); } if (TIFFGetField(tiff, TIFFTAG_MINSAMPLEVALUE, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagMinSampleValue, s); } if (TIFFGetField(tiff, TIFFTAG_MODEL, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagEquipModel, text); } if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagOrientation, s); } if (TIFFGetField(tiff, TIFFTAG_PAGENAME, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagPageName, text); } if (TIFFGetField(tiff, TIFFTAG_PAGENUMBER, &s, &s2)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagPageNumber, s); } if (TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagPhotometricInterp, s); } if (TIFFGetField(tiff, TIFFTAG_PLANARCONFIG, &planar_configuration)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagPlanarConfig, planar_configuration); } if (compression == COMPRESSION_ADOBE_DEFLATE) { if (TIFFGetField(tiff, TIFFTAG_PREDICTOR, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagPredictor, s); } } { float *chromacities = NULL; /* 6-entry array */ if (TIFFGetField(tiff, TIFFTAG_PRIMARYCHROMATICITIES, &chromacities) && (chromacities != NULL)) { BYTE *buffer; uint32 *ptr; buffer = GdipAlloc(6 * (sizeof(uint32) + sizeof(uint32))); if (buffer != NULL) { ptr = (uint32 *)buffer; for (i = 0; i < 6; i++) { ptr[0] = (uint32)(chromacities[i] * 1000000); ptr[1] = 1000000; ptr += 2; } gdip_bitmapdata_property_add (bitmap_data, PropertyTagPrimaryChromaticities, 6 * (sizeof(uint32) + sizeof(uint32)), PropertyTagTypeRational, buffer); GdipFree(buffer); } } } if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagResolutionUnit, s); } if (TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagRowsPerStrip, rows_per_strip); } if (TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagSampleFormat, s); } if (TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagSamplesPerPixel, samples_per_pixel); } if (samples_per_pixel > 0) { float *ref_blackwhite; /* 2 * SamplesPerPixel array */ if (TIFFGetField(tiff, TIFFTAG_REFERENCEBLACKWHITE, &ref_blackwhite)) { BYTE *buffer; uint32 *ptr; buffer = GdipAlloc(2 * samples_per_pixel * (sizeof(uint32) + sizeof(uint32))); if (buffer != NULL) { ptr = (uint32 *)buffer; for (i = 0; i < 2 * samples_per_pixel; i++) { ptr[0] = (uint32)(ref_blackwhite[i] * 1000000); ptr[1] = 1000000; ptr += 2; } gdip_bitmapdata_property_add (bitmap_data, PropertyTagREFBlackWhite, 6 * (sizeof(uint32) + sizeof(uint32)), PropertyTagTypeRational, buffer); GdipFree(buffer); } } } if (TIFFGetField(tiff, TIFFTAG_SMAXSAMPLEVALUE, &d)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagSMaxSampleValue, d * 1000000, 1000000); } if (TIFFGetField(tiff, TIFFTAG_SMINSAMPLEVALUE, &d)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagSMinSampleValue, d * 1000000, 1000000); } if (TIFFGetField(tiff, TIFFTAG_SOFTWARE, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagSoftwareUsed, text); } if ((rows_per_strip != 0) && (planar_configuration != 0)) { uint32 *bytecounts; uint32 *offsets; int count; strips_per_image = floor ((image_length + rows_per_strip - 1) / rows_per_strip); if (planar_configuration == 1) { count = strips_per_image; } else { count = samples_per_pixel * strips_per_image; } if (TIFFGetField(tiff, TIFFTAG_STRIPBYTECOUNTS, &bytecounts)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagStripBytesCount, count * sizeof(uint32), PropertyTagTypeLong, bytecounts); } if (TIFFGetField(tiff, TIFFTAG_STRIPOFFSETS, &offsets)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagStripOffsets, count * sizeof(uint32), PropertyTagTypeLong, offsets); } } if (TIFFGetField(tiff, TIFFTAG_SUBFILETYPE, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagNewSubfileType, i); } if (TIFFGetField(tiff, TIFFTAG_TARGETPRINTER, &text)) { gdip_bitmapdata_property_add_ASCII(bitmap_data, PropertyTagTargetPrinter, text); } if (TIFFGetField(tiff, TIFFTAG_THRESHHOLDING, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagThreshHolding, s); } if (TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagTileWidth, tile_width); } if (TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagTileLength, tile_length); } if ((planar_configuration != 0) && (tile_width != 0) && (tile_length != 0)) { uint32 *byte_counts; uint32 *offsets; uint32 tiles_across; uint32 tiles_down; int tiles_per_image; int count; tiles_across = (image_length + tile_width - 1) / tile_width; tiles_down = (image_length + tile_length - 1) / tile_length; tiles_per_image = tiles_across * tiles_down; if (planar_configuration == 1) { count = tiles_per_image; } else { count = samples_per_pixel * tiles_per_image; } if (TIFFGetField(tiff, TIFFTAG_TILEBYTECOUNTS, &byte_counts)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagTileByteCounts, count * sizeof(uint32), PropertyTagTypeLong, byte_counts); } if (TIFFGetField(tiff, TIFFTAG_TILEOFFSETS, &offsets)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagTileOffset, count * sizeof(uint32), PropertyTagTypeLong, offsets); } } if (samples_per_pixel == 1) { uint16 *sample; if (TIFFGetField(tiff, TIFFTAG_TRANSFERFUNCTION, &sample)) { gdip_bitmapdata_property_add (bitmap_data, PropertyTagTransferFunction, (1 << bits_per_sample) * sizeof(uint16), PropertyTagTypeShort, sample); } } else if (samples_per_pixel == 3) { uint16 *r; uint16 *g; uint16 *b; if (TIFFGetField(tiff, TIFFTAG_TRANSFERFUNCTION, &r, &g, &b)) { BYTE *buffer; uint16 *ptr; buffer = GdipAlloc(3 * (1 << samples_per_pixel) * sizeof(uint16)); if (buffer != NULL) { ptr = (uint16 *)buffer; for (i = 0; i < 1 << bits_per_sample; i++) { ptr[i] = r[i]; ptr[i + 1] = g[i]; ptr[i + 2] = b[i]; } gdip_bitmapdata_property_add (bitmap_data, PropertyTagTransferFunction, 3 * (1 << samples_per_pixel) * sizeof(uint16), PropertyTagTypeShort, buffer); GdipFree(buffer); } } } { float *whitepoints; if (TIFFGetField(tiff, TIFFTAG_WHITEPOINT, &whitepoints)) { BYTE *buffer; uint32 *ptr; buffer = GdipAlloc(2 * (sizeof(uint32) + sizeof(uint32))); if (buffer != NULL) { ptr = (uint32 *)buffer; ptr[0] = whitepoints[0] * 1000000; ptr[1] = 1000000; ptr[2] = whitepoints[1] * 1000000; ptr[3] = 1000000; gdip_bitmapdata_property_add (bitmap_data, PropertyTagTransferFunction, 2 * (sizeof(uint32) + sizeof(uint32)), PropertyTagTypeRational, buffer); GdipFree(buffer); } gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagWhitePoint, whitepoints[0] * 1000000, 1000000); } } if (TIFFGetField(tiff, TIFFTAG_XPOSITION, &f)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagXPosition, f * 1000000, 1000000); } if (TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &f)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagXResolution, f, 1); } { float *coefficients; if (TIFFGetField(tiff, TIFFTAG_YCBCRCOEFFICIENTS, &coefficients)) { BYTE buffer[sizeof(uint32) * 6]; uint32 *ptr; ptr = (uint32 *)&buffer; ptr[0] = (uint32)(coefficients[0] * 1000000); ptr[1] = 1000000; ptr[2] = (uint32)(coefficients[1] * 1000000); ptr[3] = 1000000; ptr[4] = (uint32)(coefficients[2] * 1000000); ptr[5] = 1000000; gdip_bitmapdata_property_add(bitmap_data, PropertyTagYCbCrCoefficients, sizeof(uint32) * 6, PropertyTagTypeRational, buffer); } } if (TIFFGetField(tiff, TIFFTAG_YCBCRPOSITIONING, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagYCbCrPositioning, s); } if (TIFFGetField(tiff, TIFFTAG_YCBCRSUBSAMPLING, &s, &s2)) { gdip_bitmapdata_property_add_srational(bitmap_data, PropertyTagYCbCrSubsampling, s, s2); } if (TIFFGetField(tiff, TIFFTAG_YPOSITION, &f)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagYPosition, f * 1000000, 1000000); } if (TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &f)) { gdip_bitmapdata_property_add_rational(bitmap_data, PropertyTagYResolution, f, 1); } #ifdef NotImplemented /* Not sure what type the data is */ { uint32 count; void *profile_data; if (TIFFGetField(tiff, TIFFTAG_ICCPROFILE, &count, &profile_data)) { gdip_bitmapdata_property_add(bitmap_data, PropertyTagICCProfile, count * sizeof(void *), , profile_data); } } #endif /* EXIF section */ if (TIFFGetField(tiff, TIFFTAG_EXIFIFD, &i)) { gdip_bitmapdata_property_add_long(bitmap_data, PropertyTagExifIFD, i); } return Ok; } static GpStatus gdip_save_tiff_properties (TIFF *tiff, BitmapData *bitmap_data, int samples_per_pixel, int bits_per_sample) { int index; BYTE *text; guint32 i; guint32 l; int j; uint16 s; uint16 s2; double d; float f; i = 0; s = 0; s2 = 0; d = 0; if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagArtist, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_ARTIST, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagCopyright, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_COPYRIGHT, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagDateTime, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_DATETIME, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagDocumentName, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_DOCUMENTNAME, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagDotRange, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); gdip_property_get_short(2, bitmap_data->property[index].value, &s2); TIFFSetField(tiff, TIFFTAG_DOTRANGE, s, s2); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagExtraSamples, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_EXTRASAMPLES, bitmap_data->property[index].length, bitmap_data->property[index].value); } else { TIFFSetField (tiff, TIFFTAG_EXTRASAMPLES, 1, EXTRASAMPLE_UNSPECIFIED); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagFillOrder, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_FILLORDER, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagT4Option, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &l); TIFFSetField(tiff, TIFFTAG_GROUP3OPTIONS, l); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagT6Option, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &l); TIFFSetField(tiff, TIFFTAG_GROUP4OPTIONS, l); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagHalftoneHints, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); gdip_property_get_short(2, bitmap_data->property[index].value, &s2); TIFFSetField(tiff, TIFFTAG_HALFTONEHINTS, s, s2); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagHostComputer, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_HOSTCOMPUTER, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagImageDescription, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_IMAGEDESCRIPTION, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagInkNames, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_INKNAMES, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagInkSet, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_INKSET, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagJPEGQuality, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &l); TIFFSetField(tiff, TIFFTAG_JPEGQUALITY, l); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagEquipMake, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_MAKE, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagMaxSampleValue, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_MAXSAMPLEVALUE, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagMinSampleValue, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_MINSAMPLEVALUE, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagEquipModel, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_MODEL, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagOrientation, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_ORIENTATION, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagPageName, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_PAGENAME, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagPhotometricInterp, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagPredictor, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_PREDICTOR, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagPrimaryChromaticities, &index) == Ok) { float chromacities[6]; for (j = 0; j < 6; j++) { gdip_property_get_long(j * 8, bitmap_data->property[index].value, &i); chromacities[j] = (float)i / 1000000; } TIFFSetField(tiff, TIFFTAG_PRIMARYCHROMATICITIES, &chromacities); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagResolutionUnit, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagSampleFormat, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, s); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagREFBlackWhite, &index) == Ok) { float *ref_blackwhite; /* 2 * SamplesPerPixel array */ ref_blackwhite = GdipAlloc(2 * samples_per_pixel * sizeof(float)); if (ref_blackwhite != NULL) { for (j = 0; j < (2 * samples_per_pixel); j++) { gdip_property_get_long(j * 8, bitmap_data->property[index].value, &i); ref_blackwhite[j] = (float)i / 1000000; } TIFFSetField(tiff, TIFFTAG_REFERENCEBLACKWHITE, &ref_blackwhite); GdipFree(ref_blackwhite); } } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagSMaxSampleValue, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); d = (double)i / 10000000; TIFFSetField(tiff, TIFFTAG_SMAXSAMPLEVALUE, d); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagSMinSampleValue, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); d = (double)i / 10000000; TIFFSetField(tiff, TIFFTAG_SMINSAMPLEVALUE, d); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagSoftwareUsed, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_SOFTWARE, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagNewSubfileType, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_SUBFILETYPE, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagNewSubfileType, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &l); TIFFSetField(tiff, TIFFTAG_SUBFILETYPE, l); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagTargetPrinter, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_TARGETPRINTER, bitmap_data->property[index].value); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagThreshHolding, &index) == Ok) { gdip_property_get_short(0, bitmap_data->property[index].value, &s); TIFFSetField(tiff, TIFFTAG_THRESHHOLDING, s); } if (samples_per_pixel == 1) { if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagTransferFunction, &index) == Ok) { TIFFSetField(tiff, TIFFTAG_TRANSFERFUNCTION, bitmap_data->property[index].value); } } else if (samples_per_pixel == 3) { if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagTransferFunction, &index) == Ok) { uint16 *rmap; uint16 *gmap; uint16 *bmap; rmap = GdipAlloc((1 << samples_per_pixel) * sizeof(uint16)); gmap = GdipAlloc((1 << samples_per_pixel) * sizeof(uint16)); bmap = GdipAlloc( (1 << samples_per_pixel) * sizeof(uint16)); if ((rmap != NULL) && (gmap != NULL) && (bmap != NULL)) { for (j = 0; j < 1 << bits_per_sample; j++) { gdip_property_get_short((j * 3), bitmap_data->property[index].value, &rmap[j]); gdip_property_get_short((j * 3) + 1, bitmap_data->property[index].value, &gmap[j]); gdip_property_get_short((j * 3) + 2, bitmap_data->property[index].value, &bmap[j]); } TIFFSetField(tiff, TIFFTAG_TRANSFERFUNCTION, rmap, gmap, bmap); } if (rmap != NULL) { GdipFree(rmap); } if (gmap != NULL) { GdipFree(gmap); } if (bmap != NULL) { GdipFree(bmap); } } } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagXPosition, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); f = (float)i / 10000000; TIFFSetField(tiff, TIFFTAG_XPOSITION, f); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagXResolution, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); f = (float)i; TIFFSetField(tiff, TIFFTAG_XRESOLUTION, f); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagYCbCrCoefficients, &index) == Ok) { float coefficients[3]; gdip_property_get_long(0, bitmap_data->property[index].value, &i); coefficients[0] = (float)i / 1000000; gdip_property_get_long(8, bitmap_data->property[index].value, &i); coefficients[1] = (float)i / 1000000; gdip_property_get_long(16, bitmap_data->property[index].value, &i); coefficients[2] = (float)i / 1000000; TIFFSetField(tiff, TIFFTAG_YCBCRCOEFFICIENTS, coefficients); } if (TIFFGetField(tiff, TIFFTAG_YCBCRPOSITIONING, &s)) { gdip_bitmapdata_property_add_short(bitmap_data, PropertyTagYCbCrPositioning, s); } if (TIFFGetField(tiff, TIFFTAG_YCBCRSUBSAMPLING, &s, &s2)) { gdip_bitmapdata_property_add_srational(bitmap_data, PropertyTagYCbCrSubsampling, s, s2); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagYPosition, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); f = (float)i / 1000000; TIFFSetField(tiff, TIFFTAG_YPOSITION, f); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagYResolution, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); f = (float)i; TIFFSetField(tiff, TIFFTAG_YRESOLUTION, f); } if (gdip_bitmapdata_property_find_id(bitmap_data, PropertyTagExifIFD, &index) == Ok) { gdip_property_get_long(0, bitmap_data->property[index].value, &i); TIFFSetField(tiff, TIFFTAG_EXIFIFD, d); } return Ok; } /*TODO Handle TIFF Encoder Parameters*/ static GpStatus gdip_save_tiff_image (TIFF* tiff, GpImage *image, GDIPCONST EncoderParameters *params) { int frame; int x; int y; int i; int num_of_pages; int page; BitmapData *bitmap_data; BYTE *pixbuf; int samples_per_pixel; int bits_per_sample; if (tiff == NULL) { return InvalidParameter; } /* Count all pages, we need to know ahead */ num_of_pages = 0; for (frame = 0; frame < image->num_of_frames; frame++) { num_of_pages += image->frames[frame].count; for (i = 0; i < image->frames[frame].count; i++) { if (gdip_is_an_indexed_pixelformat (image->frames[frame].bitmap[i].pixel_format)) { return NotImplemented; /* FIXME? */ } } } page = 0; for (frame = 0; frame < image->num_of_frames; frame++) { for (i = 0; i < image->frames[frame].count; i++) { bitmap_data = &image->frames[frame].bitmap[i]; if (num_of_pages > 1) { if ((frame > 0) && (i > 0)) { TIFFCreateDirectory(tiff); } TIFFSetField (tiff, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE); TIFFSetField (tiff, TIFFTAG_PAGENUMBER, page, num_of_pages); } if (((bitmap_data->pixel_format & PixelFormatAlpha) != 0) || (bitmap_data->pixel_format == PixelFormat32bppRGB)) { samples_per_pixel = 4; bits_per_sample = 8; } else { samples_per_pixel = 3; bits_per_sample = 8; } gdip_save_tiff_properties(tiff, bitmap_data, samples_per_pixel, bits_per_sample); TIFFSetField (tiff, TIFFTAG_SAMPLESPERPIXEL, samples_per_pixel); TIFFSetField (tiff, TIFFTAG_IMAGEWIDTH, bitmap_data->width); TIFFSetField (tiff, TIFFTAG_IMAGELENGTH, bitmap_data->height); TIFFSetField (tiff, TIFFTAG_BITSPERSAMPLE, bits_per_sample); TIFFSetField (tiff, TIFFTAG_COMPRESSION, COMPRESSION_NONE); TIFFSetField (tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); TIFFSetField (tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField (tiff, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize (tiff, bitmap_data->stride)); TIFFSetField (tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); pixbuf = GdipAlloc (bitmap_data->width * samples_per_pixel); if (pixbuf == NULL) { goto error; } if (samples_per_pixel == 4) { for (y = 0; y < bitmap_data->height; y++) { for (x = 0; x < bitmap_data->width; x++) { #ifdef WORDS_BIGENDIAN pixbuf[x*4+0] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 1); pixbuf[x*4+1] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 2); pixbuf[x*4+2] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 3); pixbuf[x*4+3] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 0); #else pixbuf[x*4+0] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 2); pixbuf[x*4+1] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 1); pixbuf[x*4+2] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 0); pixbuf[x*4+3] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 3); #endif } TIFFWriteScanline (tiff, pixbuf, y, 0); } } else { for (y = 0; y < bitmap_data->height; y++) { for (x = 0; x < bitmap_data->width; x++) { #ifdef WORDS_BIGENDIAN pixbuf[x*3+0] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 1); pixbuf[x*3+1] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 2); pixbuf[x*3+2] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 3); #else pixbuf[x*3+0] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 2); pixbuf[x*3+1] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 1); pixbuf[x*3+2] = *((BYTE*)bitmap_data->scan0 + (bitmap_data->stride * y) + (x*4) + 0); #endif } TIFFWriteScanline (tiff, pixbuf, y, 0); } } GdipFree(pixbuf); TIFFWriteDirectory (tiff); page++; } } TIFFClose (tiff); return Ok; error: TIFFClose (tiff); return OutOfMemory; } static GpStatus gdip_load_tiff_image (TIFF *tiff, GpImage **image) { int i; char error_message[1024]; int num_of_pages; GpImage *result; int page; TIFFRGBAImage tiff_image; FrameData *frame; BitmapData *bitmap_data; size_t num_of_pixels; char *pixbuf; char *pixbuf_row; guint32 *pixbuf_ptr; guint16 samples_per_pixel; float dpi; if (tiff == NULL) { *image = NULL; /* we cannot call TIFFClose(tiff); with a NULL value since it will crash - bnc #569940 */ return InvalidParameter; } pixbuf_row = NULL; pixbuf = NULL; num_of_pages = TIFFNumberOfDirectories(tiff); result = gdip_bitmap_new(); if (!result) return OutOfMemory; result->type = ImageTypeBitmap; frame = gdip_frame_add(result, &gdip_image_frameDimension_page_guid); for (page = 0; page < num_of_pages; page++) { unsigned long long int size; bitmap_data = gdip_frame_add_bitmapdata(frame); if (bitmap_data == NULL) { goto error; } if (!TIFFSetDirectory(tiff, page)) { goto error; } gdip_load_tiff_properties(tiff, bitmap_data); if (!TIFFRGBAImageBegin(&tiff_image, tiff, 0, error_message)) { /* Can we use the error message somewhere? */ goto error; } if (TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel)) { if (samples_per_pixel != 4) { bitmap_data->pixel_format = PixelFormat24bppRGB; } else { bitmap_data->pixel_format = PixelFormat32bppARGB; bitmap_data->image_flags |= ImageFlagsHasAlpha; } } if (TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &dpi)) { bitmap_data->dpi_horz = dpi; bitmap_data->image_flags |= ImageFlagsHasRealDPI; } if (TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &dpi)) { bitmap_data->dpi_vert = dpi; bitmap_data->image_flags |= ImageFlagsHasRealDPI; } /* width and height are uint32, but TIFF uses 32 bits offsets (so it's real size limit is 4GB), * however libtiff uses signed int (int32 not uint32) as offsets so we limit ourselves to 2GB */ size = tiff_image.width; /* stride is a (signed) _int_ and once multiplied by 4 it should hold a value that can be allocated by GdipAlloc * this effectively limits 'width' to 536870911 pixels */ size *= sizeof (guint32); if (size > G_MAXINT32) goto error; bitmap_data->stride = size; bitmap_data->width = tiff_image.width; bitmap_data->height = tiff_image.height; bitmap_data->reserved = GBD_OWN_SCAN0; bitmap_data->image_flags |= ImageFlagsColorSpaceRGB | ImageFlagsHasRealPixelSize | ImageFlagsReadOnly; /* ensure total 'size' does not overflow an integer and fits inside our 2GB limit */ size *= tiff_image.height; if (size > G_MAXINT32) goto error; pixbuf = GdipAlloc (size); if (pixbuf == NULL) { goto error; } /* Flip the image. TIFF has its origin at bottom left, and is in ARGB instead of ABGR */ if (!TIFFRGBAImageGet(&tiff_image, (uint32 *)pixbuf, tiff_image.width, tiff_image.height)) { goto error; } pixbuf_row = GdipAlloc(bitmap_data->stride); if (pixbuf_row == NULL) { goto error; } /* First, flip rows */ for (i = 0; i < tiff_image.height / 2; i++) { memcpy(pixbuf_row, pixbuf + (bitmap_data->stride * i), bitmap_data->stride); memcpy(pixbuf + (bitmap_data->stride * i), pixbuf + (bitmap_data->stride * (tiff_image.height - i - 1)), bitmap_data->stride); memcpy(pixbuf + (bitmap_data->stride * (tiff_image.height - i - 1)), pixbuf_row, bitmap_data->stride); } /* Now flip from ARGB to ABGR processing one pixel (4 bytes) at the time */ pixbuf_ptr = (guint32 *)pixbuf; for (i = 0; i < (size >> 2); i++) { *pixbuf_ptr = (*pixbuf_ptr & 0xff000000) | ((*pixbuf_ptr & 0x00ff0000) >> 16) | (*pixbuf_ptr & 0x0000ff00) | ((*pixbuf_ptr & 0x000000ff) << 16); pixbuf_ptr++; } GdipFree(pixbuf_row); bitmap_data->scan0 = (BYTE*) pixbuf; pixbuf_row = NULL; pixbuf = NULL; TIFFRGBAImageEnd (&tiff_image); } gdip_bitmap_setactive(result, &gdip_image_frameDimension_page_guid, 0); TIFFClose(tiff); *image = result; return Ok; error: /* coverity[dead_error_line] */ if (pixbuf_row != NULL) { GdipFree(pixbuf_row); } if (pixbuf != NULL) { GdipFree(pixbuf); } if (result != NULL) { gdip_bitmap_dispose(result); } TIFFRGBAImageEnd (&tiff_image); TIFFClose(tiff); return OutOfMemory; } GpStatus gdip_load_tiff_image_from_file (FILE *fp, GpImage **image) { TIFF *tif = NULL; tif = TIFFClientOpen("", "r", (thandle_t) fp, gdip_tiff_fileread, gdip_tiff_filewrite, gdip_tiff_fileseek, gdip_tiff_fileclose, gdip_tiff_filesize, gdip_tiff_filedummy_map, gdip_tiff_filedummy_unmap); return gdip_load_tiff_image (tif, image); } GpStatus gdip_save_tiff_image_to_file (BYTE *filename, GpImage *image, GDIPCONST EncoderParameters *params) { TIFF* tiff; tiff = TIFFOpen((char *)filename, "w"); if (!tiff) return FileNotFound; return gdip_save_tiff_image (tiff, image, params); } GpStatus gdip_load_tiff_image_from_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image) { TIFF *tif = NULL; gdip_tiff_clientData clientData; clientData.getBytesFunc = getBytesFunc; clientData.putBytesFunc = putBytesFunc; clientData.seekFunc = seekFunc; clientData.closeFunc = closeFunc; clientData.sizeFunc = sizeFunc; tif = TIFFClientOpen("", "r", (thandle_t) &clientData, gdip_tiff_read, gdip_tiff_write, gdip_tiff_seek, gdip_tiff_close, gdip_tiff_size, gdip_tiff_dummy_map, gdip_tiff_dummy_unmap); return gdip_load_tiff_image (tif, image); } GpStatus gdip_save_tiff_image_to_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage *image, GDIPCONST EncoderParameters *params) { TIFF* tiff; gdip_tiff_clientData clientData; clientData.getBytesFunc = getBytesFunc; clientData.putBytesFunc = putBytesFunc; clientData.seekFunc = seekFunc; clientData.closeFunc = closeFunc; clientData.sizeFunc = sizeFunc; tiff = TIFFClientOpen("", "w", (thandle_t) &clientData, gdip_tiff_read_none, gdip_tiff_write, gdip_tiff_seek, gdip_tiff_close, gdip_tiff_size, gdip_tiff_dummy_map, gdip_tiff_dummy_unmap); if (!tiff) return InvalidParameter; return gdip_save_tiff_image (tiff, image, params); } #else /* no libtiff */ #include "image.h" ImageCodecInfo * gdip_getcodecinfo_tiff () { return NULL; } GpStatus gdip_load_tiff_image_from_file (FILE *fp, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_load_tiff_image_from_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image) { *image = NULL; return UnknownImageFormat; } GpStatus gdip_save_tiff_image_to_file (BYTE *filename, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } GpStatus gdip_save_tiff_image_to_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage *image, GDIPCONST EncoderParameters *params) { return UnknownImageFormat; } #endif libgdiplus-4.2/src/font.h0000664000175000017500000000473012377405421012357 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __FONT_H__ #define __FONT_H__ /* Font public API (only!) */ GpStatus GdipCreateFont (GDIPCONST GpFontFamily* family, float emSize, int style, Unit unit, GpFont **font); GpStatus GdipCreateFontFromDC (void *hdc, GpFont **font); GpStatus GdipDeleteFont (GpFont* font); GpStatus GdipGetLogFontA (GpFont *font, GpGraphics *graphics, LOGFONTA *logfontA); GpStatus GdipGetLogFontW (GpFont *font, GpGraphics *graphics, LOGFONTW *logfontW); GpStatus GdipGetFontHeight (GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, float *height); GpStatus GdipGetFontHeightGivenDPI (GDIPCONST GpFont *font, float dpi, float *height); GpStatus GdipGetFontSize (GpFont *font, float *size); /* missing API GdipCreateFontFromLogfontA GdipCreateFontFromLogfontW GdipCloneFont GdipGetFamily GdipGetFontStyle GdipGetFontUnit */ /* libgdiplus extra API (not availble in MSGDI+ but exported from libgdiplus) */ GpStatus GdipCreateFontFromHfontA (HFONT hfont, GpFont **font, void *lf); #endif libgdiplus-4.2/src/carbon-private.c0000664000175000017500000000460712377405421014323 00000000000000/* * carbon-private.c * * Copyright (C) 2008 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Geoff Norton */ #ifdef __APPLE__ #include #include static inline int gdip_get_int_from_dict_for_key (CFDictionaryRef dict, CFStringRef key) { CFNumberRef value = CFDictionaryGetValue (dict, key); int ret = 0; if (value == NULL) return 0; CFNumberGetValue (value, kCFNumberIntType, &ret); return ret; } void gdip_get_display_dpi_carbon (float *h_dpi, float *v_dpi) { if (getenv ("MONO_MWF_MAC_DETECT_DPI") != NULL) { CFDictionaryRef mode_dict = CGDisplayCurrentMode (kCGDirectMainDisplay); io_connect_t display_port = CGDisplayIOServicePort (kCGDirectMainDisplay); CFDictionaryRef display_dict = IOCreateDisplayInfoDictionary (display_port, 0); const float mmpi = 25.4; float h_size = (float) gdip_get_int_from_dict_for_key (display_dict, CFSTR (kDisplayHorizontalImageSize)) / mmpi; float v_size = (float) gdip_get_int_from_dict_for_key (display_dict, CFSTR (kDisplayVerticalImageSize)) / mmpi; *h_dpi = (float) gdip_get_int_from_dict_for_key (mode_dict, kCGDisplayWidth) / h_size; *v_dpi = (float) gdip_get_int_from_dict_for_key (mode_dict, kCGDisplayHeight) / v_size; CFRelease (display_dict); } else { *h_dpi = *v_dpi = 96.0f; } } #endif libgdiplus-4.2/src/win32structs.h0000664000175000017500000001447312377405421014010 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __WIN32STRUCTS_H__ #define __WIN32STRUCTS_H__ #include "glib.h" /* public enums and structures that GDI+ reuse from the other Windows API */ #define LF_FACESIZE 32 /* SetBkMode */ #define TRANSPARENT 1 #define OPAQUE 2 /* SetMapMode */ #define MM_TEXT 1 #define MM_LOMETRIC 2 #define MM_HIMETRIC 3 #define MM_LOENGLISH 4 #define MM_HIENGLISH 5 #define MM_TWIPS 6 #define MM_ISOTROPIC 7 #define MM_ANISOTROPIC 8 /* CreatePenIndirect */ #define PS_NULL 0x00000005 #define PS_STYLE_MASK 0x0000000F #define PS_ENDCAP_ROUND 0x00000000 #define PS_ENDCAP_SQUARE 0x00000100 #define PS_ENDCAP_FLAT 0x00000200 #define PS_ENDCAP_MASK 0x00000F00 #define PS_JOIN_ROUND 0x00000000 #define PS_JOIN_BEVEL 0x00001000 #define PS_JOIN_MITER 0x00002000 #define PS_JOIN_MASK 0x0000F000 /* CreateBrushIndirect */ #define BS_SOLID 0 #define BS_NULL 1 #define BS_HATCHED 2 #define BS_PATTERN 3 #define BS_INDEXED 4 /* SetPolyFillMode */ #define ALTERNATE 1 #define WINDING 2 /* SetRelabs */ #define ABSOLUTE 1 #define RELATIVE 2 /* ModifyWorldTransform */ #define MWT_IDENTITY 1 #define MWT_LEFTMULTIPLY 2 #define MWT_RIGHTMULTIPLY 3 typedef int LANGID; typedef int INT; typedef guint16 WCHAR; /* 16-bits unicode */ typedef guint32 UINT; typedef guint32 ARGB; typedef guint32 UINT32; typedef gint32 PROPID; typedef guint32 ULONG_PTR; /* not a pointer! */ typedef float REAL; typedef gpointer HBITMAP; typedef gpointer HDC; typedef gpointer HENHMETAFILE; typedef gpointer HFONT; typedef gpointer HICON; typedef gpointer HINSTANCE; typedef gpointer HMETAFILE; typedef gpointer HPALETTE; /* mono/io-layer/uglify.h also has these typedefs. * To avoid a dependency on mono we have copied all * the required stuff here. We don't include our defs * if uglify.h is included somehow. */ #ifndef _WAPI_UGLIFY_H_ /* to avoid conflict with uglify.h */ typedef const gunichar2 *LPCTSTR; typedef gunichar2 *LPTSTR; typedef guint8 BYTE; typedef guint8 *LPBYTE; typedef guint16 WORD; typedef guint32 DWORD; typedef gpointer PVOID; typedef gpointer LPVOID; typedef gboolean BOOL; typedef guint32 *LPDWORD; typedef gint16 SHORT; typedef gint32 LONG; typedef guint32 ULONG; typedef gint32 *PLONG; typedef guint64 LONGLONG; typedef gunichar2 TCHAR; typedef size_t SIZE_T; typedef gpointer HANDLE; typedef gpointer *LPHANDLE; typedef guint32 SOCKET; typedef gpointer HMODULE; typedef gpointer HRGN; #define CONST const #define VOID void #define IN #define OUT #define WINAPI #endif /* to avoid conflict with uglify.h */ typedef struct { DWORD Data1; WORD Data2; WORD Data3; BYTE Data4 [8]; } GUID, Guid, CLSID; typedef struct { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; char lfFaceName[LF_FACESIZE]; } LOGFONTA; typedef struct { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; WCHAR lfFaceName[LF_FACESIZE]; } LOGFONTW; typedef struct { float eM11; float eM12; float eM21; float eM22; float eDx; float eDy; } XFORM; typedef struct { LONG x; LONG y; } POINT; typedef DWORD COLORREF; typedef struct { UINT lopnStyle; POINT lopnWidth; COLORREF lopnColor; } LOGPEN; typedef struct { UINT lbStyle; COLORREF lbColor; LONG lbHatch; } LOGBRUSH; typedef struct { int left; int top; int right; int bottom; } RECT, RECTL; typedef struct { int cx; int cy; } SIZE, SIZEL; typedef struct { SHORT Left; SHORT Top; SHORT Right; SHORT Bottom; } PWMFRect16; #ifndef __GNUC__ #pragma pack(2) #endif typedef struct #ifdef __GNUC__ __attribute__ ((packed)) #endif { WORD mtType; /* 1 for disk, 0 for memory */ WORD mtHeaderSize; WORD mtVersion; DWORD mtSize; WORD mtNoObjects; DWORD mtMaxRecord; WORD mtNoParameters; } METAHEADER; typedef struct #ifdef __GNUC__ __attribute__ ((packed)) #endif { DWORD Key; SHORT Hmf; PWMFRect16 BoundingBox; SHORT Inch; DWORD Reserved; SHORT Checksum; } WmfPlaceableFileHeader; #ifndef __GNUC__ #pragma pack() #endif typedef struct { DWORD iType; DWORD nSize; RECTL rclBounds; RECTL rclFrame; DWORD dSignature; DWORD nVersion; DWORD nBytes; DWORD nRecords; WORD nHandles; WORD sReserved; DWORD nDescription; DWORD offDescription; DWORD nPalEntries; SIZEL szlDevice; SIZEL szlMillimeters; } ENHMETAHEADER3; typedef struct { int Type; int Size; int Version; int EmfPlusFlags; float DpiX; float DpiY; int X; int Y; int Width; int Height; union { METAHEADER WmfHeader; ENHMETAHEADER3 EmfHeader; }; int EmfPlusHeaderSize; int LogicalDpiX; int LogicalDpiY; } MetafileHeader; #endif libgdiplus-4.2/src/image.h0000664000175000017500000001334112377405421012471 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __IMAGE_H__ #define __IMAGE_H__ #include "codecs.h" /* * libgdiplus-specific types that needs to be exported to replace the COM-based IStream stuff GDI+ provides */ typedef int (*GetHeaderDelegate) (BYTE*, int); typedef int (*GetBytesDelegate) (BYTE*, int, BOOL); typedef long (*SeekDelegate) (int, int); typedef int (*PutBytesDelegate) (BYTE*, int); typedef void (*CloseDelegate) (); typedef long (*SizeDelegate) (); GpStatus GdipLoadImageFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image); GpStatus GdipSaveImageToDelegate_linux (GpImage *image, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GDIPCONST CLSID *encoderCLSID, GDIPCONST EncoderParameters *params); /* GDI+ exported Image functions */ GpStatus GdipLoadImageFromStream (void /*IStream*/ *stream, GpImage **image); GpStatus GdipLoadImageFromFile (GDIPCONST WCHAR *file, GpImage **image); GpStatus GdipLoadImageFromFileICM (GDIPCONST WCHAR* filename, GpImage **image); GpStatus GdipSaveImageToFile (GpImage *image, GDIPCONST WCHAR *file, GDIPCONST CLSID *clsidEncoder, GDIPCONST EncoderParameters *encoderParams); GpStatus GdipSaveImageToStream (GpImage *image, void /*IStream*/ *stream, GDIPCONST CLSID *clsidEncoder, GDIPCONST EncoderParameters *encoderParams); GpStatus GdipSaveAdd (GpImage *image, GDIPCONST EncoderParameters* encoderParams); GpStatus GdipSaveAddImage (GpImage *image, GpImage *newImage, GDIPCONST EncoderParameters *params); GpStatus GdipGetImageBounds (GpImage *image, GpRectF *srcRect, GpUnit *srcUnit); GpStatus GdipGetImageDimension (GpImage *image, REAL *width, REAL *height); GpStatus GdipGetImageType (GpImage *image, ImageType *type); GpStatus GdipGetImageWidth (GpImage *image, UINT *width); GpStatus GdipGetImageHeight (GpImage *image, UINT *heigth); GpStatus GdipGetImageHorizontalResolution (GpImage *image, REAL *resolution); GpStatus GdipGetImageVerticalResolution (GpImage *image, REAL *resolution); GpStatus GdipGetImageFlags (GpImage *image, UINT *flags); GpStatus GdipGetImageRawFormat (GpImage *image, GUID *format); GpStatus GdipGetImagePixelFormat (GpImage *image, PixelFormat *format); GpStatus GdipGetImageThumbnail (GpImage *image, UINT thumbWidth, UINT thumbHeight, GpImage **thumbImage, GetThumbnailImageAbort callback, VOID* callBackData); GpStatus GetEncoderParameterListSize (GpImage *image, GDIPCONST CLSID *clsidEncoder, UINT *size); GpStatus GetEncoderParameterList (GpImage *image, GDIPCONST CLSID *clsidEncoder, UINT size, EncoderParameters *buffer); GpStatus GdipImageGetFrameDimensionsCount (GpImage *image, UINT *count); GpStatus GdipImageGetFrameDimensionsList (GpImage *image, GUID *dimensionGUID, UINT count); GpStatus GdipImageGetFrameCount (GpImage *image, GDIPCONST GUID *dimensionGUID, UINT* count); GpStatus GdipImageSelectActiveFrame (GpImage *image, GDIPCONST GUID *dimensionGUID, UINT frameIndex); GpStatus GdipImageRotateFlip (GpImage *image, RotateFlipType rfType); GpStatus GdipGetImageGraphicsContext (GpImage *image, GpGraphics **graphics); GpStatus GdipGetImagePalette (GpImage *image, ColorPalette *palette, INT size); GpStatus GdipSetImagePalette (GpImage *image, GDIPCONST ColorPalette *palette); GpStatus GdipGetImagePaletteSize (GpImage *image, INT* size); GpStatus GdipGetPropertyCount (GpImage *image, UINT *numOfProperty); GpStatus GdipGetPropertyIdList (GpImage *image, UINT numOfProperty, PROPID *list); GpStatus GdipGetPropertyItemSize (GpImage *image, PROPID propID, UINT *size); GpStatus GdipGetPropertyItem (GpImage *image, PROPID propID, UINT size, PropertyItem *buffer); GpStatus GdipGetPropertySize (GpImage *image, UINT *totalBufferSize, UINT *numProperties); GpStatus GdipRemovePropertyItem (GpImage *image, PROPID propID); GpStatus GdipSetPropertyItem (GpImage *image, GDIPCONST PropertyItem *item); GpStatus GdipGetAllPropertyItems (GpImage *image, UINT totalBufferSize, UINT numProperties, PropertyItem *allItems); GpStatus GdipCloneImage(GpImage *image, GpImage **cloneImage); GpStatus GdipDisposeImage (GpImage *image); /* missing API GdipLoadImageFromStreamICM GdipImageForceValidation */ #endif libgdiplus-4.2/src/adjustablearrowcap-private.h0000664000175000017500000000364312377405421016740 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __ADJUSTABLEARROWCAP_PRIVATE_H__ #define __ADJUSTABLEARROWCAP_PRIVATE_H__ #include "gdiplus-private.h" #include "customlinecap-private.h" typedef struct _AdjustableArrowCap { CustomLineCap base; float width; float height; float middle_inset; BOOL fill_state; } AdjustableArrowCap; #include "adjustablearrowcap.h" #endif libgdiplus-4.2/src/region-path-tree.c0000664000175000017500000002045012377405421014553 00000000000000/* * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "region-path-tree.h" #include "graphics-path-private.h" /* * gdip_region_clear_tree: * @tree: a GpPathTree to clear * * Recursively clear (delete path and free memory) the specified path tree. */ void gdip_region_clear_tree (GpPathTree *tree) { if (!tree) return; if (tree->path) { GdipDeletePath (tree->path); tree->path = NULL; } else { gdip_region_clear_tree (tree->branch1); GdipFree (tree->branch1); gdip_region_clear_tree (tree->branch2); GdipFree (tree->branch2); } } /* * gdip_region_copy_tree: * @source: the GpPathTree to copy * @dest: the GpPathTree copy * * Recursively copy (and allocate) the @source path tree into @dest. * If @source is present then we must have a valid @dest. */ void gdip_region_copy_tree (GpPathTree *source, GpPathTree *dest) { if (!source) return; g_assert (dest); if (source->path) { GdipClonePath (source->path, &dest->path); dest->branch1 = NULL; dest->branch2 = NULL; } else { dest->path = NULL; dest->mode = source->mode; dest->branch1 = (GpPathTree *) GdipAlloc (sizeof (GpPathTree)); gdip_region_copy_tree (source->branch1, dest->branch1); dest->branch2 = (GpPathTree *) GdipAlloc (sizeof (GpPathTree)); gdip_region_copy_tree (source->branch2, dest->branch2); } } /* * gdip_region_get_tree_size: * @tree: a GpPathTree * * Recursively calculate the size (in bytes) required to serialized @tree. */ UINT gdip_region_get_tree_size (GpPathTree *tree) { UINT result; if (tree->path) { /* tag, count, fillmode, types and points */ result = 3 * sizeof (UINT) + (tree->path->count * sizeof (BYTE)) + (tree->path->count * sizeof (GpPointF)); } else { /* tag, operation, size (branch1), branch1, size (branch2), branch2 */ result = 4 * sizeof (guint32); result += gdip_region_get_tree_size (tree->branch1); result += gdip_region_get_tree_size (tree->branch2); } return result; } /* * gdip_region_deserialize_tree: * @data: a byte array * @size: the length of the byte array * @tree: a GpPathTree * * Recursively deserialize the @tree from the supplied buffer @data. Returns * TRUE if the deserialization was possible, or FALSE if a problem was found * (e.g. @size mismatch, bad data...) */ BOOL gdip_region_deserialize_tree (BYTE *data, int size, GpPathTree *tree) { int len = sizeof (guint32); guint32 tag; memcpy (&tag, data, len); data += len; size -= len; switch (tag) { case REGION_TAG_PATH: { /* deserialize a path from the memory blob */ guint32 count; FillMode mode; tree->mode = CombineModeReplace; tree->branch1 = NULL; tree->branch2 = NULL; /* count */ memcpy (&count, data, len); data += len; size -= len; /* mode (FillMode, not CombineMode) */ memcpy (&mode, data, len); data += len; size -= len; /* check that the size match the length of the type (byte) and GpPointF for the specified count */ if (size == count + count * sizeof (GpPointF)) { BYTE* types = data; GpPointF *points = (GpPointF*) (data + count); return (GdipCreatePath2 (points, types, count, mode, &tree->path) == Ok); } return FALSE; } break; case REGION_TAG_TREE: { guint branch_size; tree->path = NULL; /* operation */ memcpy (&tree->mode, data, len); data += len; size -= len; /* size (branch1) */ memcpy (&branch_size, data, len); data += len; size -= len; /* deserialize a tree from the memory blob */ tree->branch1 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); if (!gdip_region_deserialize_tree (data, branch_size, tree->branch1)) return FALSE; data += branch_size; size -= branch_size; /* size (branch2) */ memcpy (&branch_size, data, len); data += len; size -= len; tree->branch2 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); if (!gdip_region_deserialize_tree (data, branch_size, tree->branch2)) return FALSE; } break; default: g_warning ("Invalid tag %d", tag); return FALSE; } return TRUE; } /* * gdip_region_serialize_tree: * @tree: a GpPathTree * @buffer: a byte array * @bufferSize: the length of the byte array * @sizeFilled: a pointer to a integer * * Recursively serialize the @tree data in the supplied @buffer. Returns TRUE * if the serialization was possible, or FALSE if a problem was found (e.g. * @bufferSize too small). If successful @sizeFilled will contains the actual * number of bytes that were required to serialize @tree. */ BOOL gdip_region_serialize_tree (GpPathTree *tree, BYTE *buffer, UINT bufferSize, UINT *sizeFilled) { if (tree->path) { /* tag */ guint32 temp = REGION_TAG_PATH; int len = sizeof (guint32); memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; /* count */ memcpy (buffer, &tree->path->count, len); buffer += len; *sizeFilled += len; /* fill_mode */ temp = tree->path->fill_mode; memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; /* types */ len = tree->path->types->len; memcpy (buffer, tree->path->types->data, len); buffer += tree->path->types->len; *sizeFilled += len; /* points */ len = tree->path->points->len * sizeof (GpPointF); memcpy (buffer, tree->path->points->data, len); buffer += len; *sizeFilled += len; } else { /* tag */ BYTE *original = buffer; guint32 temp = REGION_TAG_TREE; int len = sizeof (guint32); memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; /* operation */ temp = tree->mode; memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; /* serialize branch 1 (size + branch) */ temp = gdip_region_get_tree_size (tree->branch1); memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; if (!gdip_region_serialize_tree (tree->branch1, buffer, bufferSize - (buffer - original), sizeFilled)) return FALSE; buffer += temp; /* serialize branch 2 (size + branch) */ temp = gdip_region_get_tree_size (tree->branch2); memcpy (buffer, &temp, len); buffer += len; *sizeFilled += len; if (!gdip_region_serialize_tree (tree->branch2, buffer, bufferSize - (buffer - original), sizeFilled)) return FALSE; } return TRUE; } /* * gdip_region_transform_tree: * @tree: a GpPathTree * @matrix: the GpMatrix to apply to the tree * * Recursively apply the @matrix to the @tree. */ GpStatus gdip_region_transform_tree (GpPathTree *tree, GpMatrix *matrix) { if (tree->path) { return GdipTransformPath (tree->path, matrix); } else { GpStatus status; status = gdip_region_transform_tree (tree->branch1, matrix); if (status == Ok) status = gdip_region_transform_tree (tree->branch2, matrix); return status; } } /* * gdip_region_translate_tree: * @tree: a GpPathTree * @dx: the delta x to apply to each point * @dy: the delta y to apply to each point * * Recursively apply the @dx, @dy translation to each point, of each path, * in the @tree. */ void gdip_region_translate_tree (GpPathTree *tree, float dx, float dy) { if (tree->path) { int i; for (i = 0; i < tree->path->count; i++) { GpPointF *point = &g_array_index (tree->path->points, GpPointF, i); point->X += dx; point->Y += dy; } } else { gdip_region_translate_tree (tree->branch1, dx, dy); gdip_region_translate_tree (tree->branch2, dx, dy); } } libgdiplus-4.2/src/carbon-private.h0000664000175000017500000000247212377405421014326 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Geoff Norton (gnorton@novell.com) * * Copyright (C) 2008 Novell, Inc (http://www.novell.com) */ #ifndef __CARBON_PRIVATE_H__ #define __CARBON_PRIVATE_H__ #ifdef __APPLE__ void gdip_get_display_dpi_carbon (float *h_dpi, float *v_dpi); #endif #endif libgdiplus-4.2/src/region.c0000664000175000017500000014516112377405421012673 00000000000000/* * Copyright (c) 2004-2005 Ximian * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jordi Mas i Hernandez , 2004-2005 * Sebastien Pouliot * */ #include "region-private.h" #include "graphics-path-private.h" /* Helper functions */ static void gdip_from_Rect_To_RectF (GpRect* rect, GpRectF* rectf) { rectf->X = rect->X; rectf->Y = rect->Y; rectf->Width = rect->Width; rectf->Height = rect->Height; } static void gdip_add_rect_to_array (GpRectF** srcarray, int* elements, GpRectF* rect) { GpRectF *array, *next; array = GdipAlloc (sizeof (GpRectF) * (*elements + 1)); memcpy (array, *srcarray, sizeof (GpRectF) * (*elements)); if (*srcarray) GdipFree (*srcarray); next = array; next += (*elements); memcpy (next, rect, sizeof (GpRectF)); *srcarray = array; *elements = *elements + 1; } static BOOL gdip_is_Point_in_RectF_Visible (float x, float y, GpRectF* rect) { if ((x >= rect->X && x < (rect->X + rect->Width)) && (y >= rect->Y && y < (rect->Y + rect->Height))) return TRUE; else return FALSE; } static BOOL gdip_is_Point_in_RectFs_Visible (float x, float y, GpRectF* r, int cnt) { GpRectF* rect = r; int i; for (i = 0; i < cnt; i++, rect++) { if (gdip_is_Point_in_RectF_Visible (x, y, rect)) { return TRUE; } } return FALSE; } static void gdip_get_bounds (GpRectF *allrects, int allcnt, GpRectF *bound) { float nx, ny, fx, fy; int i; GpRectF *rect; if (allrects == NULL || allcnt == 0) { bound->X = bound->Y = bound->Width = bound->Height = 0; return; } /* Build a rect that contains all the rects inside. Smallest x,y and biggest x,y*/ nx = allrects->X; ny = allrects->Y; fx = allrects->X + allrects->Width; fy = allrects->Y + allrects->Height; for (i = 0, rect = allrects; i < allcnt; i++, rect++) { if (rect->X < nx) nx = rect->X; if (rect->Y < ny) ny = rect->Y; if (rect->X + rect->Width > fx) fx = rect->X + rect->Width; if (rect->Y + rect->Height > fy) fy = rect->Y + rect->Height; } bound->X = nx; bound->Y = ny; bound->Width = fx - nx; bound->Height = fy - ny; } /* This internal version doesn't require a Graphic object to work */ static BOOL gdip_is_region_empty (GpRegion *region) { GpRectF rect; if (!region) return FALSE; if (region->type == RegionTypePath) { /* check for an existing, but empty, path list */ if (!region->tree) return TRUE; if (region->tree->path) return (region->tree->path->count == 0); return FALSE; } if (!region->rects || (region->cnt == 0)) return TRUE; gdip_get_bounds (region->rects, region->cnt, &rect); return ((rect.Width == 0) || (rect.Height == 0)); } static BOOL gdip_is_rect_infinite (GpRectF *rect) { return (rect && (rect->X == REGION_INFINITE_POSITION) && (rect->Y == REGION_INFINITE_POSITION) && (rect->Width == REGION_INFINITE_LENGTH) && (rect->Height == REGION_INFINITE_LENGTH)); } BOOL gdip_is_InfiniteRegion (GpRegion *region) { switch (region->type) { case RegionTypeRectF: if (region->cnt != 1) return FALSE; return gdip_is_rect_infinite (region->rects); case RegionTypePath: /* FIXME: incomplete and not 100% accurate (curves) - but cover the most common case */ if (region->tree && region->tree->path && (region->tree->path->count == 4)) { GpRectF bounds; if (GdipGetPathWorldBounds (region->tree->path, &bounds, NULL, NULL) != Ok) return gdip_is_rect_infinite (&bounds); } break; default: g_warning ("unknown type %d", region->type); break; } return FALSE; } static BOOL gdip_intersects (GpRectF *rect1, GpRectF *rect2) { if (rect1->X + rect1->Width == rect2->X) { return TRUE; } return (rect1->X < rect2->X + rect2->Width && rect1->X + rect1->Width > rect2->X && rect1->Y < rect2->Y + rect2->Height && rect1->Y + rect1->Height > rect2->Y); } /* Is source contained in target ? */ static BOOL gdip_contains (GpRectF *rect1, GpRectF *rect2) { return (rect1->X >= rect2->X && rect1->X + rect1->Width <= rect2->X + rect2->Width && rect1->Y >= rect2->Y && rect1->Y + rect1->Height <= rect2->Y + rect2->Height); } static BOOL gdip_add_rect_to_array_notcontained (GpRectF** srcarray, int* elements, GpRectF* rect) { int i; GpRectF* rectarray = *srcarray; if (rect->Height <= 0 || rect->Width <= 0) return FALSE; for (i = 0; i < *elements; i++, rectarray++) { if (gdip_contains (rect, rectarray) == TRUE) { return FALSE; } } gdip_add_rect_to_array (srcarray, elements, rect); return TRUE; } static BOOL gdip_equals (GpRectF *rect1, GpRectF *rect2) { if (!rect1) return (rect2 == NULL); return (rect1->X == rect2->X && rect1->Width == rect2->Width && rect1->Y == rect2->Y && rect1->Height == rect2->Height); } BOOL gdip_is_Point_in_RectF_inclusive (float x, float y, GpRectF* rect) { if ((x >= rect->X && x <= (rect->X + rect->Width)) && (y >= rect->Y && y <= (rect->Y + rect->Height))) return TRUE; else return FALSE; } /* Finds a rect that has the lowest x and y after the src rect provided */ static BOOL gdip_getlowestrect (GpRectF *rects, int cnt, GpRectF* src, GpRectF* rslt) { int i; GpRectF *current; GpRectF *lowest = NULL; for (i = 0, current = rects; i < cnt; i++, current++) { if (current->Width <= 0 || current->Height <= 0) continue; if (current->Y > src->Y || (current->Y == src->Y && current->X > src->X)) { if (lowest == NULL) { lowest = current; } else { if (current->Y < lowest->Y || (current->Y == lowest->Y && current->X < lowest->X)) { lowest = current; } } } } if (lowest == NULL) { return FALSE; } rslt->X = lowest->X; rslt->Y = lowest->Y; rslt->Width = lowest->Width; rslt->Height = lowest->Height; return TRUE; } void gdip_clear_region (GpRegion *region) { region->type = RegionTypeEmpty; if (region->rects) { GdipFree (region->rects); region->rects = NULL; } if (region->tree) { gdip_region_clear_tree (region->tree); GdipFree (region->tree); region->tree = NULL; } if (region->bitmap) { gdip_region_bitmap_free (region->bitmap); region->bitmap = NULL; } region->cnt = 0; } void gdip_copy_region (GpRegion *source, GpRegion *dest) { dest->type = source->type; if (source->rects) { dest->cnt = source->cnt; dest->rects = (GpRectF *) GdipAlloc (sizeof (GpRectF) * source->cnt); memcpy (dest->rects, source->rects, sizeof (GpRectF) * source->cnt); } else { dest->cnt = 0; dest->rects = NULL; } if (source->tree) { dest->tree = (GpPathTree *) GdipAlloc (sizeof (GpPathTree)); gdip_region_copy_tree (source->tree, dest->tree); } else { dest->tree = NULL; } if (source->bitmap) { dest->bitmap = gdip_region_bitmap_clone (source->bitmap); } else { dest->bitmap = NULL; } } /* convert a rectangle-based region to a path based region */ static void gdip_region_convert_to_path (GpRegion *region) { int i; GpRectF *rect; /* no conversion is required for complex regions */ if (!region || (region->type != RegionTypeRectF)) return; region->type = RegionTypePath; region->tree = (GpPathTree *) GdipAlloc (sizeof (GpPathTree)); GdipCreatePath (FillModeAlternate, ®ion->tree->path); /* all rectangles are converted into a single path */ for (i = 0, rect = region->rects; i < region->cnt; i++, rect++) { GdipAddPathRectangle (region->tree->path, rect->X, rect->Y, rect->Width, rect->Height); } if (region->rects) { GdipFree (region->rects); region->rects = NULL; } } /* * Create a region (path-tree) from a path. */ static GpStatus gdip_region_create_from_path (GpRegion *region, GpPath *path) { region->type = RegionTypePath; region->tree = (GpPathTree *) GdipAlloc (sizeof (GpPathTree)); return GdipClonePath (path, ®ion->tree->path); } static GpStatus gdip_createRegion (GpRegion **region, RegionType type, void *src) { GpRegion *result; GpRectF rect; result = (GpRegion *) GdipAlloc (sizeof (GpRegion)); result->type = type; result->cnt = 0; result->rects = NULL; result->tree = NULL; result->bitmap = NULL; switch (type) { case RegionTypeRect: gdip_from_Rect_To_RectF ((GpRect *)src, &rect); gdip_add_rect_to_array (&result->rects, &result->cnt, &rect); result->type = RegionTypeRectF; break; case RegionTypeRectF: gdip_add_rect_to_array (&result->rects, &result->cnt, (GpRectF *)src); break; case RegionTypeEmpty: GdipSetInfinite (result); /* note: GdipSetInfinite converts type to RegionTypeRectF */ break; case RegionTypePath: gdip_region_create_from_path (result, (GpPath*)src); break; default: g_warning ("unknown type %d", result->type); return NotImplemented; } *region = result; return Ok; } /* API implementation */ // coverity[+alloc : arg-*0] GpStatus GdipCreateRegion (GpRegion **region) { if (!region) return InvalidParameter; return gdip_createRegion (region, RegionTypeEmpty, NULL); } // coverity[+alloc : arg-*1] GpStatus GdipCreateRegionRect (GDIPCONST GpRectF *rect, GpRegion **region) { if (!region || !rect) return InvalidParameter; return gdip_createRegion (region, RegionTypeRectF, (void*) rect); } // coverity[+alloc : arg-*1] GpStatus GdipCreateRegionRectI (GDIPCONST GpRect *rect, GpRegion **region) { if (!region || !rect) return InvalidParameter; return gdip_createRegion (region, RegionTypeRect, (void*) rect); } // coverity[+alloc : arg-*2] GpStatus GdipCreateRegionRgnData (GDIPCONST BYTE *regionData, int size, GpRegion **region) { GpRegion *result; if (!region || !regionData) return InvalidParameter; if (size < 8) return GenericError; result = (GpRegion *) GdipAlloc (sizeof (GpRegion)); memcpy (&result->type, regionData, sizeof (guint32)); result->cnt = 0; result->rects = NULL; result->tree = NULL; result->bitmap = NULL; switch (result->type) { case RegionTypeRectF: { guint32 count; GpRectF *rect; int i; memcpy (&count, regionData + 4, sizeof (guint32)); if (count != (size - 8) / sizeof (GpRectF)) { GdipFree (result); return InvalidParameter; } for (i = 0, rect = (GpRectF*)(regionData + 8); i < count; i++, rect++) gdip_add_rect_to_array (&result->rects, &result->cnt, rect); } break; case RegionTypePath: if (size < 16) { GdipFree (result); return InvalidParameter; } result->tree = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); if (!gdip_region_deserialize_tree ((BYTE*)(regionData + 4), (size - 4), result->tree)) { GdipFree (result); return InvalidParameter; } break; default: g_warning ("unknown type %d", result->type); GdipFree (result); return NotImplemented; } *region = result; return Ok; } // coverity[+alloc : arg-*1] GpStatus GdipCloneRegion (GpRegion *region, GpRegion **cloneRegion) { GpRegion *result; if (!region || !cloneRegion) return InvalidParameter; result = (GpRegion *) GdipAlloc (sizeof (GpRegion)); if (!result) return OutOfMemory; gdip_copy_region (region, result); *cloneRegion = result; return Ok; } GpStatus GdipDeleteRegion (GpRegion *region) { if (!region) return InvalidParameter; gdip_clear_region (region); GdipFree (region); return Ok; } GpStatus GdipSetInfinite (GpRegion *region) { GpRectF rect; if (!region) return InvalidParameter; gdip_clear_region (region); region->type = RegionTypeRectF; rect.X = rect.Y = REGION_INFINITE_POSITION; rect.Width = rect.Height = REGION_INFINITE_LENGTH; gdip_add_rect_to_array (®ion->rects, ®ion->cnt, &rect); return Ok; } GpStatus GdipSetEmpty (GpRegion *region) { if (!region) return InvalidParameter; gdip_clear_region (region); region->type = RegionTypeRectF; return Ok; } /* pre-process negative width and height, without modifying the originals, see bug #383878 */ static void gdip_normalize_rectangle (GpRectF *rect, GpRectF *normalized) { if (rect->Width < 0) { normalized->X = rect->X + rect->Width; normalized->Width = fabs (rect->Width); } else { normalized->X = rect->X; normalized->Width = rect->Width; } if (rect->Height < 0) { normalized->Y = rect->Y + rect->Height; normalized->Height = fabs (rect->Height); } else { normalized->Y = rect->Y; normalized->Height = rect->Height; } } /* Exclude */ static void gdip_combine_exclude (GpRegion *region, GpRectF *rtrg, int cntt) { GpRectF *allsrcrects = NULL, *rects = NULL; GpRectF *alltrgrects = NULL, *rect, *rectop, *recttrg; int allsrccnt = 0, cnt = 0, i, n, alltrgcnt = 0; GpRectF current, rslt, newrect; BOOL storecomplete; /* Create the list of source rectangles to process, it will contain splitted ones later */ for (i = 0, rect = region->rects; i < region->cnt; i++, rect++) gdip_add_rect_to_array (&allsrcrects, &allsrccnt, rect); /* Create the list of target rectangles to process, it will contain splitted ones later */ for (i = 0, rect = rtrg; i < cntt; i++, rect++) { /* normalize */ GpRectF normal; gdip_normalize_rectangle (rect, &normal); gdip_add_rect_to_array (&alltrgrects, &alltrgcnt, &normal); } /* Init current with the first element in the array */ current.X = REGION_INFINITE_POSITION - 1; current.Y = REGION_INFINITE_POSITION - 1; current.Width = 0; current.Height = 0; while (gdip_getlowestrect (allsrcrects, allsrccnt, ¤t, &rslt)) { current.X = rslt.X; current.Y = rslt.Y; current.Width = rslt.Width; current.Height = rslt.Height; storecomplete = TRUE; /* Current rect with lowest y and X against the target ones */ for (i = 0, recttrg = alltrgrects; i < alltrgcnt; i++, recttrg++) { if (gdip_intersects (¤t, recttrg) == FALSE || gdip_equals (¤t, recttrg) == TRUE || recttrg->Height < 0 || recttrg->Width < 0) { continue; } /* Once a rect is splitted, we do not want to take into account anymore */ for (rectop = allsrcrects, n = 0; n < allsrccnt; n++, rectop++) { if (gdip_equals (¤t, rectop)) { rectop->X = 0; rectop->Y = 0; rectop->Width = 0; rectop->Height = 0; break; } } /* Result rect */ newrect.Y = current.Y; if (current.Y >= recttrg->Y) { /* Our rect intersects in the upper part with another rect */ newrect.Height = MIN (recttrg->Y + recttrg->Height - current.Y, current.Height); if (newrect.Height < 0) newrect.Height = current.Height; if (current.X >= recttrg->X) { /* Hit from behind */ newrect.X = recttrg->X + recttrg->Width; newrect.Width = MAX (current.X + current.Width - newrect.X, 0); } else { newrect.X = current.X; newrect.Width = MAX (recttrg->X - current.X, 0); } } else { newrect.Height = MIN (recttrg->Y - current.Y, current.Height); newrect.X = current.X; newrect.Width = current.Width; } gdip_add_rect_to_array_notcontained (&rects, &cnt, &newrect); /* What's left to process from the source region */ if (current.Y >= recttrg->Y) { /* Our rect intersects in the upper part with another rect */ /* A whole part from the top has been taken*/ if (recttrg->X <= current.X && recttrg->X + recttrg->Width >= current.X + current.Width) rslt.Y = recttrg->Y + recttrg->Height; else rslt.Y = newrect.Y + newrect.Height; rslt.Height = current.Y + current.Height - rslt.Y; } else { rslt.Y = recttrg->Y; rslt.Height = current.Y + current.Height - recttrg->Y; } rslt.X = current.X; rslt.Width = current.Width; if (rslt.Height > 0 && rslt.Width > 0) { gdip_add_rect_to_array (&allsrcrects, &allsrccnt, &rslt); } /* Special case where our rect is hit and split in two parts IIIUIII */ if (recttrg->X >= current.X && recttrg->X + recttrg->Width <= current.X + current.Width) { /* Generate extra right rect, keep previous values of Y and Height */ newrect.Width = current.X + current.Width - (recttrg->X + recttrg->Width); newrect.X = recttrg->X + recttrg->Width; gdip_add_rect_to_array_notcontained (&rects, &cnt, &newrect); } storecomplete = FALSE; break; } /* don't include a rectangle identical to the excluded one! */ if (storecomplete && !gdip_equals (rtrg, ¤t)) { gdip_add_rect_to_array_notcontained (&rects, &cnt, ¤t); } } GdipFree (allsrcrects); GdipFree (alltrgrects); if (region->rects) GdipFree (region->rects); region->rects = rects; region->cnt = cnt; } /* Complement: the part of the second region not shared with the first region. Scans the region to be combined and store the rects not present in the region */ static void gdip_combine_complement (GpRegion *region, GpRectF *rtrg, int cntt) { GpRegion regsrc; GpRectF* trg, *rect; GpRectF* allsrcrects = NULL; int allsrccnt = 0, i, trgcnt; /* Create the list of source rectangles to process */ for (i = 0, rect = rtrg; i < cntt; i++, rect++) { /* normalize */ GpRectF normal; gdip_normalize_rectangle (rect, &normal); gdip_add_rect_to_array (&allsrcrects, &allsrccnt, &normal); } regsrc.rects = allsrcrects; regsrc.cnt = allsrccnt; trg = region->rects; trgcnt = region->cnt; gdip_combine_exclude (®src, trg, trgcnt); if ((regsrc.rects != allsrcrects) || (regsrc.cnt != allsrccnt)) { if (region->rects) GdipFree (region->rects); region->rects = regsrc.rects; region->cnt = regsrc.cnt; } } /* Union */ static void gdip_combine_union (GpRegion *region, GpRectF *rtrg, int cnttrg) { GpRectF *allrects = NULL, *rects = NULL; GpRectF *recttrg, *rect, *rectop; int allcnt = 0, cnt = 0, i, n; GpRectF current, rslt, newrect; BOOL storecomplete, contained; /* All the src and trg rects in a single array*/ for (i = 0, rect = region->rects; i < region->cnt; i++, rect++) gdip_add_rect_to_array (&allrects, &allcnt, rect); for (i = 0, rect = rtrg; i < cnttrg; i++, rect++) { /* normalize */ GpRectF normal; gdip_normalize_rectangle (rect, &normal); gdip_add_rect_to_array (&allrects, &allcnt, &normal); } if (allcnt == 0) { GdipFree (allrects); return; } /* Init current with the first element in the array */ current.X = REGION_INFINITE_POSITION; current.Y = REGION_INFINITE_POSITION; current.Width = 0; current.Height = 0; while (gdip_getlowestrect (allrects, allcnt, ¤t, &rslt)) { current.X = rslt.X; current.Y = rslt.Y; current.Width = rslt.Width; current.Height = rslt.Height; storecomplete = TRUE; /* Current rect with lowest y and X againt the stored ones */ for (i = 0, recttrg = allrects; i < allcnt; i++, recttrg++) { /* If it has lower coordinates it has been already processed */ if (current.Y > recttrg->Y || (current.Y == recttrg->Y && current.X > recttrg->X)) { continue; } if (gdip_intersects (¤t, recttrg) == FALSE || gdip_equals (¤t, recttrg) == TRUE || recttrg->Height < 0 || recttrg->Width < 0) { continue; } if (gdip_contains (recttrg, ¤t) == TRUE) { continue; } /* Once a rect is splitted, we do not want to take into account anymore */ for (rectop = allrects, n = 0; n < allcnt; n++, rectop++) { if (gdip_equals (¤t, rectop)) { rectop->X = 0; rectop->Y = 0; rectop->Width = 0; rectop->Height = 0; break; } } /* Our rect intersects in the lower part with another rect */ newrect.Y = current.Y; if (current.Y == recttrg->Y) { newrect.X = MIN (current.X, recttrg->X); newrect.Width = MAX (current.X + current.Width, recttrg->X + recttrg->Width) - newrect.X; newrect.Height = MIN (current.Height, recttrg->Height); } else { newrect.X = current.X; newrect.Width = current.Width; newrect.Height = recttrg->Y - current.Y; /* If it's contained inside, get the > height */ if (recttrg->X >= current.X && recttrg->X + recttrg->Width <= current.X + current.Width) newrect.Height = MAX (current.Height, recttrg->Height); } gdip_add_rect_to_array_notcontained (&rects, &cnt, &newrect); /* Push what's left from the current the rect in the list of rects to process if it's already not contained in other rects except the current (we just split from there) */ rslt.X = current.X; rslt.Y = newrect.Y + newrect.Height; rslt.Width = current.Width; rslt.Height = current.Height - newrect.Height; contained = FALSE; for (rectop = allrects, n = 0; n < allcnt; n++, rectop++) { if (gdip_equals (rectop, ¤t)) /* If it's contained with the current does not count */ continue; if (gdip_contains (&rslt, rectop)) { contained = TRUE; break; } } if (contained == FALSE && rslt.Height > 0 && rslt.Width > 0) { gdip_add_rect_to_array (&allrects, &allcnt, &rslt); recttrg = allrects; } /* If both we at the same Y when take into account the X also to process the following that exceeds the X also */ if (recttrg->Y == current.Y) { if (recttrg->Height <= current.Height) { /* Takes all part */ recttrg->Width = recttrg->X + recttrg->Width - (recttrg->X + recttrg->Width); recttrg->X = newrect.X + newrect.Width; recttrg->Y += newrect.Height; recttrg->Height -= newrect.Height; } else { if (newrect.X + newrect.Width >= recttrg->X + recttrg->Width) { recttrg->Y += newrect.Height; recttrg->Height -= newrect.Height; } } } /* If it's contained inside, get the > height */ if (recttrg->X >= current.X && recttrg->X + recttrg->Width <= current.X + current.Width) { recttrg->Height = MAX (recttrg->Y + recttrg->Height - (current.Y + current.Height), 0); recttrg->Y = newrect.Y + newrect.Height; } storecomplete = FALSE; break; } if (storecomplete) { gdip_add_rect_to_array_notcontained (&rects, &cnt, ¤t); } } GdipFree (allrects); if (region->rects) GdipFree (region->rects); region->rects = rects; region->cnt = cnt; } /* Intersect */ static void gdip_combine_intersect (GpRegion *region, GpRectF *rtrg, int cnttrg) { GpRectF *rectsrc; int src, trg; GpRectF rectcur; GpRegion regunion; GpRectF *recttrg; regunion.rects = NULL; regunion.cnt = 0; for (rectsrc = region->rects, src = 0; src < region->cnt; src++, rectsrc++) { for (recttrg = rtrg, trg = 0; trg < cnttrg; trg++, recttrg++) { /* normalize */ GpRectF normal; gdip_normalize_rectangle (recttrg, &normal); /* Intersects With */ if ((rectsrc->X >= normal.X + normal.Width) || (rectsrc->X + rectsrc->Width <= normal.X) || (rectsrc->Y >= normal.Y + normal.Height) || (rectsrc->Y + rectsrc->Height <= normal.Y)) { continue; } /* Area that intersects */ rectcur.X = rectsrc->X > normal.X ? rectsrc->X : normal.X; rectcur.Y = rectsrc->Y > normal.Y ? rectsrc->Y : normal.Y; rectcur.Width = rectsrc->X + rectsrc->Width < normal.X + normal.Width ? rectsrc->X + rectsrc->Width - rectcur.X : normal.X + normal.Width - rectcur.X; rectcur.Height = rectsrc->Y + rectsrc->Height < normal.Y + normal.Height ? rectsrc->Y + rectsrc->Height - rectcur.Y : normal.Y + normal.Height - rectcur.Y; /* Combine with previous areas that intersect with rect */ gdip_combine_union (®union, &rectcur, 1); } } if (region->rects) GdipFree (region->rects); region->rects = regunion.rects; region->cnt = regunion.cnt; } /* Xor */ static void gdip_combine_xor (GpRegion *region, GpRectF *recttrg, int cnttrg) { GpRegion *rgnsrc; /* All rectangles of both regions*/ GpRegion *rgntrg; /* Only the ones that intersect*/ GpRectF *allrects = NULL, *rect; int allcnt = 0, i; /* All the src and trg rects in a single array*/ for (i = 0, rect = region->rects; i < region->cnt; i++, rect++) gdip_add_rect_to_array (&allrects, &allcnt, rect); for (i = 0, rect = recttrg; i < cnttrg; i++, rect++) { /* normalize */ GpRectF normal; gdip_normalize_rectangle (rect, &normal); gdip_add_rect_to_array (&allrects, &allcnt, &normal); } rgnsrc = (GpRegion *) GdipAlloc (sizeof (GpRegion)); rgnsrc->type = RegionTypeRectF; rgnsrc->cnt = allcnt; rgnsrc->rects = allrects; GdipCloneRegion (region, &rgntrg); gdip_combine_intersect (rgntrg, recttrg, cnttrg); /* exclude the intersecting rectangles (if any) */ if (rgntrg->cnt > 0) gdip_combine_exclude (rgnsrc, rgntrg->rects, rgntrg->cnt); if (region->rects) GdipFree (region->rects); region->rects = rgnsrc->rects; region->cnt = rgnsrc->cnt; GdipFree (rgnsrc); GdipDeleteRegion (rgntrg); } GpStatus GdipCombineRegionRect (GpRegion *region, GDIPCONST GpRectF *rect, CombineMode combineMode) { if (!region || !rect) return InvalidParameter; /* allow the current region to "revert" to a simple RegionTypeRect if possible */ if (combineMode == CombineModeReplace) GdipSetEmpty (region); /* Union with infinity is a no-op (still an infinite region) */ if ((combineMode == CombineModeUnion) && gdip_is_InfiniteRegion (region)) return Ok; if (region->type == RegionTypePath) { GpPath *path = NULL; GpStatus status; /* Convert GpRectF to GpPath and use GdipCombineRegionPath */ status = GdipCreatePath (FillModeAlternate, &path); if (status != Ok) { if (path) GdipDeletePath (path); return status; } GdipAddPathRectangle (path, rect->X, rect->Y, rect->Width, rect->Height); status = GdipCombineRegionPath (region, path, combineMode); GdipDeletePath (path); return status; } /* region is rectangle-based */ switch (combineMode) { case CombineModeExclude: gdip_combine_exclude (region, (GpRectF *) rect, 1); break; case CombineModeComplement: gdip_combine_complement (region, (GpRectF *) rect, 1); break; case CombineModeIntersect: gdip_combine_intersect (region, (GpRectF *) rect, 1); break; case CombineModeUnion: gdip_combine_union (region, (GpRectF *) rect, 1); break; case CombineModeXor: gdip_combine_xor (region, (GpRectF *) rect, 1); break; case CombineModeReplace: /* Used by Graphics clipping */ gdip_add_rect_to_array (®ion->rects, ®ion->cnt, (GpRectF *)rect); break; default: return NotImplemented; } return Ok; } GpStatus GdipCombineRegionRectI (GpRegion *region, GDIPCONST GpRect *recti, CombineMode combineMode) { GpRectF rect; if (!region || !recti) return InvalidParameter; gdip_from_Rect_To_RectF ((GpRect *) recti, &rect); return GdipCombineRegionRect (region, (GDIPCONST GpRectF *) &rect, combineMode); } /* Exclude path from infinite region */ static BOOL gdip_combine_exclude_from_infinite (GpRegion *region, GpPath *path) { /* * We combine the path with the infinite region's, then reverse it. */ GpPath *region_path; GpStatus status; if (path->count == 0) return TRUE; if (region->type == RegionTypeRectF) gdip_region_convert_to_path (region); g_assert (region->tree->path); region_path = region->tree->path; status = GdipClonePath (path, ®ion->tree->path); if (status != Ok) { region->tree->path = region_path; return FALSE; } status = GdipAddPathPath (region->tree->path, region_path, FALSE); if (status != Ok) { GdipDeletePath (region->tree->path); region->tree->path = region_path; return FALSE; } status = GdipReversePath (region->tree->path); if (status != Ok) { GdipDeletePath (region->tree->path); region->tree->path = region_path; return FALSE; } return TRUE; } GpStatus GdipCombineRegionPath (GpRegion *region, GpPath *path, CombineMode combineMode) { GpRegionBitmap *path_bitmap, *result; if (!region || !path) return InvalidParameter; /* special case #1 - replace */ if (combineMode == CombineModeReplace) { gdip_clear_region (region); gdip_region_create_from_path (region, path); return Ok; } /* special case #2 - the region is empty */ if (gdip_is_region_empty (region)) { switch (combineMode) { case CombineModeComplement: case CombineModeUnion: case CombineModeXor: /* this is like "adding" the path */ gdip_clear_region (region); gdip_region_create_from_path (region, path); break; default: /* Intersect and Exclude are no-op on an empty region */ break; } return Ok; } /* special case #3 - the region is infinite */ if (gdip_is_InfiniteRegion (region)) { /* additional shortcuts are possible if path is empty */ BOOL empty = (path->count == 0); switch (combineMode) { case CombineModeUnion: /* Union with infinity is a no-op (still an infinite region) */ return Ok; case CombineModeComplement: /* Complement of infinity is empty - whatever the path is */ gdip_clear_region (region); region->type = RegionTypeRectF; return Ok; case CombineModeIntersect: /* Intersection with infinity is the path itself */ gdip_clear_region (region); if (empty) region->type = RegionTypeRectF; else gdip_region_create_from_path (region, path); return Ok; case CombineModeExclude: if (gdip_combine_exclude_from_infinite (region, path)) return Ok; break; default: /* Xor must be treated as a "normal" case unless the path is empty */ if (empty) return Ok; break; } } if (region->type == RegionTypeRectF) gdip_region_convert_to_path (region); /* make sure the region's bitmap is available */ gdip_region_bitmap_ensure (region); g_assert (region->bitmap); /* create a bitmap for the path to combine into the region */ path_bitmap = gdip_region_bitmap_from_path (path); result = gdip_region_bitmap_combine (region->bitmap, path_bitmap, combineMode); gdip_region_bitmap_free (path_bitmap); if (!result) return NotImplemented; gdip_region_bitmap_free (region->bitmap); region->bitmap = result; /* add a copy of path into region1 tree */ if (region->tree->path) { /* move the existing path into a new tree (branch1) ... */ region->tree->branch1 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); region->tree->branch1->path = region->tree->path; region->tree->branch2 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); } else { /* move the current base tree into branch1 of a new tree ... */ GpPathTree* tmp = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); tmp->branch1 = region->tree; tmp->branch2 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); region->tree = tmp; } /* ... and clone the specified path into branch2 */ region->tree->mode = combineMode; region->tree->path = NULL; GdipClonePath (path, ®ion->tree->branch2->path); return Ok; } static GpStatus gdip_combine_pathbased_region (GpRegion *region1, GpRegion *region2, CombineMode combineMode) { GpRegionBitmap *result; GpPathTree* tmp; /* if not available, construct the bitmaps for both regions */ gdip_region_bitmap_ensure (region1); gdip_region_bitmap_ensure (region2); if (!region1->bitmap || !region2->bitmap) return OutOfMemory; result = gdip_region_bitmap_combine (region1->bitmap, region2->bitmap, combineMode); if (!result) return NotImplemented; gdip_region_bitmap_free (region1->bitmap); region1->bitmap = result; /* re-structure region1 to allow adding a copy of region2 inside it */ if (region1->tree->path) { region1->tree->branch1 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); region1->tree->branch1->path = region1->tree->path; region1->tree->branch2 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); } else { /* move the current base tree into branch1 of a new tree ... */ GpPathTree* tmp = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); tmp->branch1 = region1->tree; tmp->branch2 = (GpPathTree*) GdipAlloc (sizeof (GpPathTree)); region1->tree = tmp; } region1->tree->mode = combineMode; region1->tree->path = NULL; /* add a copy of region2 tree into region1 tree */ if (region2->tree->path) { GdipClonePath (region2->tree->path, ®ion1->tree->branch2->path); } else { gdip_region_copy_tree (region2->tree, region1->tree->branch2); } return Ok; } GpStatus GdipCombineRegionRegion (GpRegion *region, GpRegion *region2, CombineMode combineMode) { if (!region || !region2) return InvalidParameter; /* special case to deal with copying empty and infinity regions */ /* CombineModeReplace is used by Graphics clipping */ if (combineMode == CombineModeReplace) { GdipSetEmpty (region); gdip_copy_region (region2, region); return Ok; } else if (gdip_is_region_empty (region)) { switch (combineMode) { case CombineModeIntersect: case CombineModeExclude: /* Intersect and Exclude are no-op on an empty region */ return Ok; default: /* for Complement, Union and Xor this is normal processing */ break; } } else if (gdip_is_InfiniteRegion (region)) { /* additional shortcuts are possible if path is empty */ BOOL empty = gdip_is_region_empty (region2); switch (combineMode) { case CombineModeUnion: /* Union with infinity is a no-op (still an infinite region) */ return Ok; case CombineModeComplement: /* Complement of infinity is empty - whatever the path is */ gdip_clear_region (region); region->type = RegionTypeRectF; return Ok; case CombineModeIntersect: /* Intersection with infinity is the path itself (like an Union with Empty) */ gdip_clear_region (region); region->type = RegionTypeRectF; if (empty) return Ok; combineMode = CombineModeUnion; break; case CombineModeExclude: if (empty) return Ok; if ((region2->type == RegionTypePath) && region2->tree && region2->tree->path && gdip_combine_exclude_from_infinite (region, region2->tree->path)) return Ok; break; default: /* Xor must be treated as a "normal" case unless the path is empty */ if (empty) return Ok; } } if (region->type == RegionTypePath) { gdip_region_convert_to_path (region2); return gdip_combine_pathbased_region (region, region2, combineMode); } else if (region2->type == RegionTypePath) { gdip_region_convert_to_path (region); return gdip_combine_pathbased_region (region, region2, combineMode); } /* at this stage we are sure that BOTH region and region2 are rectangle * based, so we can use the old rectangle-based code to combine regions */ switch (combineMode) { case CombineModeExclude: gdip_combine_exclude (region, region2->rects, region2->cnt); break; case CombineModeComplement: gdip_combine_complement (region, region2->rects, region2->cnt); break; case CombineModeIntersect: gdip_combine_intersect (region, region2->rects, region2->cnt); break; case CombineModeUnion: gdip_combine_union (region, region2->rects, region2->cnt); break; case CombineModeXor: gdip_combine_xor (region, region2->rects, region2->cnt); break; default: return NotImplemented; } return Ok; } GpStatus GdipGetRegionBounds (GpRegion *region, GpGraphics *graphics, GpRectF *rect) { if (!region || !graphics || !rect) return InvalidParameter; if (region->type == RegionTypePath) { GpRect bounds; gdip_region_bitmap_ensure (region); if (!region->bitmap) return OutOfMemory; /* base the bounds on the reduced bitmap of the paths */ gdip_region_bitmap_get_smallest_rect (region->bitmap, &bounds); /* small loss of precision when converting the bitmap coord to float */ rect->X = bounds.X; rect->Y = bounds.Y; rect->Width = bounds.Width; rect->Height = bounds.Height; } else { gdip_get_bounds (region->rects , region->cnt, rect); } return Ok; } GpStatus GdipIsEmptyRegion (GpRegion *region, GpGraphics *graphics, BOOL *result) { if (!region || !graphics || !result) return InvalidParameter; *result = gdip_is_region_empty (region); return Ok; } GpStatus GdipIsInfiniteRegion (GpRegion *region, GpGraphics *graphics, BOOL *result) { if (!region || !graphics || !result) return InvalidParameter; *result = gdip_is_InfiniteRegion (region); return Ok; } GpStatus GdipIsVisibleRegionPoint (GpRegion *region, float x, float y, GpGraphics *graphics, BOOL *result) { if (!region || !result) return InvalidParameter; if (region->type == RegionTypePath) { gdip_region_bitmap_ensure (region); g_assert (region->bitmap); *result = gdip_region_bitmap_is_point_visible (region->bitmap, x, y); } else { *result = gdip_is_Point_in_RectFs_Visible (x, y, region->rects, region->cnt); } return Ok; } GpStatus GdipIsVisibleRegionPointI (GpRegion *region, int x, int y, GpGraphics *graphics, BOOL *result) { return GdipIsVisibleRegionPoint (region, x, y, graphics, result); } GpStatus GdipIsVisibleRegionRect (GpRegion *region, float x, float y, float width, float height, GpGraphics *graphics, BOOL *result) { BOOL found = FALSE; if (!region || !result) return InvalidParameter; if (width ==0 || height ==0) { *result = FALSE; return Ok; } if (region->type == RegionTypePath) { GpRect rect; rect.X = x; rect.Y = y; rect.Width = width; rect.Height = height; gdip_region_bitmap_ensure (region); g_assert (region->bitmap); found = gdip_region_bitmap_is_rect_visible (region->bitmap, &rect); } else { float posy, posx; GpRectF recthit; recthit.X = x; recthit.Y = y; recthit.Width = width; recthit.Height = height; /* Any point of intersection ?*/ for (posy = 0; posy < recthit.Height && found == FALSE; posy++) { for (posx = 0; posx < recthit.Width ; posx++) { if (gdip_is_Point_in_RectFs_Visible (recthit.X + posx , recthit.Y + posy, region->rects, region->cnt) == TRUE) { found = TRUE; break; } } } } *result = found; return Ok; } GpStatus GdipIsVisibleRegionRectI (GpRegion *region, int x, int y, int width, int height, GpGraphics *graphics, BOOL *result) { return GdipIsVisibleRegionRect (region, x, y, width, height, graphics, result); } GpStatus GdipGetRegionScansCount (GpRegion *region, int* count, GpMatrix* matrix) { GpRegion *work = NULL; GpStatus status; if (!region || !count) return InvalidParameter; /* apply any user supplied matrix transformation */ if (!gdip_is_matrix_empty (matrix)) { int i; /* the matrix doesn't affect the original region - only the result */ status = GdipCloneRegion (region, &work); if (status != Ok) { if (work) GdipDeleteRegion (work); return status; } /* if required convert into a path-based region */ if (work->type != RegionTypePath) gdip_region_convert_to_path (work); /* transform all the paths */ status = gdip_region_transform_tree (work->tree, matrix); if (status != Ok) { GdipDeleteRegion (work); return status; } /* note: any existing bitmap has been invalidated */ gdip_region_bitmap_invalidate (work); } else { work = region; } if (work->type == RegionTypePath) { /* ensure the bitmap is usable */ gdip_region_bitmap_ensure (work); /* check if region is too large to render */ if (work->bitmap) *count = gdip_region_bitmap_get_scans (work->bitmap, NULL, -1); else *count = 0; } else { *count = work->cnt; } /* delete the clone */ if (work != region) GdipDeleteRegion (work); return Ok; } GpStatus GdipGetRegionScans (GpRegion *region, GpRectF* rects, int* count, GpMatrix* matrix) { GpRegion *work = NULL; GpStatus status; if (!region || !rects|| !count) return InvalidParameter; /* apply any user supplied matrix transformation */ if (!gdip_is_matrix_empty (matrix)) { int i; /* the matrix doesn't affect the original region - only the result */ status = GdipCloneRegion (region, &work); if (status != Ok) { if (work) GdipDeleteRegion (work); return status; } /* if required convert into a path-based region */ if (work->type != RegionTypePath) gdip_region_convert_to_path (work); /* transform all the paths */ status = gdip_region_transform_tree (work->tree, matrix); if (status != Ok) { GdipDeleteRegion (work); return status; } /* note: any existing bitmap has been invalidated */ gdip_region_bitmap_invalidate (work); } else { work = region; } if (region->type == RegionTypePath) { /* ensure the bitmap is usable */ gdip_region_bitmap_ensure (work); /* check if region is too large to render */ if (work->bitmap) *count = gdip_region_bitmap_get_scans (work->bitmap, rects, *count); else *count = 0; } else { memcpy (rects, work->rects, sizeof (GpRectF) * *count); *count = work->cnt; } /* delete the clone */ if (work != region) GdipDeleteRegion (work); return Ok; } GpStatus GdipIsEqualRegion (GpRegion *region, GpRegion *region2, GpGraphics *graphics, BOOL *result) { int i; GpRectF *rectsrc, *recttrg; if (!region || !region2 || !graphics || !result) return InvalidParameter; /* quick case: same pointer == same region == equals */ if (region == region2) { *result = TRUE; return Ok; } if ((region->type == RegionTypePath) || (region2->type == RegionTypePath)) { /* if required convert one region to a path based region */ if (region->type != RegionTypePath) gdip_region_convert_to_path (region); gdip_region_bitmap_ensure (region); g_assert (region->bitmap); if (region2->type != RegionTypePath) gdip_region_convert_to_path (region2); gdip_region_bitmap_ensure (region2); g_assert (region2->bitmap); *result = gdip_region_bitmap_compare (region->bitmap, region2->bitmap); return Ok; } /* rectangular-based region quality test */ if (region->cnt != region2->cnt) { *result = FALSE; return Ok; } for (i = 0, rectsrc = region->rects, recttrg = region2->rects; i < region->cnt; i++, rectsrc++, recttrg++) { if (rectsrc->X != recttrg->X || rectsrc->Y != recttrg->Y || rectsrc->Width != recttrg->Width || rectsrc->Height != recttrg->Height) { *result = FALSE; return Ok; } } *result = TRUE; return Ok; } GpStatus GdipTranslateRegion (GpRegion *region, float dx, float dy) { if (!region) return InvalidParameter; /* can't transforman infinite region to anything else than an infinite region * (even if you scale it by half it's still infinite ;-) see unit tests */ if (gdip_is_InfiniteRegion (region)) return Ok; if (region->type == RegionTypePath) { gdip_region_translate_tree (region->tree, dx, dy); /* any existing bitmap is still valid _if_ we update it's origin */ if (region->bitmap) { region->bitmap->X += dx; region->bitmap->Y += dy; } } else if ((region->type == RegionTypeRectF) && region->rects) { int i; GpRectF *rect; for (i = 0, rect = region->rects ; i < region->cnt; i++, rect++) { rect->X += dx; rect->Y += dy; } } return Ok; } GpStatus GdipTranslateRegionI (GpRegion *region, int dx, int dy) { return GdipTranslateRegion (region, dx, dy); } /* this call doesn't exists in GDI+ */ static GpStatus ScaleRegion (GpRegion *region, float sx, float sy) { if (!region) return InvalidParameter; if ((region->type == RegionTypeRectF) && region->rects) { int i; GpRectF *rect; for (i = 0, rect = region->rects ; i < region->cnt; i++, rect++) { rect->X *= sx; rect->Y *= sy; rect->Width *= sx; rect->Height *= sy; } } return Ok; } GpStatus GdipTransformRegion (GpRegion *region, GpMatrix *matrix) { GpStatus status = Ok; if (!region || !matrix) return InvalidParameter; /* no transformation to do on an empty region */ if ((region->cnt == 0) && (region->type == RegionTypeRectF)) return Ok; /* don't (possibly) convert to a bitmap if the matrix is empty (a no-op) */ if (gdip_is_matrix_empty (matrix)) return Ok; /* can't transforman infinite region to anything else than an infinite region * (even if you scale it by half it's still infinite ;-) see unit tests */ if (gdip_is_InfiniteRegion (region)) return Ok; /* try to avoid heavy stuff (e.g. conversion to path, invalidating * bitmap...) if the transform is: * - a translation + scale operations (for rectangle ebased region) * - only to do a scale operation (for a rectangle based region) * - only to do a simple translation (for both rectangular and bitmap based regions) */ if ((matrix->xy == 0.0f) && (matrix->yx == 0.0f)) { BOOL s = (((matrix->xx != 1.0f) || (matrix->yy != 1.0f)) && (region->type == RegionTypeRectF)); BOOL t = ((matrix->x0 != 0.0f) || (matrix->yx != 0.0f)); if (s) { status = ScaleRegion (region, gdip_matrix_get_x_scale (matrix), gdip_matrix_get_y_scale (matrix)); } if (t && (status == Ok)) { status = GdipTranslateRegion (region, gdip_matrix_get_x_translation (matrix), gdip_matrix_get_y_translation (matrix)); } /* return now if we could optimize the transform (to avoid bitmaps) */ if (t || s) return status; } /* most matrix operations would change the rectangles into path so we always preempt this */ if (region->type != RegionTypePath) gdip_region_convert_to_path (region); /* apply the same transformation matrix to all paths */ status = gdip_region_transform_tree (region->tree, matrix); /* invalidate the bitmap so it will get re-created on the next gdip_region_bitmap_ensure call */ gdip_region_bitmap_invalidate (region); return status; } // coverity[+alloc : arg-*1] GpStatus GdipCreateRegionPath (GpPath *path, GpRegion **region) { if (!region || !path) return InvalidParameter; return gdip_createRegion (region, RegionTypePath, (void*) path); } /* * The internal data representation for RegionData depends on the type of region. * * Type 0 (RegionTypeEmpty) * Note: There is no type 0. RegionTypeEmpty are converted into * RegionTypeRectF (type 2) when a region is created. * * Type 1 (RegionTypeRect) * Note: There is no type 1. RegionTypeRect are converted into * RegionTypeRectF (type 2) when a region is created. * * Type 2 (RegionTypeRectF), variable size * guint32 RegionType Always 2 * guint32 Count 0-2^32 * GpRectF[Count] Points * * Type 3 (RegionTypePath), variable size * guint32 RegionType Always 3 * GpPathTree tree * * where GpPathTree is * guint32 Tag 1 = Path, 2 = Tree * data[n] * * where data is for tag 1 (Path) * guint32 Count 0-2^32 * GpFillMode FillMode * guint8[Count] Types * GpPointF[Count] Points * or * where data is for tag 2 (Tree) * guint32 Operation see CombineMode * guint32 Size1 0-2^32 * byte[Size1] branch #1 * guint32 Size2 0-2^32 * byte[Size2] branch #2 */ GpStatus GdipGetRegionDataSize (GpRegion *region, UINT *bufferSize) { if (!region || !bufferSize) return InvalidParameter; switch (region->type) { case RegionTypeRectF: *bufferSize = (sizeof (guint32) * 2) + (region->cnt * sizeof (GpRectF)); break; case RegionTypePath: /* regiontype, tree */ *bufferSize = sizeof (guint32) + gdip_region_get_tree_size (region->tree); break; default: g_warning ("unknown type %d", region->type); return NotImplemented; } return Ok; } GpStatus GdipGetRegionData (GpRegion *region, BYTE *buffer, UINT bufferSize, UINT *sizeFilled) { GpStatus status; UINT size; int len; if (!region || !buffer || !sizeFilled) return InvalidParameter; status = GdipGetRegionDataSize (region, &size); if (status != Ok) return status; if (size > bufferSize) return InsufficientBuffer; /* type of region */ len = sizeof (guint32); memcpy (buffer, ®ion->type, len); buffer += len; *sizeFilled += len; switch (region->type) { case RegionTypeRectF: /* count (# rectangles) */ memcpy (buffer, ®ion->cnt, len); buffer += len; *sizeFilled += len; /* rectangles */ len = sizeof (GpRectF) * (region->cnt); memcpy (buffer, region->rects, len); *sizeFilled += len; break; case RegionTypePath: bufferSize -= len; if (!gdip_region_serialize_tree (region->tree, buffer, bufferSize, sizeFilled)) return InsufficientBuffer; break; default: g_warning ("unknown type %d", region->type); return NotImplemented; } return Ok; } GpStatus GdipGetRegionHRgn (GpRegion *region, GpGraphics *graphics, HRGN *hRgn) { if (!region || !graphics || !hRgn) return InvalidParameter; /* infinite region returns NULL */ if (gdip_is_InfiniteRegion (region)) { *hRgn = NULL; return Ok; } /* calling GdipGetRegionHRgn multiple times returns a different HRNG value (i.e. each to be freed separately) */ return GdipCloneRegion (region, (GpRegion**)hRgn); } // coverity[+alloc : arg-*1] GpStatus GdipCreateRegionHrgn (HRGN hRgn, GpRegion **region) { if (!hRgn || !region) return InvalidParameter; return GdipCloneRegion ((GpRegion*) hRgn, region); } libgdiplus-4.2/src/pngcodec.h0000664000175000017500000000163212377405421013171 00000000000000/* * pngcodec.h : Contains function declarations for encoding decoding png images * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef _PNGCODEC_H #define _PNGCODEC_H #include "bitmap-private.h" #include "bmpcodec.h" GpStatus gdip_load_png_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_png_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seeknFunc, GpImage **image) GDIP_INTERNAL; GpStatus gdip_save_png_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; GpStatus gdip_save_png_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; ImageCodecInfo *gdip_getcodecinfo_png () GDIP_INTERNAL; #endif /* _PNGCODEC_H */ libgdiplus-4.2/src/Makefile.am0000664000175000017500000000466412377405421013302 00000000000000lib_LTLIBRARIES = libgdiplus.la libgdiplus_la_SOURCES = \ adjustablearrowcap.c \ adjustablearrowcap.h \ adjustablearrowcap-private.h \ alpha-premul-table.inc \ bitmap.c \ bitmap.h \ bitmap-private.h \ brush.c \ brush.h \ brush-private.h \ carbon-private.c \ carbon-private.h \ codecs.h \ codecs-private.h \ customlinecap.c \ customlinecap.h \ customlinecap-private.h \ dstream.c \ dstream.h \ font.c \ font.h \ font-private.h \ fontcollection.h \ fontcollection-private.h \ fontfamily.h \ fontfamily-private.h \ gdi32.h \ gdi32.c \ GdiPlusFlat.h \ gdiplus-private.h \ gdip.h \ gdipenums.h \ gdipstructs.h \ general.c \ general.h \ general-private.h \ graphics.c \ graphics.h \ graphics-cairo.c \ graphics-cairo-private.h \ graphics-metafile.c \ graphics-metafile-private.h \ graphics-private.h \ graphics-path.c \ graphics-path.h \ graphics-path-private.h \ graphics-pathiterator.c \ graphics-pathiterator.h \ graphics-pathiterator-private.h \ hatchbrush.c \ hatchbrush.h \ hatchbrush-private.h \ icocodec.c \ icocodec.h \ image.c \ image.h \ image-private.h \ imageattributes.c \ imageattributes.h \ imageattributes-private.h \ lineargradientbrush.c \ lineargradientbrush.h \ lineargradientbrush-private.h \ matrix.c \ matrix.h \ matrix-private.h \ metafile.c \ metafile.h \ metafile-private.h \ pathgradientbrush.c \ pathgradientbrush.h \ pathgradientbrush-private.h \ pen.c \ pen.h \ pen-private.h \ print.c \ region.c \ region.h \ region-private.h \ region-bitmap.c \ region-bitmap.h \ region-path-tree.c \ region-path-tree.h \ solidbrush.c \ solidbrush.h \ solidbrush-private.h \ stringformat.c \ stringformat.h \ stringformat-private.h \ text.c \ text.h \ text-cairo.c \ text-cairo-private.h \ text-pango.c \ text-pango-private.h \ text-metafile.c \ text-metafile-private.h \ texturebrush.c \ texturebrush.h \ texturebrush-private.h \ win32structs.h \ bmpcodec.h \ bmpcodec.c \ emfcodec.c \ emfcodec.h \ emfplus.c \ emfplus.h \ gifcodec.h \ gifcodec.c \ jpegcodec.h \ jpegcodec.c \ pngcodec.h \ pngcodec.c \ tiffcodec.h \ tiffcodec.c \ wmfcodec.c \ wmfcodec.h libgdiplus_la_LIBADD = $(GDIPLUS_LIBS) INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format libgdiplus-4.2/src/wmfcodec.c0000664000175000017500000002672112377405421013177 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "wmfcodec.h" /* Codecinfo related data*/ GUID gdip_wmf_image_format_guid = {0xb96b3cadU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}}; static ImageCodecInfo wmf_codec; static const WCHAR wmf_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'W', 'M', 'F', 0}; /* Built-in WMF */ static const WCHAR wmf_extension[] = {'*','.','W', 'M', 'F', 0}; /* *.WMF */ static const WCHAR wmf_mimetype[] = {'i', 'm', 'a','g', 'e', '/', 'x', '-', 'w', 'm', 'f', 0}; /* image/x-wmf */ static const WCHAR wmf_format[] = {'W', 'M', 'F', 0}; /* WMF */ static const BYTE wmf_sig_pattern[] = { 0xD7, 0xCD, 0xC6, 0x9A }; static const BYTE wmf_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF }; //#define DEBUG_WMF_ALL #ifdef DEBUG_WMF_ALL #define DEBUG_WMF #define DEBUG_WMF_2 #define DEBUG_WMF_3 #define DEBUG_WMF_NOTIMPLEMENTED #endif ImageCodecInfo* gdip_getcodecinfo_wmf () { wmf_codec.Clsid = (CLSID) { 0x557cf404, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; wmf_codec.FormatID = gdip_wmf_image_format_guid; wmf_codec.CodecName = (const WCHAR*) wmf_codecname; wmf_codec.DllName = NULL; wmf_codec.FormatDescription = (const WCHAR*) wmf_format; wmf_codec.FilenameExtension = (const WCHAR*) wmf_extension; wmf_codec.MimeType = (const WCHAR*) wmf_mimetype; wmf_codec.Flags = ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin; wmf_codec.Version = 1; wmf_codec.SigCount = 1; wmf_codec.SigSize = 4; wmf_codec.SigPattern = wmf_sig_pattern; wmf_codec.SigMask = wmf_sig_mask; return &wmf_codec; } static WORD GetWORD (int position, BYTE *data) { WORD *value = (WORD*)(data + position); #if G_BYTE_ORDER != G_LITTLE_ENDIAN return GUINT16_FROM_LE (*value); #else return *value; #endif } static DWORD GetDWORD (int position, BYTE* data) { DWORD *value = (DWORD*)(data + position); #if G_BYTE_ORDER != G_LITTLE_ENDIAN return GUINT32_FROM_LE (*value); #else return *value; #endif } static DWORD GetColor (WORD w1, WORD w2) { DWORD color = (w2 << 16) | w1; BYTE *p = (BYTE*)&color; BYTE temp = p[0]; p[0] = p[2]; p[2] = temp; return color; } #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define GETW(x) (*(WORD*)(data + (x))) #else #define GETW(x) (GUINT16_FROM_LE(*(WORD*)(data + (x)))) #endif #define GetParam(x,y) GetWORD((6 + ((x) << 1)), (y)) /* http://wvware.sourceforge.net/caolan/Polygon.html */ static GpStatus Polygon (MetafilePlayContext *context, BYTE *data, int len) { GpPointF *points, *pt; GpStatus status; int p; /* variable number of parameters */ SHORT num = GETW(WP1); /* len (in WORDs) = num (WORD) + num * (x WORD + y WORD) */ if (num > len + 1) return InvalidParameter; #ifdef DEBUG_WMF printf ("Polygon %d points", num); #endif points = (GpPointF*) GdipAlloc (num * sizeof (GpPointF)); if (!points) return OutOfMemory; int n = 2; for (p = 0, pt = points; p < num; p++, pt++) { pt->X = GETW(WP(n)); n++; pt->Y = GETW(WP(n)); n++; #ifdef DEBUG_WMF printf ("\n\tpoly to %g,%g", pt->X, pt->Y); #endif } status = gdip_metafile_Polygon (context, points, num); GdipFree (points); return status; } /* http://wvware.sourceforge.net/caolan/Polyline.html */ static GpStatus Polyline (MetafilePlayContext *context, BYTE *data) { GpStatus status; int p; /* variable number of parameters */ SHORT num = GETW(WP1); #ifdef DEBUG_WMF printf ("Polyline %d points", num); #endif SHORT x1 = GETW(WP2); SHORT y1 = GETW(WP3); int n = 4; for (p = 1; p < num; p++) { SHORT x2 = GETW(WP(n)); n++; SHORT y2 = GETW(WP(n)); n++; #ifdef DEBUG_WMF_2 printf ("\n\tdraw from %d,%d to %d,%d", x1, y1, x2, y2); #endif GpPen *pen = gdip_metafile_GetSelectedPen (context); status = GdipDrawLine (context->graphics, pen, x1, y1, x2, y2); if (status != Ok) return status; x1 = x2; y1 = y2; } return Ok; } /* http://wvware.sourceforge.net/caolan/PolyPolygon.html */ /* storage isn't very efficient, # of polygons, size of each polygon, data for each polygon */ static GpStatus PolyPolygon (MetafilePlayContext *context, BYTE *data) { GpStatus status = Ok; /* variable number of parameters */ int poly_num = GETW(WP1); int i; PointFList *list = GdipAlloc (poly_num * sizeof (PointFList)); PointFList *current = list; #ifdef DEBUG_WMF printf ("PolyPolygon has %d polygons", poly_num); #endif int n = 2; /* read size of each polygon and allocate the required memory */ for (i = 0; i < poly_num; i++) { current->num = GETW(WP(n)); n++; current->points = (GpPointF*) GdipAlloc (current->num * sizeof (GpPointF)); #ifdef DEBUG_WMF_2 printf ("\n\tSub Polygon #%d has %d points", i, current->num); #endif current++; } /* read the points for each polygons */ current = list; for (i = 0; i < poly_num; i++) { GpPointF *pt = current->points; int p; for (p = 0; p < current->num; p++) { pt->X = GETW(WP(n)); n++; pt->Y = GETW(WP(n)); n++; #ifdef DEBUG_WMF_3 printf ("\n\t\tpoly to %g,%g", pt->X, pt->Y); #endif pt++; } GpStatus s = gdip_metafile_Polygon (context, current->points, current->num); if (s != Ok) status = s; /* free points */ GdipFree (current->points); current++; } /* all points were freed, after being drawn, so we just have to free the polygon list*/ GdipFree (list); return status; } GpStatus gdip_metafile_play_wmf (MetafilePlayContext *context) { GpStatus status = Ok; GpMetafile *metafile = context->metafile; GpGraphics *graphics = context->graphics; BYTE *data = metafile->data; BYTE *end = data + metafile->length; #ifdef DEBUG_WMF int i = 1, j; #endif /* reality check - each record is, at minimum, 6 bytes long (4 size + 2 function) */ while (data < end - WMF_MIN_RECORD_SIZE) { DWORD size = GETDW(RECORDSIZE); WORD func = GETW(FUNCTION); int params = size - (WMF_MIN_RECORD_SIZE / sizeof (WORD)); #ifdef DEBUG_WMF printf ("\n[#%d] size %d ", i++, size); #endif /* reality check - enough data available to read all parameters ? (params is in WORD) */ if ((params << 1) > (end - data)) { status = InvalidParameter; goto cleanup; } /* Notes: * - The previous check doesn't mean we have all required parameters (only the one encoded) * - sometimes there are extra (undocumented?, buggy?) parameters for some functions */ switch (func) { case METAFILE_RECORD_SAVEDC: WMF_CHECK_PARAMS(0); status = gdip_metafile_SaveDC (context); break; case METAFILE_RECORD_SETBKMODE: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetBkMode (context, GETW(WP1)); break; case METAFILE_RECORD_SETMAPMODE: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetMapMode (context, GETW(WP1)); break; case METAFILE_RECORD_SETROP2: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetROP2 (context, GETW(WP1)); break; case METAFILE_RECORD_SETRELABS: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetRelabs (context, GETW(WP1)); break; case METAFILE_RECORD_SETPOLYFILLMODE: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetPolyFillMode (context, GETW(WP1)); break; case METAFILE_RECORD_SETSTRETCHBLTMODE: WMF_CHECK_PARAMS(1); /* 2 but second is unused (32bits?) */ status = gdip_metafile_SetStretchBltMode (context, GETW(WP1)); break; case METAFILE_RECORD_RESTOREDC: WMF_CHECK_PARAMS(0); status = gdip_metafile_RestoreDC (context); break; case METAFILE_RECORD_SELECTOBJECT: WMF_CHECK_PARAMS(1); status = gdip_metafile_SelectObject (context, GETW(WP1)); break; case METAFILE_RECORD_SETTEXTALIGN: WMF_CHECK_PARAMS(1); status = gdip_metafile_SetTextAlign (context, GETW(WP1)); break; case METAFILE_RECORD_DELETEOBJECT: WMF_CHECK_PARAMS(1); status = gdip_metafile_DeleteObject (context, GETW(WP1)); break; case METAFILE_RECORD_SETBKCOLOR: WMF_CHECK_PARAMS(2); status = gdip_metafile_SetBkColor (context, GetColor (GETW(WP1), GETW(WP2))); break; case METAFILE_RECORD_SETWINDOWORG: WMF_CHECK_PARAMS(2); status = gdip_metafile_SetWindowOrg (context, GETW(WP1), GETW(WP2)); break; case METAFILE_RECORD_SETWINDOWEXT: WMF_CHECK_PARAMS(2); status = gdip_metafile_SetWindowExt (context, GETW(WP1), GETW(WP2)); break; case METAFILE_RECORD_LINETO: WMF_CHECK_PARAMS(2); status = gdip_metafile_LineTo (context, GETW(WP1), GETW(WP2)); break; case METAFILE_RECORD_MOVETO: WMF_CHECK_PARAMS(2); status = gdip_metafile_MoveTo (context, GETW(WP1), GETW(WP2)); break; case METAFILE_RECORD_CREATEPENINDIRECT: /* note: documented with only 4 parameters, LOGPEN use a POINT to specify width, so y (3) is unused) */ WMF_CHECK_PARAMS(5); status = gdip_metafile_CreatePenIndirect (context, GETW(WP1), GETW(WP2), GetColor (GETW(WP4), GETW(WP5))); break; case METAFILE_RECORD_CREATEBRUSHINDIRECT: WMF_CHECK_PARAMS(4); status = gdip_metafile_CreateBrushIndirect (context, GETW(WP1), GetColor (GETW(WP2), GETW(WP3)), GETW(WP4)); break; case METAFILE_RECORD_POLYGON: status = Polygon (context, data, params); break; case METAFILE_RECORD_POLYLINE: status = Polyline (context, data); break; case METAFILE_RECORD_POLYPOLYGON: status = PolyPolygon (context, data); break; case METAFILE_RECORD_ARC: WMF_CHECK_PARAMS(8); status = gdip_metafile_Arc (context, GETW(WP1), GETW(WP2), GETW(WP3), GETW(WP4), GETW(WP5), GETW(WP6), GETW(WP7), GETW(WP8)); break; case METAFILE_RECORD_STRETCHDIBITS: { WMF_CHECK_PARAMS(14); BITMAPINFO *bmi = (BITMAPINFO*) (data + 14 * sizeof (WORD)); void* bits = (void*) (bmi + GETDW(WP12)); status = gdip_metafile_StretchDIBits (context, GETW(WP11), GETW(WP10), GETW(WP9), GETW(WP8), GETW(WP7), GETW(WP6), GETW(WP5), GETW(WP4), bits, bmi, GETW(WP3), GETDW(WP1)); break; } default: /* unprocessed records, ignore the data */ /* 3 for size (DWORD) == 2 * SHORT + function == 1 SHORT */ #ifdef DEBUG_WMF printf ("Unimplemented_%X (", func); for (j = 0; j < params; j++) { printf (" %d", GetParam (j, data)); } printf (" )"); #endif break; } if (status != Ok) { g_warning ("Parsing interupted, status %d returned from function %d.", status, func); goto cleanup; } data += size * 2; } cleanup: return status; } GpStatus gdip_load_wmf_image_from_file (FILE *fp, GpImage **image) { return gdip_get_metafile_from ((void*)fp, (GpMetafile**)image, File); } GpStatus gdip_load_wmf_image_from_stream_delegate (dstream_t *loader, GpImage **image) { return gdip_get_metafile_from ((void *)loader, (GpMetafile**)image, DStream); } libgdiplus-4.2/src/brush.c0000664000175000017500000000536112377405421012530 00000000000000/* * brush.c * * Copyright (c) 2003 Alexandre Pigolkine * Copyright (C) 2007 Novell, Inc. http://www.novell.com * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine(pigolkine@gmx.de) * Ravindra (rkumar@novell.com) */ #include "brush-private.h" #include "graphics-private.h" void gdip_brush_init (GpBrush *brush, BrushClass* vtable) { brush->vtable = vtable; /* Set the changed state to true, so that we don't miss the * first setup of the brush. */ brush->changed = TRUE; } GpStatus gdip_brush_setup (GpGraphics *graphics, GpBrush *brush) { /* Don't need to setup, if brush is the same as the cached brush and * it is not changed. Just comparing pointers may not be sufficient * to say that the brushes are same. It is possible to have different * brush on the same memory, but probability is very low. We would * need a function to check the equality of the brushes in that case. */ if (brush == graphics->last_brush && !brush->changed) return Ok; else { GpStatus status = brush->vtable->setup (graphics, brush); if (status == Ok) { brush->changed = FALSE; graphics->last_brush = brush; } return status; } } /* coverity[+alloc : arg-*1] */ GpStatus GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush) { if (!brush || !clonedBrush) return InvalidParameter; return brush->vtable->clone_brush (brush, clonedBrush); } GpStatus GdipDeleteBrush (GpBrush *brush) { GpStatus status; if (!brush) return InvalidParameter; status = brush->vtable->destroy (brush); GdipFree (brush); return status; } GpStatus GdipGetBrushType (GpBrush *brush, GpBrushType *type) { if (!brush || !type) return InvalidParameter; *type = brush->vtable->type; return Ok; } libgdiplus-4.2/src/stringformat-private.h0000664000175000017500000000404312377405421015575 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __STRINGFORMAT_PRIVATE_H__ #define __STRINGFORMAT_PRIVATE_H__ #include "gdiplus-private.h" struct _StringFormat { StringAlignment alignment; StringAlignment lineAlignment; HotkeyPrefix hotkeyPrefix; StringFormatFlags formatFlags; StringTrimming trimming; StringDigitSubstitute substitute; CharacterRange *charRanges; float firstTabOffset; float *tabStops; int numtabStops; int charRangeCount; }; #include "stringformat.h" #endif libgdiplus-4.2/src/imageattributes-private.h0000664000175000017500000000435012377405421016250 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __IMAGEATTRIBUTES_PRIVATE_H__ #define __IMAGEATTRIBUTES_PRIVATE_H__ #include "gdiplus-private.h" typedef struct { ColorMap *colormap; int colormap_elem; float gamma_correction; ARGB key_colorlow; ARGB key_colorhigh; BOOL key_enabled; BOOL no_op; ColorMatrix *colormatrix; ColorMatrix *graymatrix; ColorMatrixFlags colormatrix_flags; BOOL colormatrix_enabled; } GpImageAttribute; typedef struct _ImageAttributes { GpImageAttribute def; GpImageAttribute bitmap; GpImageAttribute brush; GpImageAttribute pen; GpImageAttribute text; /* Globals */ WrapMode wrapmode; ARGB color; } ImageAttributes; #include "imageattributes.h" #endif libgdiplus-4.2/src/emfplus.h0000664000175000017500000000274312377405421013066 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __EMFPLUS_H__ #define __EMFPLUS_H__ #include "gdiplus-private.h" #include "metafile-private.h" #include "emfcodec.h" #include "graphics.h" #include "solidbrush-private.h" /* * Some interesting links... * [EMF+ Metafile Record Format Documentation] http://www.aces.uiuc.edu/~jhtodd/Metafile/ */ #endif libgdiplus-4.2/src/imageattributes.h0000664000175000017500000000656612377405421014613 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ #ifndef __IMAGEATTRIBUTES_H__ #define __IMAGEATTRIBUTES_H__ /* ImageAttributes public API (only!) */ GpStatus GdipCreateImageAttributes (GpImageAttributes **imageattr); GpStatus GdipCloneImageAttributes (GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr); GpStatus GdipDisposeImageAttributes (GpImageAttributes *imageattr); GpStatus GdipGetImageAttributesAdjustedPalette(GpImageAttributes *imageattr, ColorPalette *colorPalette, ColorAdjustType colorAdjustType); GpStatus GdipSetImageAttributesColorKeys (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh); GpStatus GdipSetImageAttributesColorMatrix (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix, GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags); GpStatus GdipSetImageAttributesGamma (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL gamma); GpStatus GdipSetImageAttributesNoOp (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag); GpStatus GdipSetImageAttributesOutputChannel (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags); GpStatus GdipSetImageAttributesOutputChannelColorProfile (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST WCHAR *colorProfileFilename); GpStatus GdipSetImageAttributesRemapTable (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, UINT mapSize, GDIPCONST ColorMap *map); GpStatus GdipSetImageAttributesThreshold (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL threshold); GpStatus GdipSetImageAttributesWrapMode (GpImageAttributes *imageattr, WrapMode wrap, ARGB argb, BOOL clamp); /* missing API GdipResetImageAttributes GdipSetImageAttributesICMMode GdipSetImageAttributesToIdentity */ #endif libgdiplus-4.2/src/font-private.h0000664000175000017500000000444612377405421014033 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __FONT_PRIVATE_H__ #define __FONT_PRIVATE_H__ #include "gdiplus-private.h" #ifdef USE_PANGO_RENDERING #include #include #endif struct _Font { float sizeInPixels; FontStyle style; unsigned char* face; GpFontFamily *family; float emSize; GpUnit unit; #ifdef USE_PANGO_RENDERING PangoFontDescription *pango; #else cairo_font_face_t *cairofnt; cairo_t *cairo; #endif }; void gdip_font_clear_pattern_cache (void) GDIP_INTERNAL; #ifdef USE_PANGO_RENDERING PangoFontDescription* gdip_get_pango_font_description (GpFont *font); #else cairo_font_face_t* gdip_get_cairo_font_face (GpFont *font); #endif #include "font.h" #endif libgdiplus-4.2/src/print.c0000664000175000017500000000431612377405421012540 00000000000000/* * print.c * * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jordi Mas (jordi@ximian.com) * Sebastien Pouliot */ #include #ifdef CAIRO_HAS_PS_SURFACE #include "graphics-private.h" #include /* * NOTE: The functions in this file aren't part of GDI+ and can only be called * from Mono's System.Drawing.dll on non-Windows operating systems */ /* coverity[+alloc : arg-*5] */ GpStatus GdipGetPostScriptGraphicsContext (char* filename, int width, int height, double dpix, double dpiy, GpGraphics **graphics) { GpGraphics *gfx; cairo_surface_t *surface; if (!graphics) return InvalidParameter; surface = cairo_ps_surface_create (filename, (double) width, (double) height); cairo_surface_set_fallback_resolution (surface, dpix, dpiy); gfx = gdip_graphics_new (surface); gfx->dpi_x = dpix; gfx->dpi_y = dpiy; cairo_surface_destroy (surface); gfx->type = gtPostScript; *graphics = gfx; return Ok; } GpStatus GdipGetPostScriptSavePage (GpGraphics* graphics) { if (!graphics) return InvalidParameter; cairo_show_page (graphics->ct); return Ok; } #endif libgdiplus-4.2/src/metafile.c0000664000175000017500000015070712377405421013200 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "metafile-private.h" #include "solidbrush-private.h" #include "graphics.h" #include "graphics-path-private.h" #include "pen.h" //#define DEBUG_METAFILE /* http://wvware.sourceforge.net/caolan/SaveDC.html */ GpStatus gdip_metafile_SaveDC (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("SaveDC"); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/SetBkMode.html */ GpStatus gdip_metafile_SetBkMode (MetafilePlayContext *context, DWORD bkMode) { #ifdef DEBUG_METAFILE printf ("SetBkMode %d", bkMode); #endif /* TODO - currently unused elsewhere */ context->bk_mode = bkMode; return Ok; } /* http://wvware.sourceforge.net/caolan/SetMapMode.html */ GpStatus gdip_metafile_SetMapMode (MetafilePlayContext *context, DWORD mode) { GpStatus status; float scale; #ifdef DEBUG_METAFILE printf ("SetMapMode %d", mode); #endif context->map_mode = mode; switch (mode) { case MM_HIENGLISH: /* 1 logical unit == 0.001 inch */ scale = gdip_get_display_dpi () * 0.001; break; case MM_LOENGLISH: /* 1 logical unit == 0.01 inch */ scale = gdip_get_display_dpi () * 0.01; break; case MM_HIMETRIC: /* 1 logical unit == 0.01 mm */ scale = gdip_get_display_dpi () / METAFILE_DIMENSION_FACTOR; break; case MM_LOMETRIC: /* 1 logical unit == 0.1 mm */ scale = 10 * gdip_get_display_dpi () / METAFILE_DIMENSION_FACTOR; break; case MM_TWIPS: /* 1 logical point == 1/1440 inch (1/20 of a "old" printer point ;-) */ scale = gdip_get_display_dpi () / 1440; break; case MM_TEXT: default: /* 1 logical unit == 1 pixel */ scale = 1.0f; context->map_mode = MM_TEXT; break; case MM_ISOTROPIC: case MM_ANISOTROPIC: /* SetWindowExt will calculate the correct ratio */ return Ok; } /* this isn't cumulative (and we get a lot of "junk" calls) */ GdipSetWorldTransform (context->graphics, &context->matrix); status = GdipScaleWorldTransform (context->graphics, scale, scale, MatrixOrderPrepend); #ifdef DEBUG_METAFILE_2 printf ("\n\tGdipScaleWorldTransform sx %g, sy %g (status %d)", scale, scale, status); #endif return status; } /* http://wvware.sourceforge.net/caolan/SetROP2.html */ GpStatus gdip_metafile_SetROP2 (MetafilePlayContext *context, DWORD rop) { #ifdef DEBUG_METAFILE printf ("SetROP2 %d", rop); #endif /* TODO */ return Ok; } /* http://www.ousob.com/ng/win2api/ng30859.php */ GpStatus gdip_metafile_SetRelabs (MetafilePlayContext *context, DWORD mode) { #ifdef DEBUG_METAFILE printf ("SetRelabs %d", mode); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/SetPolyFillMode.html */ GpStatus gdip_metafile_SetPolyFillMode (MetafilePlayContext *context, DWORD fillmode) { #ifdef DEBUG_METAFILE printf ("SetPolyFillMode %d", fillmode); #endif switch (fillmode) { case WINDING: context->fill_mode = FillModeWinding; break; default: g_warning ("Unknown fillmode %d, assuming ALTERNATE", fillmode); /* fall through */ case ALTERNATE: context->fill_mode = FillModeAlternate; break; } return Ok; } /* http://wvware.sourceforge.net/caolan/SetStretchBltMode.html */ GpStatus gdip_metafile_SetStretchBltMode (MetafilePlayContext *context, int iStretchMode) { #ifdef DEBUG_METAFILE printf ("SetStretchBltMode %d", iStretchMode); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/RestoreDC.html */ GpStatus gdip_metafile_RestoreDC (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("RestoreDC"); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/SelectObject.html */ GpStatus gdip_metafile_SelectObject (MetafilePlayContext *context, DWORD slot) { // EMF have some stock objects that do not requires creation if (slot & ENHMETA_STOCK_OBJECT) { #ifdef DEBUG_METAFILE printf ("SelectObject stock #%X", slot); #endif switch (slot - ENHMETA_STOCK_OBJECT) { case WHITE_BRUSH: case LTGRAY_BRUSH: case GRAY_BRUSH: case DKGRAY_BRUSH: case BLACK_BRUSH: case NULL_BRUSH: context->selected_brush = slot; break; case WHITE_PEN: case BLACK_PEN: case NULL_PEN: context->selected_pen = slot; break; case OEM_FIXED_FONT: case ANSI_FIXED_FONT: case ANSI_VAR_FONT: case SYSTEM_FONT: case DEVICE_DEFAULT_FONT: case SYSTEM_FIXED_FONT: context->selected_font = slot; break; case DEFAULT_PALETTE: context->selected_palette = slot; break; default: return InvalidParameter; } return Ok; } #ifdef DEBUG_METAFILE printf ("SelectObject %d (out of %d slots)", slot, context->objects_count); #endif if (slot >= context->objects_count) { g_warning ("SelectObject %d, invalid slot number.", slot); return InvalidParameter; } /* FIXME - what's first ? the created object or what's in the slot ? */ switch (context->created.type) { case METAOBJECT_TYPE_EMPTY: /* if nothing is "created" (and not yet selected into a slot) then we "reselect" the object */ switch (context->objects [slot].type) { case METAOBJECT_TYPE_EMPTY: g_warning ("SelectObject %d, no created object, slot empty.", slot); break; case METAOBJECT_TYPE_PEN: context->selected_pen = slot; break; case METAOBJECT_TYPE_BRUSH: context->selected_brush = slot; break; } return Ok; case METAOBJECT_TYPE_PEN: context->selected_pen = slot; break; case METAOBJECT_TYPE_BRUSH: context->selected_brush = slot; break; } context->objects [slot].type = context->created.type; context->objects [slot].ptr = context->created.ptr; context->created.type = METAOBJECT_TYPE_EMPTY; context->created.ptr = NULL; return Ok; } GpStatus gdip_metafile_ModifyWorldTransform (MetafilePlayContext *context, XFORM *lpXform, DWORD iMode) { GpMatrix matrix; GpMatrixOrder order; switch (iMode) { case MWT_IDENTITY: /* This is a reset and it ignores lpXform in this case */ /* we can't use GdipResetWorldTransform as we still want the original parameters */ return GdipSetWorldTransform (context->graphics, &context->matrix); case MWT_LEFTMULTIPLY: order = MatrixOrderPrepend; break; case MWT_RIGHTMULTIPLY: order = MatrixOrderPrepend; break; default: return InvalidParameter; } if (!lpXform) return InvalidParameter; matrix.xx = lpXform->eM11; matrix.yx = lpXform->eM12; matrix.xy = lpXform->eM21; matrix.yy = lpXform->eM22; matrix.x0 = lpXform->eDx; matrix.y0 = lpXform->eDy; return GdipMultiplyWorldTransform (context->graphics, &matrix, order); } /* http://wvware.sourceforge.net/caolan/SetTextAlign.html */ GpStatus gdip_metafile_SetTextAlign (MetafilePlayContext *context, DWORD textalign) { #ifdef DEBUG_METAFILE printf ("SetTextAlign %d", textalign); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/DeleteObject.html */ GpStatus gdip_metafile_DeleteObject (MetafilePlayContext *context, DWORD slot) { GpStatus status = Ok; GpMetafile *metafile = context->metafile; MetaObject *obj; if (slot >= context->objects_count) { g_warning ("DeleteObject failure"); return InvalidParameter; } obj = &context->objects [slot]; switch (obj->type) { case METAOBJECT_TYPE_PEN: status = GdipDeletePen ((GpPen*)obj->ptr); break; case METAOBJECT_TYPE_BRUSH: status = GdipDeleteBrush ((GpBrush*)obj->ptr); break; case METAOBJECT_TYPE_EMPTY: break; } #ifdef DEBUG_METAFILE printf ("DeleteObject %d (type %d, ptr %p, status %d)", slot, obj->type, obj->ptr, status); #endif obj->type = METAOBJECT_TYPE_EMPTY; obj->ptr = NULL; return status; } /* http://wvware.sourceforge.net/caolan/SetBkColor.html */ GpStatus gdip_metafile_SetBkColor (MetafilePlayContext *context, DWORD color) { #ifdef DEBUG_METAFILE printf ("SetBkColor %X", color); #endif /* TODO - currently unused elsewhere */ context->bk_color = color; return Ok; } /* http://wvware.sourceforge.net/caolan/SetWindowOrg.html */ GpStatus gdip_metafile_SetWindowOrg (MetafilePlayContext *context, int x, int y) { #ifdef DEBUG_METAFILE printf ("SetWindowOrg X: %d, Y: %d", x, y); #endif /* TODO */ return Ok; } /* http://wvware.sourceforge.net/caolan/SetWindowExt.html */ GpStatus gdip_metafile_SetWindowExt (MetafilePlayContext *context, int height, int width) { GpStatus status; float sx, sy; #ifdef DEBUG_METAFILE printf ("SetWindowExt height %d, width %d", height, width); #endif switch (context->map_mode) { case MM_ISOTROPIC: sx = (float)context->metafile->metafile_header.Width / width; sy = (float)context->metafile->metafile_header.Height / height; /* keeps ratio to 1:1 */ if (sx < sy) sy = sx; break; case MM_ANISOTROPIC: sx = (float)context->metafile->metafile_header.Width / width; sy = (float)context->metafile->metafile_header.Height / height; break; default: /* most cases are handled by SetMapMode */ return Ok; } /* this isn't cumulative (and we get a lot of "junk" calls) */ GdipSetWorldTransform (context->graphics, &context->matrix); status = GdipScaleWorldTransform (context->graphics, sx, sy, MatrixOrderPrepend); #ifdef DEBUG_METAFILE_2 printf ("\n\tGdipScaleWorldTransform sx %g, sy %g (status %d)", sx, sy, status); #endif return status; } /* http://wvware.sourceforge.net/caolan/LineTo.html */ GpStatus gdip_metafile_LineTo (MetafilePlayContext *context, int x, int y) { GpStatus status; #ifdef DEBUG_METAFILE printf ("LineTo %s%d, %d", context->use_path ? "Path " : " ", x, y); #endif if (context->use_path) { status = GdipAddPathLine (context->path, context->current_x, context->current_y, x, y); } else { GpPen *pen = gdip_metafile_GetSelectedPen (context); status = GdipDrawLine (context->graphics, pen, context->current_x, context->current_y, x, y); } context->current_x = x; context->current_y = y; return status; } /* http://wvware.sourceforge.net/caolan/MoveTo.html */ GpStatus gdip_metafile_MoveTo (MetafilePlayContext *context, int x, int y) { #ifdef DEBUG_METAFILE printf ("MoveTo X: %d, Y: %d", x, y); #endif /* seems to always be called before Arc but, according to documentation, Arc doesn't depend on the current cursor position */ context->current_x = x; context->current_y = y; return Ok; } GpStatus gdip_metafile_SetMiterLimit (MetafilePlayContext *context, float eNewLimit, float *peOldLimit) { if (peOldLimit) *peOldLimit = context->miter_limit; /* GDI+ keeps the miter limit with it's pen, not the context, definition */ context->miter_limit = eNewLimit; return Ok; } /* http://wvware.sourceforge.net/caolan/CreatePenIndirect.html */ GpStatus gdip_metafile_CreatePenIndirect (MetafilePlayContext *context, DWORD style, DWORD width, DWORD color) { GpStatus status; GpPen *pen = NULL; GpLineCap line_cap = LineCapRound; GpLineJoin line_join = LineJoinRound; int s = style & PS_STYLE_MASK; #ifdef DEBUG_METAFILE printf ("CreatePenIndirect style %d, width %d, color %X", style, width, color); #endif if (s == PS_NULL) color &= 0x00FFFFFF; else color |= 0xFF000000; if (width > 1) { /* style is always solid for width > 1 */ status = GdipCreatePen1 (color, width, UnitPixel, &pen); } else { /* 0 isn't a mistake, this ensure we have a "real" pixel-wide line drawn */ status = GdipCreatePen1 (color, 0, UnitPixel, &pen); switch (s) { default: g_warning ("Invalid pen style %d, style & PS_STYLE_MASK %d", style, s); /* fall through */ case PS_NULL: case DashStyleSolid: break; case DashStyleDash: case DashStyleDot: case DashStyleDashDot: case DashStyleDashDotDot: if (status == Ok) status = GdipSetPenDashStyle (pen, s); break; } } if (status != Ok) { if (pen) GdipDeletePen (pen); return status; } /* at this stage we got a pen, so we won't abort drawing on it's style */ s = (style & PS_ENDCAP_MASK); switch (s) { default: g_warning ("Invalid pen endcap, style %d, (style & PS_ENDCAP_MASK) %d", style, s); /* fall through */ case PS_ENDCAP_ROUND: line_cap = LineCapRound; break; case PS_ENDCAP_SQUARE: line_cap = LineCapSquare; break; case PS_ENDCAP_FLAT: line_cap = LineCapFlat; break; } GdipSetPenStartCap (pen, line_cap); GdipSetPenEndCap (pen, line_cap); s = (style & PS_JOIN_MASK); switch (s) { default: g_warning ("Invalid pen join, style %d, (style & PS_JOIN_MASK) %d", style, s); /* fall through */ case PS_JOIN_ROUND: line_join = LineJoinRound; break; case PS_JOIN_BEVEL: line_join = LineJoinBevel; break; case PS_JOIN_MITER: line_join = LineJoinMiter; break; } GdipSetPenLineJoin (pen, line_join); context->created.type = METAOBJECT_TYPE_PEN; context->created.ptr = pen; return Ok; } GpStatus gdip_metafile_ExtCreatePen (MetafilePlayContext *context, DWORD dwPenStyle, DWORD dwWidth, CONST LOGBRUSH *lplb, DWORD dwStyleCount, CONST DWORD *lpStyle) { /* TODO - there's more cases to consider */ return gdip_metafile_CreatePenIndirect (context, dwPenStyle, dwWidth, lplb->lbColor); } /* http://wvware.sourceforge.net/caolan/CreateBrushIndirect.html */ GpStatus gdip_metafile_CreateBrushIndirect (MetafilePlayContext *context, DWORD style, DWORD color, DWORD hatch) { GpStatus status = Ok; GpSolidFill *brush; switch (style) { case BS_SOLID: color |= 0xFF000000; status = GdipCreateSolidFill (color, &brush); break; case BS_NULL: color &= 0x00FFFFFF; status = GdipCreateSolidFill (color, &brush); break; default: g_warning ("gdip_metafile_CreateBrushIndirect unimplemented style %d", style); status = GdipCreateSolidFill (color, &brush); break; } #ifdef DEBUG_METAFILE printf ("CreateBrushIndirect style %d, color %X, hatch %d (%p, status %d)", style, color, hatch, brush, status); #endif context->created.type = METAOBJECT_TYPE_BRUSH; context->created.ptr = brush; return status; } /* http://wvware.sourceforge.net/caolan/Arc.html */ GpStatus gdip_metafile_Arc (MetafilePlayContext *context, int left, int top, int right, int bottom, int xstart, int ystart, int xend, int yend) { #ifdef DEBUG_METAFILE printf ("Arc left %d, top %d, right %d, bottom %d, xstart %d, ystart %d, xend %d, yend %d", left, top, right, bottom, xstart, ystart, xend, yend); #endif /* don't draw if the bounds are empty (width or height) */ if ((right - left <= 0) || (bottom = top <= 0)) return Ok; return GdipDrawArc (context->graphics, gdip_metafile_GetSelectedPen (context), left, top, (right - left), (bottom - top), atan2 (ystart, xstart), atan2 (yend, xend)); } /* http://wvware.sourceforge.net/caolan/ora-wmf.html */ GpStatus gdip_metafile_StretchDIBits (MetafilePlayContext *context, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, CONST void *lpBits, CONST BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop) { GpStatus status = OutOfMemory; GpImage *image = NULL; MemorySource ms; #ifdef DEBUG_METAFILE printf ("StretchDIBits\n\t[XDest %d, YDest %d, nDestWidth %d, nDestHeight %d]", XDest, YDest, nDestWidth, nDestHeight); printf ("\n\t[XSrc %d, YSrc %d, nSrcWidth %d, nSrcHeight %d]", XSrc, YSrc, nSrcWidth, nSrcHeight); printf ("\n\tlpBits %p, lpBitsInfo %p, iUsage %d, dwRop %d", lpBits, lpBitsInfo, iUsage, dwRop); printf ("\n\tBITMAPINFO\n\t\tSize: %d", lpBitsInfo->bmiHeader.biSize); printf ("\n\t\tWidth: %d", lpBitsInfo->bmiHeader.biWidth); printf ("\n\t\tHeight: %d", lpBitsInfo->bmiHeader.biHeight); printf ("\n\t\tPlanes: %d", lpBitsInfo->bmiHeader.biPlanes); printf ("\n\t\tBitCount: %d", lpBitsInfo->bmiHeader.biBitCount); printf ("\n\t\tCompression: %d", lpBitsInfo->bmiHeader.biCompression); printf ("\n\t\tSizeImage: %d", lpBitsInfo->bmiHeader.biSizeImage); printf ("\n\t\tXPelsPerMeter: %d", lpBitsInfo->bmiHeader.biXPelsPerMeter); printf ("\n\t\tYPelsPerMeter: %d", lpBitsInfo->bmiHeader.biXPelsPerMeter); printf ("\n\t\tClrUsed: %d", lpBitsInfo->bmiHeader.biClrUsed); printf ("\n\t\tClrImportant: %d", lpBitsInfo->bmiHeader.biClrImportant); #endif ms.ptr = (BYTE*)lpBitsInfo; ms.size = lpBitsInfo->bmiHeader.biSizeImage; ms.pos = 0; status = gdip_read_bmp_image (&ms, &image, Memory); if (status == Ok) { status = GdipDrawImageRectRect (context->graphics, image, context->x + XDest, context->y + YDest, context->width, context->height, XSrc, YSrc, nSrcWidth, nSrcHeight, UnitPixel, NULL, NULL, NULL); } if (image) GdipDisposeImage (image); return status; } /* * Return the selected GDI+ Pen to draw on the metafile or NULL if none is selected/valid. */ GpPen* gdip_metafile_GetSelectedPen (MetafilePlayContext *context) { GpPen *pen; // EMF have some stock objects that do not requires explicit creation if (context->selected_pen & ENHMETA_STOCK_OBJECT) { switch (context->selected_pen - ENHMETA_STOCK_OBJECT) { case WHITE_PEN: if (!context->stock_pen_white) { if (GdipCreatePen1 (0xFFFFFFFF, 0, UnitPixel, &context->stock_pen_white) != Ok) return NULL; } pen = context->stock_pen_white; break; case BLACK_PEN: if (!context->stock_pen_black) { if (GdipCreatePen1 (0xFF000000, 0, UnitPixel, &context->stock_pen_black) != Ok) return NULL; } pen = context->stock_pen_black; break; case NULL_PEN: if (!context->stock_pen_null) { if (GdipCreatePen1 (0x00000000, 0, UnitPixel, &context->stock_pen_null) != Ok) return NULL; } pen = context->stock_pen_null; break; default: return NULL; } } else { if ((context->selected_pen < 0) || (context->selected_pen >= context->objects_count)) { g_warning ("Invalid pen handle %d [0..%d[", context->selected_pen, context->objects_count); return NULL; } if (context->objects [context->selected_pen].type != METAOBJECT_TYPE_PEN) { g_warning ("Wrong object type %d, expected pen (%d)", context->objects [context->selected_pen].type, METAOBJECT_TYPE_PEN); return NULL; } #ifdef DEBUG_METAFILE printf ("\tusing pen #%d (%p)", context->selected_pen, context->objects [context->selected_pen].ptr); #endif pen = (GpPen*) context->objects [context->selected_pen].ptr; } /* miter limit was global (i.e. context not pen specific) in GDI */ GdipSetPenMiterLimit (pen, context->miter_limit); return pen; } /* * Return the selected GDI+ Brush to fill on the metafile or NULL if none is selected/valid. */ GpBrush* gdip_metafile_GetSelectedBrush (MetafilePlayContext *context) { // EMF have some stock objects that do not requires explicit creation if (context->selected_brush & ENHMETA_STOCK_OBJECT) { switch (context->selected_brush - ENHMETA_STOCK_OBJECT) { case WHITE_BRUSH: if (!context->stock_brush_white) { if (GdipCreateSolidFill (0xFFFFFFFF, &context->stock_brush_white) != Ok) return NULL; } return (GpBrush*)context->stock_brush_white; case LTGRAY_BRUSH: if (!context->stock_brush_ltgray) { if (GdipCreateSolidFill (0xFFBBBBBB, &context->stock_brush_ltgray) != Ok) return NULL; } return (GpBrush*)context->stock_brush_ltgray; case GRAY_BRUSH: if (!context->stock_brush_gray) { if (GdipCreateSolidFill (0xFF888888, &context->stock_brush_gray) != Ok) return NULL; } return (GpBrush*)context->stock_brush_gray; case DKGRAY_BRUSH: if (!context->stock_brush_dkgray) { if (GdipCreateSolidFill (0xFF444444, &context->stock_brush_dkgray) != Ok) return NULL; } return (GpBrush*)context->stock_brush_dkgray; case BLACK_BRUSH: if (!context->stock_brush_black) { if (GdipCreateSolidFill (0xFF000000, &context->stock_brush_black) != Ok) return NULL; } return (GpBrush*)context->stock_brush_black; case NULL_BRUSH: if (!context->stock_brush_null) { if (GdipCreateSolidFill (0x00000000, &context->stock_brush_null) != Ok) return NULL; } return (GpBrush*)context->stock_brush_null; default: return NULL; } } if ((context->selected_brush < 0) || (context->selected_brush >= context->objects_count)) { g_warning ("Invalid brush handle %d [0..%d[", context->selected_brush, context->objects_count); return NULL; } if (context->objects [context->selected_brush].type != METAOBJECT_TYPE_BRUSH) { g_warning ("Wrong object type %d, expected brush (%d)", context->objects [context->selected_brush].type, METAOBJECT_TYPE_BRUSH); return NULL; } #ifdef DEBUG_METAFILE printf ("\tusing brush #%d (%p)", context->selected_brush, context->objects [context->selected_brush].ptr); #endif return (GpBrush*) context->objects [context->selected_brush].ptr; } GpStatus gdip_metafile_PolyBezier (MetafilePlayContext *context, GpPointF *points, int count) { GpStatus status; #ifdef DEBUG_METAFILE printf ("PolyBezier %s count %d", context->use_path ? "Path " : " ", count); #endif if (context->use_path) { status = GdipAddPathBeziers (context->path, points, count); } else { GpPen *pen = gdip_metafile_GetSelectedPen (context); return GdipDrawCurve (context->graphics, pen, points, count); } return status; } GpStatus gdip_metafile_Polygon (MetafilePlayContext *context, GpPointF *points, int count) { #ifdef DEBUG_METAFILE printf ("Polygon %s count %d", context->use_path ? "Path " : " ", count); #endif GpBrush *brush = gdip_metafile_GetSelectedBrush (context); GpStatus status = GdipFillPolygon (context->graphics, brush, points, count, context->fill_mode); if (status == Ok) { GpPen *pen = gdip_metafile_GetSelectedPen (context); status = GdipDrawPolygon (context->graphics, pen, points, count); } return status; } GpStatus gdip_metafile_BeginPath (MetafilePlayContext *context) { GpStatus status; if (context->path) { GdipDeletePath (context->path); context->path = NULL; } context->use_path = TRUE; status = GdipCreatePath (0, &context->path); #ifdef DEBUG_METAFILE printf ("BeginPath %p", context->path); #endif return status; } GpStatus gdip_metafile_EndPath (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("EndPath %p", context->path); #endif context->use_path = FALSE; return Ok; } GpStatus gdip_metafile_CloseFigure (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("CloseFigure %p", context->path); #endif return GdipClosePathFigures (context->path); } GpStatus gdip_metafile_FillPath (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("FillPath %p", context->path); #endif GpBrush* brush = gdip_metafile_GetSelectedBrush (context); /* end path if required */ if (context->use_path) gdip_metafile_EndPath (context); return GdipFillPath (context->graphics, brush, context->path); } GpStatus gdip_metafile_StrokePath (MetafilePlayContext *context) { #ifdef DEBUG_METAFILE printf ("StrokePath %p", context->path); #endif GpPen *pen = gdip_metafile_GetSelectedPen (context); /* end path if required */ if (context->use_path) gdip_metafile_EndPath (context); return GdipDrawPath (context->graphics, pen, context->path); } GpStatus gdip_metafile_StrokeAndFillPath (MetafilePlayContext *context) { GpBrush *brush; GpStatus status; #ifdef DEBUG_METAFILE printf ("StrokeAndFillPath %p", context->path); #endif /* end path if required */ if (context->use_path) gdip_metafile_EndPath (context); brush = gdip_metafile_GetSelectedBrush (context); status = GdipFillPath (context->graphics, brush, context->path); if (status == Ok) { GpPen *pen = gdip_metafile_GetSelectedPen (context); status = GdipDrawPath (context->graphics, pen, context->path); } return status; } static GpMetafile* gdip_metafile_create () { GpMetafile* mf = (GpMetafile*) GdipAlloc (sizeof (GpMetafile)); if (mf) { mf->base.type = ImageTypeMetafile; mf->delete = FALSE; mf->data = NULL; mf->length = 0; mf->recording = FALSE; mf->fp = NULL; mf->stream = NULL; } return mf; } GpStatus gdip_metafile_clone (GpMetafile *metafile, GpMetafile **clonedmetafile) { GpMetafile *mf = gdip_metafile_create (); if (!mf) return OutOfMemory; memcpy (&mf->metafile_header, &metafile->metafile_header, sizeof (MetafileHeader)); if (metafile->length > 0) { mf->data = GdipAlloc (metafile->length); memcpy (mf->data, metafile->data, metafile->length); mf->length = metafile->length; } *clonedmetafile = mf; return Ok; } GpStatus gdip_metafile_dispose (GpMetafile *metafile) { if (!metafile) return InvalidParameter; /* TODO deal with "delete" flag */ metafile->length = 0; if (metafile->data) { GdipFree (metafile->data); metafile->data = NULL; } if (metafile->recording) gdip_metafile_stop_recording (metafile); GdipFree (metafile); return Ok; } GpStatus gdip_metafile_stop_recording (GpMetafile *metafile) { /* TODO save current stuff */ if (metafile->fp) { fclose (metafile->fp); metafile->fp = NULL; } if (metafile->stream) { /* it's not ours to close, just forget about it */ metafile->stream = NULL; } /* we cannot open a new graphics instance on this metafile - recording is over */ metafile->recording = FALSE; return Ok; } MetafilePlayContext* gdip_metafile_play_setup (GpMetafile *metafile, GpGraphics *graphics, int x, int y, int width, int height) { int i, n; MetaObject *obj; MetafilePlayContext *context; /* metafiles always render as 32bppRgb */ int stride = width * 4; int size = height * stride; if (!metafile || !graphics) return NULL; context = GdipAlloc (sizeof (MetafilePlayContext)); context->metafile = metafile; context->graphics = graphics; context->use_path = FALSE; context->path = NULL; /* keep a copy for clean up */ GdipGetWorldTransform (graphics, &context->initial); #ifdef DEBUG_METAFILE MetafileHeader *mh = &metafile->metafile_header; GpMatrix *m = &context->initial; g_warning ("\nMetafileHeader X %d, Y %d, W %d, H %d", mh->X, mh->Y, mh->Width, mh->Height); g_warning ("\n\tinitial matrix %g %g %g %g %g %g", m->xx, m->yx, m->xy, m->yy, m->x0, m->y0); #endif context->x = x; context->y = y; context->width = width; context->height = height; /* and keep an adjusted copy for providing "resets" */ GdipTranslateWorldTransform (graphics, -metafile->metafile_header.X, -metafile->metafile_header.Y, MatrixOrderPrepend); GdipGetWorldTransform (graphics, &context->matrix); /* defaults */ context->fill_mode = FillModeAlternate; context->map_mode = MM_TEXT; context->miter_limit = 10.0f; context->selected_pen = -1; context->selected_brush = -1; context->selected_font = -1; context->selected_palette = -1; /* Create* functions store the object here */ context->created.type = METAOBJECT_TYPE_EMPTY; context->created.ptr = NULL; /* stock objects */ context->stock_pen_white = NULL; context->stock_pen_black = NULL; context->stock_pen_null = NULL; context->stock_brush_white = NULL; context->stock_brush_ltgray = NULL; context->stock_brush_gray = NULL; context->stock_brush_dkgray = NULL; context->stock_brush_black = NULL; context->stock_brush_null = NULL; /* SelectObject | DeleteObject works on this array */ switch (context->metafile->metafile_header.Type) { case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: context->objects_count = metafile->metafile_header.WmfHeader.mtNoObjects; break; case METAFILETYPE_EMF: case METAFILETYPE_EMFPLUSONLY: case METAFILETYPE_EMFPLUSDUAL: context->objects_count = metafile->metafile_header.EmfHeader.nHandles + 1; /* 0 is reserved */ break; default: GdipFree (context); return NULL; } context->objects = (MetaObject*) GdipAlloc (context->objects_count * sizeof (MetaObject)); if (!context->objects) { GdipFree (context); return NULL; } obj = context->objects; for (i = 0; i < context->objects_count; i++) { obj->type = METAOBJECT_TYPE_EMPTY; obj->ptr = NULL; obj++; } return context; } GpStatus gdip_metafile_play (MetafilePlayContext *context) { GpStatus status; if (!context || !context->metafile) return InvalidParameter; switch (context->metafile->metafile_header.Type) { case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: return gdip_metafile_play_wmf (context); case METAFILETYPE_EMF: return gdip_metafile_play_emf (context); case METAFILETYPE_EMFPLUSONLY: case METAFILETYPE_EMFPLUSDUAL: return gdip_metafile_play_emf (context); default: g_warning ("Invalid metafile format %d", context->metafile->metafile_header.Type); break; } return NotImplemented; } GpStatus gdip_metafile_play_cleanup (MetafilePlayContext *context) { if (!context) return InvalidParameter; GdipSetWorldTransform (context->graphics, &context->initial); context->graphics = NULL; if (context->path) { GdipDeletePath (context->path); context->path = NULL; } context->created.type = METAOBJECT_TYPE_EMPTY; context->created.ptr = NULL; if (context->objects) { int i; GpMetafile *metafile = context->metafile; MetaObject *obj = context->objects; /* free each object */ for (i = 0; i < context->objects_count; i++) { gdip_metafile_DeleteObject (context, i); obj++; } GdipFree (context->objects); context->objects = NULL; } context->selected_pen = -1; context->selected_brush = -1; context->selected_font = -1; context->selected_font = -1; context->selected_palette = -1; /* stock objects */ if (context->stock_pen_white) GdipDeletePen (context->stock_pen_white); if (context->stock_pen_black) GdipDeletePen (context->stock_pen_black); if (context->stock_pen_null) GdipDeletePen (context->stock_pen_null); if (context->stock_brush_white) GdipDeleteBrush ((GpBrush*)context->stock_brush_white); if (context->stock_brush_ltgray) GdipDeleteBrush ((GpBrush*)context->stock_brush_ltgray); if (context->stock_brush_gray) GdipDeleteBrush ((GpBrush*)context->stock_brush_gray); if (context->stock_brush_dkgray) GdipDeleteBrush ((GpBrush*)context->stock_brush_dkgray); if (context->stock_brush_black) GdipDeleteBrush ((GpBrush*)context->stock_brush_black); if (context->stock_brush_null) GdipDeleteBrush ((GpBrush*)context->stock_brush_null); GdipFree (context); return Ok; } static void WmfPlaceableFileHeaderLE (WmfPlaceableFileHeader *wmfPlaceableFileHeader) { #if G_BYTE_ORDER != G_LITTLE_ENDIAN /* header->Key is already adjusted */ wmfPlaceableFileHeader->Hmf = GUINT16_FROM_LE (wmfPlaceableFileHeader->Hmf); wmfPlaceableFileHeader->BoundingBox.Left = GUINT16_FROM_LE (wmfPlaceableFileHeader->BoundingBox.Left); wmfPlaceableFileHeader->BoundingBox.Top = GUINT16_FROM_LE (wmfPlaceableFileHeader->BoundingBox.Top); wmfPlaceableFileHeader->BoundingBox.Right = GUINT16_FROM_LE (wmfPlaceableFileHeader->BoundingBox.Right); wmfPlaceableFileHeader->BoundingBox.Bottom = GUINT16_FROM_LE (wmfPlaceableFileHeader->BoundingBox.Bottom); wmfPlaceableFileHeader->Inch = GUINT16_FROM_LE (wmfPlaceableFileHeader->Inch); wmfPlaceableFileHeader->Reserved = GUINT32_FROM_LE (wmfPlaceableFileHeader->Reserved); wmfPlaceableFileHeader->Checksum = GUINT16_FROM_LE (wmfPlaceableFileHeader->Checksum); #endif } static void MetafileHeaderLE (MetafileHeader *header) { #if G_BYTE_ORDER != G_LITTLE_ENDIAN header->WmfHeader.mtType = GUINT16_FROM_LE (header->WmfHeader.mtType); header->WmfHeader.mtHeaderSize = GUINT16_FROM_LE (header->WmfHeader.mtHeaderSize); header->WmfHeader.mtVersion = GUINT16_FROM_LE (header->WmfHeader.mtVersion); header->WmfHeader.mtSize = GUINT32_FROM_LE (header->WmfHeader.mtSize); header->WmfHeader.mtNoObjects = GUINT16_FROM_LE (header->WmfHeader.mtNoObjects); header->WmfHeader.mtMaxRecord = GUINT32_FROM_LE (header->WmfHeader.mtMaxRecord); header->WmfHeader.mtNoParameters = GUINT16_FROM_LE (header->WmfHeader.mtNoParameters); #endif } static void EnhMetaHeaderLE (ENHMETAHEADER3 *emf) { #if G_BYTE_ORDER != G_LITTLE_ENDIAN /* emf->iType is already adjusted */ emf->nSize = GUINT32_FROM_LE (emf->nSize); emf->rclBounds.left = GUINT32_FROM_LE (emf->rclBounds.left); emf->rclBounds.top = GUINT32_FROM_LE (emf->rclBounds.top); emf->rclBounds.right = GUINT32_FROM_LE (emf->rclBounds.right); emf->rclBounds.bottom = GUINT32_FROM_LE (emf->rclBounds.bottom); emf->rclFrame.left = GUINT32_FROM_LE (emf->rclFrame.left); emf->rclFrame.top = GUINT32_FROM_LE (emf->rclFrame.top); emf->rclFrame.right = GUINT32_FROM_LE (emf->rclFrame.right); emf->rclFrame.bottom = GUINT32_FROM_LE (emf->rclFrame.bottom); emf->dSignature = GUINT32_FROM_LE (emf->dSignature); emf->nVersion = GUINT32_FROM_LE (emf->nVersion); emf->nBytes = GUINT32_FROM_LE (emf->nBytes); emf->nRecords = GUINT32_FROM_LE (emf->nRecords); emf->nHandles = GUINT32_FROM_LE (emf->nHandles); emf->sReserved = GUINT32_FROM_LE (emf->sReserved); emf->nDescription = GUINT32_FROM_LE (emf->nDescription); emf->offDescription = GUINT32_FROM_LE (emf->offDescription); emf->nPalEntries = GUINT32_FROM_LE (emf->nPalEntries); emf->szlDevice.cx = GUINT32_FROM_LE (emf->szlDevice.cx); emf->szlDevice.cy = GUINT32_FROM_LE (emf->szlDevice.cy); emf->szlMillimeters.cx = GUINT32_FROM_LE (emf->szlMillimeters.cx); emf->szlMillimeters.cy = GUINT32_FROM_LE (emf->szlMillimeters.cy); #endif } static GpStatus combine_headers (GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header) { if (wmfPlaceableFileHeader) { header->Type = METAFILETYPE_WMFPLACEABLE; header->X = wmfPlaceableFileHeader->BoundingBox.Left; header->Y = wmfPlaceableFileHeader->BoundingBox.Top; header->Width = wmfPlaceableFileHeader->BoundingBox.Right - wmfPlaceableFileHeader->BoundingBox.Left; header->Height= wmfPlaceableFileHeader->BoundingBox.Bottom - wmfPlaceableFileHeader->BoundingBox.Top; header->DpiX = wmfPlaceableFileHeader->Inch; header->DpiY = wmfPlaceableFileHeader->Inch; } else { header->Type = METAFILETYPE_WMF; header->X = 0; header->Y = 0; /* TODO: GDI+ uses screen resolution for non-placeable metafiles */ header->Width = 1280; header->Height= 1024; header->DpiX = gdip_get_display_dpi (); header->DpiY = header->DpiX; } header->Size = header->WmfHeader.mtSize * 2; header->Version = header->WmfHeader.mtVersion; header->EmfPlusFlags = 0; header->EmfPlusHeaderSize = 0; header->LogicalDpiX = 0; header->LogicalDpiY = 0; return Ok; } /* Handle the record based headers that can exists in EMF files */ /* Note: GDI+ doesn't report correctly all stuff within the headers :| */ static GpStatus update_emf_header (MetafileHeader *header, BYTE* data, int length) { GpStatus status = Ok; MetafilePlayContext context; GpMetafile mf; DWORD *func = (DWORD*)data; switch (*func) { case EMR_HEADER: g_warning ("TODO - EMR_HEADER. Not common, need test case :)"); break; case EMR_GDICOMMENT: /* this could be an embedded EmfPlusRecordTypeHeader */ context.metafile = &mf; context.graphics = NULL; /* special case where we're not playing the metafile */ status = GdiComment (&context, data, length); if (status == Ok) { header->Type = mf.metafile_header.Type; header->Version = mf.metafile_header.Version; /* GDI+ seems to report the object header */ /* Horizontal and Vertical Logical DPI are available but not reported */ } break; } return status; } static GpStatus gdip_get_metafileheader_from (void *pointer, MetafileHeader *header, ImageSource source) { int size; DWORD key; GpStatus status = NotImplemented; WmfPlaceableFileHeader aldus_header; ENHMETAHEADER3 *emf; /* peek at first DWORD to select the right format */ size = sizeof (DWORD); if (gdip_read_wmf_data (pointer, (void*)&key, size, source) != size) return GenericError; #if G_BYTE_ORDER != G_LITTLE_ENDIAN key = GUINT32_FROM_LE (key); #endif switch (key) { case ALDUS_PLACEABLE_METAFILE_KEY: aldus_header.Key = key; size = sizeof (WmfPlaceableFileHeader) - size; if (gdip_read_wmf_data (pointer, (void*)(&aldus_header) + sizeof (DWORD), size, source) != size) return InvalidParameter; #if FALSE g_warning ("ALDUS_PLACEABLE_METAFILE key %d, hmf %d, L %d, T %d, R %d, B %d, inch %d, reserved %d, checksum %d", aldus_header.Key, aldus_header.Hmf, aldus_header.BoundingBox.Left, aldus_header.BoundingBox.Top, aldus_header.BoundingBox.Right, aldus_header.BoundingBox.Bottom, aldus_header.Inch, aldus_header.Reserved, aldus_header.Checksum); #endif size = sizeof (METAHEADER); if (gdip_read_wmf_data (pointer, (void*)&header->WmfHeader, size, source) != size) return InvalidParameter; WmfPlaceableFileHeaderLE (&aldus_header); MetafileHeaderLE (header); status = combine_headers (&aldus_header, header); break; case WMF_TYPE_AND_HEADERSIZE_KEY: memcpy (&header->WmfHeader, &key, size); size = sizeof (METAHEADER) - size; if (gdip_read_wmf_data (pointer, (void*)(&header->WmfHeader) + sizeof (DWORD), size, source) != size) return InvalidParameter; MetafileHeaderLE (header); status = combine_headers (NULL, header); break; case EMF_EMR_HEADER_KEY: emf = &(header->EmfHeader); emf->iType = key; size = sizeof (ENHMETAHEADER3) - size; if (gdip_read_emf_data (pointer, (void*)(&header->EmfHeader) + sizeof (DWORD), size, source) != size) return InvalidParameter; EnhMetaHeaderLE (&header->EmfHeader); #if FALSE g_warning ("EMF HEADER iType %d, nSize %d, Bounds L %d, T %d, R %d, B %d, Frame L %d, T %d, R %d, B %d, signature %X, version %d, bytes %d, records %d, handles %d, reserved %d, description %d, %d, palentries %d, device %d, %d, millimeters %d, %d", emf->iType, emf->nSize, emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom, emf->rclFrame.left, emf->rclFrame.top, emf->rclFrame.right, emf->rclFrame.bottom, emf->dSignature, emf->nVersion, emf->nBytes, emf->nRecords, emf->nHandles, emf->sReserved, emf->nDescription, emf->offDescription, emf->nPalEntries, emf->szlDevice.cx, emf->szlDevice.cy, emf->szlMillimeters.cx, emf->szlMillimeters.cy); #endif /* sanity check */ if ((emf->iType != 1) || (emf->dSignature != 0x464D4520) || (emf->sReserved != 0)) return InvalidParameter; header->Type = METAFILETYPE_EMF; /* FIXME: inclusive-inclusive, MS gets 1 to 5 pixels larger than the header */ if ((emf->rclFrame.left == 0) && (emf->rclFrame.top == 0)) { header->X = 0; header->Y = 0; header->Width = emf->szlDevice.cx + 1; header->Height = emf->szlDevice.cy + 1; } else { header->X = emf->rclBounds.left; header->Y = emf->rclBounds.top; header->Width = emf->rclBounds.right - emf->rclBounds.left + 1; header->Height = emf->rclBounds.bottom - emf->rclBounds.top + 1; } header->DpiX = MM_PER_INCH / ((float)emf->szlMillimeters.cx / emf->szlDevice.cx); header->DpiY = MM_PER_INCH / ((float)emf->szlMillimeters.cy / emf->szlDevice.cy); header->Size = emf->nBytes; header->Version = emf->nVersion; /* We need to check for the EmfHeader record (can't be done at this stage) but some files still returns * invalid values. E.g. Files with "strange" bounds also have insanely large EmfPlusHeaderSize and logical * DPI values (with MS GDI+) */ header->EmfPlusFlags = 0; header->EmfPlusHeaderSize = 0; header->LogicalDpiX = 0; header->LogicalDpiY = 0; /* note: there can be (empty?) space between the header and the start of the metafile records */ size = emf->nSize - sizeof (ENHMETAHEADER3); if (size > 0) { while (size > sizeof (DWORD)) { if (gdip_read_emf_data (pointer, (void*)(&key), sizeof (DWORD), source) != sizeof (DWORD)) return InvalidParameter; size -= sizeof (DWORD); } if (size > 0) { if (gdip_read_emf_data (pointer, (void*)(&key), size, source) != size) return InvalidParameter; } } status = Ok; break; default: g_warning ("Unknown metafile format: key %d", key); status = GenericError; } #if FALSE g_warning ("METAHEADER type %d, header %d, version %d, size %d, #obj %d, max rec %d, #params %d", header->WmfHeader.mtType, header->WmfHeader.mtHeaderSize, header->WmfHeader.mtVersion, header->WmfHeader.mtSize, header->WmfHeader.mtNoObjects, header->WmfHeader.mtMaxRecord, header->WmfHeader.mtNoParameters); #endif return status; } GpStatus gdip_get_metafile_from (void *pointer, GpMetafile **metafile, ImageSource source) { BOOL adjust_emf_headers = FALSE; GpStatus status = OutOfMemory; GpMetafile *mf = gdip_metafile_create (); if (!mf) goto error; /* decode metafile header */ status = gdip_get_metafileheader_from (pointer, &mf->metafile_header, source); if (status != Ok) goto error; switch (mf->metafile_header.Type) { case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: mf->base.image_format = WMF; /* note: mtSize is in WORD, mtSize contains the METAHEADER, mf->length is in bytes */ mf->length = mf->metafile_header.WmfHeader.mtSize * 2 - sizeof (METAHEADER); break; case METAFILETYPE_EMF: case METAFILETYPE_EMFPLUSONLY: case METAFILETYPE_EMFPLUSDUAL: mf->base.image_format = EMF; mf->length = mf->metafile_header.EmfHeader.nBytes - mf->metafile_header.EmfHeader.nSize; adjust_emf_headers = TRUE; break; } mf->data = (BYTE*) GdipAlloc (mf->length); if (!mf->data) goto error; /* copy data in memory (to play it later) */ if (gdip_read_wmf_data (pointer, (void*)mf->data, mf->length, source) != mf->length) { status = InvalidParameter; goto error; } if (adjust_emf_headers) { /* if the first EMF record is an EmfHeader (or an Header inside a Comment) then we have extra data to extract */ status = update_emf_header (&mf->metafile_header, mf->data, mf->length); } *metafile = mf; return Ok; error: if (mf) gdip_metafile_dispose (mf); *metafile = NULL; return status; } /* public (GDI+) functions */ GpStatus GdipCreateMetafileFromFile (GDIPCONST WCHAR *file, GpMetafile **metafile) { FILE *fp; char *file_name; GpStatus status = GenericError; if (!file || !metafile) return InvalidParameter; file_name = (char *) ucs2_to_utf8 ((const gunichar2 *)file, -1); if (!file_name) return InvalidParameter; fp = fopen (file_name, "rb"); if (fp) { status = gdip_get_metafile_from (fp, metafile, File); fclose (fp); } GdipFree (file_name); return status; } /* * GdipCreateMetafileFromStream will never be implemented, as 'stream' is a COM IStream ... */ GpStatus GdipCreateMetafileFromStream (void *stream, GpMetafile **metafile) { return NotImplemented; } /* * instead we'll use delegates to load the metafile header with this function */ GpStatus GdipCreateMetafileFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpMetafile **metafile) { GpStatus status = InvalidParameter; dstream_t *loader; if (!metafile) return InvalidParameter; loader = dstream_input_new (getBytesFunc, seekFunc); if (loader) { status = gdip_get_metafile_from (loader, metafile, DStream); dstream_free (loader); } return status; } GpStatus GdipCreateMetafileFromEmf (HENHMETAFILE hEmf, BOOL deleteEmf, GpMetafile **metafile) { GpStatus status; if (!hEmf || !metafile) return InvalidParameter; status = gdip_metafile_clone ((GpMetafile*)hEmf, metafile); if (status != Ok) return status; (*metafile)->delete = deleteEmf; return Ok; } GpStatus GdipCreateMetafileFromWmf (HMETAFILE hWmf, BOOL deleteWmf, GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, GpMetafile **metafile) { GpStatus status; if (!hWmf || !metafile) return InvalidParameter; status = gdip_metafile_clone ((GpMetafile*)hWmf, metafile); if (status != Ok) return status; status = GdipGetMetafileHeaderFromWmf (hWmf, wmfPlaceableFileHeader, &(*metafile)->metafile_header); if (status != Ok) { GdipFree (*metafile); return status; } (*metafile)->delete = deleteWmf; return Ok; } GpStatus GdipGetMetafileHeaderFromWmf (HMETAFILE hWmf, GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header) { GpMetafile *mf; if (!hWmf || !wmfPlaceableFileHeader || !header) return InvalidParameter; mf = (GpMetafile*)hWmf; memcpy (header, &mf->metafile_header, sizeof (MetafileHeader)); return combine_headers (wmfPlaceableFileHeader, header); } GpStatus GdipGetMetafileHeaderFromEmf (HENHMETAFILE hEmf, MetafileHeader *header) { GpMetafile* metafile = (GpMetafile*)hEmf; if (!metafile || !header) return InvalidParameter; switch (metafile->metafile_header.Type) { case METAFILETYPE_EMF: case METAFILETYPE_EMFPLUSONLY: case METAFILETYPE_EMFPLUSDUAL: return GdipGetMetafileHeaderFromMetafile (metafile, header); /* you can get a HENHMETAFILE from a WMF metafile but it seems (unit tests) that you can't use it as such */ case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: default: return InvalidParameter; } } GpStatus GdipGetMetafileHeaderFromFile (GDIPCONST WCHAR *filename, MetafileHeader *header) { FILE *fp; char *file_name; GpStatus status = InvalidParameter; if (!filename || !header) return InvalidParameter; file_name = (char *) ucs2_to_utf8 ((const gunichar2 *)filename, -1); if (!file_name) return InvalidParameter; fp = fopen (file_name, "rb"); if (fp) { status = gdip_get_metafileheader_from (fp, header, File); /* if EMF check for additional header record */ if (header->Type == METAFILETYPE_EMF) { /* look for more details, possibly upgrading the metafile to METAFILETYPE_EMFPLUSONLY or EMFPLUSDUAL */ /* TODO */ } fclose (fp); } GdipFree (file_name); return status; } /* * GdipGetMetafileHeaderFromStream will never be implemented, as 'stream' is a COM IStream ... */ GpStatus GdipGetMetafileHeaderFromStream (void *stream, MetafileHeader *header) { return NotImplemented; } /* * instead we'll use delegates to load the metafile header with this function */ GpStatus GdipGetMetafileHeaderFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, MetafileHeader *header) { GpStatus status = InvalidParameter; dstream_t *loader; if (!header) return status; loader = dstream_input_new (getBytesFunc, seekFunc); if (loader) { status = gdip_get_metafileheader_from (loader, header, DStream); /* if EMF check for additional header record */ if (header->Type == METAFILETYPE_EMF) { /* look for more details, possibly upgrading the metafile to METAFILETYPE_EMFPLUSONLY or EMFPLUSDUAL */ /* TODO */ } dstream_free (loader); } return status; } GpStatus GdipGetMetafileHeaderFromMetafile (GpMetafile *metafile, MetafileHeader *header) { if (!metafile || !header) return InvalidParameter; memcpy (header, &metafile->metafile_header, sizeof (MetafileHeader)); return Ok; } GpStatus GdipGetHemfFromMetafile (GpMetafile *metafile, HENHMETAFILE *hEmf) { if (!metafile || !hEmf) return InvalidParameter; *hEmf = (HENHMETAFILE)metafile; return Ok; } GpStatus GdipGetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT *metafileRasterizationLimitDpi) { if (!metafile || !metafileRasterizationLimitDpi) return InvalidParameter; switch (metafile->metafile_header.Type) { case METAFILETYPE_EMF: case METAFILETYPE_EMFPLUSDUAL: /* TODO */ *metafileRasterizationLimitDpi = 0; return Ok; case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: case METAFILETYPE_EMFPLUSONLY: default: return WrongState; } } GpStatus GdipSetMetafileDownLevelRasterizationLimit (GpMetafile *metafile, UINT metafileRasterizationLimitDpi) { if (!metafile || (metafileRasterizationLimitDpi < 0)) return InvalidParameter; switch (metafile->metafile_header.Type) { case METAFILETYPE_EMF: case METAFILETYPE_EMFPLUSDUAL: // values less than 10 left resolution unchanged (from GDI+ documentation) if (metafileRasterizationLimitDpi >= 10) { /* TODO */ } return Ok; case METAFILETYPE_WMFPLACEABLE: case METAFILETYPE_WMF: case METAFILETYPE_EMFPLUSONLY: default: return WrongState; } } GpStatus GdipPlayMetafileRecord (GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE* data) { if (!metafile) return InvalidParameter; /* TODO */ return NotImplemented; } GpStatus GdipRecordMetafile (HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpMetafile *mf; if (!referenceHdc || !frameRect || !metafile) return InvalidParameter; if ((type < EmfTypeEmfOnly) || (type > EmfTypeEmfPlusDual)) return InvalidParameter; if ((frameUnit < MetafileFrameUnitPixel) || (frameUnit > MetafileFrameUnitGdi)) return InvalidParameter; if (((frameRect->Width == 0) || (frameRect->Height == 0)) && (frameUnit != MetafileFrameUnitGdi)) return GenericError; mf = gdip_metafile_create (); if (!mf) return OutOfMemory; mf->metafile_header.X = frameRect->X; mf->metafile_header.Y = frameRect->Y; mf->metafile_header.Width = frameRect->Width; mf->metafile_header.Height = frameRect->Height; mf->metafile_header.Size = 0; mf->metafile_header.Type = type; mf->recording = TRUE; /* TODO - more stuff here! */ *metafile = mf; return Ok; } GpStatus GdipRecordMetafileI (HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpRectF rect; if (!frameRect) return InvalidParameter; rect.X = frameRect->X; rect.Y = frameRect->Y; rect.Width = frameRect->Width; rect.Height = frameRect->Height; return GdipRecordMetafile (referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, description, metafile); } GpStatus GdipRecordMetafileFileName (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpStatus status; GpMetafile *mf = NULL; char *file_name; if (!fileName) return InvalidParameter; file_name = (char *) ucs2_to_utf8 ((const gunichar2 *)fileName, -1); if (!file_name) { *metafile = NULL; return InvalidParameter; } status = GdipRecordMetafile (referenceHdc, type, frameRect, frameUnit, description, &mf); if (status != Ok) { GdipFree (file_name); return status; } /* yep, an existing file is overwritten */ mf->fp = fopen (file_name, "wb"); GdipFree (file_name); *metafile = mf; return Ok; } GpStatus GdipRecordMetafileFileNameI (GDIPCONST WCHAR *fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpRectF rect; if (!frameRect) return InvalidParameter; rect.X = frameRect->X; rect.Y = frameRect->Y; rect.Width = frameRect->Width; rect.Height = frameRect->Height; return GdipRecordMetafileFileName (fileName, referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, description, metafile); } /* * GdipRecordMetafileStream and GdipRecordMetafileStreamI will never be implemented, as 'stream' is a COM IStream ... */ GpStatus GdipRecordMetafileStream (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { return NotImplemented; } GpStatus GdipRecordMetafileStreamI (void /* IStream */ *stream, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { return NotImplemented; } /* * instead we'll use delegates to create the metafile header with these functions */ GpStatus GdipRecordMetafileFromDelegate_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpStatus status; if (!putBytesFunc) return InvalidParameter; status = GdipRecordMetafile (referenceHdc, type, frameRect, frameUnit, description, metafile); if (status != Ok) return status; /* TODO - keep delegates around to write stuff */ return Ok; } GpStatus GdipRecordMetafileFromDelegateI_linux (GetHeaderDelegate getHeaderFunc, GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, HDC referenceHdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *description, GpMetafile **metafile) { GpRectF rect; if (!frameRect) return InvalidParameter; rect.X = frameRect->X; rect.Y = frameRect->Y; rect.Width = frameRect->Width; rect.Height = frameRect->Height; return GdipRecordMetafileFromDelegate_linux (getHeaderFunc, getBytesFunc, putBytesFunc, seekFunc, closeFunc, sizeFunc, referenceHdc, type, (GDIPCONST GpRectF*) &rect, frameUnit, description, metafile); } libgdiplus-4.2/src/graphics-pathiterator.h0000664000175000017500000000511612377405421015714 00000000000000/* * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Duncan Mak (duncan@ximian.com) * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * Copyright (C) 2003, 2006-2007 Novell, Inc (http://www.novell.com) */ #ifndef __GRAPHICS_PATHITERATOR_H__ #define __GRAPHICS_PATHITERATOR_H__ GpStatus GdipCreatePathIter (GpPathIterator **iterator, GpPath *path); GpStatus GdipDeletePathIter (GpPathIterator *iterator); GpStatus GdipPathIterGetCount (GpPathIterator *iterator, INT *count); GpStatus GdipPathIterGetSubpathCount (GpPathIterator *iterator, INT *count); GpStatus GdipPathIterCopyData (GpPathIterator *iterator, INT *resultCount, GpPointF *points, BYTE *types, INT startIndex, INT endIndex); GpStatus GdipPathIterHasCurve (GpPathIterator *iterator, BOOL *hasCurve); GpStatus GdipPathIterNextMarkerPath (GpPathIterator *iterator, INT *resultCount, GpPath *path); GpStatus GdipPathIterNextMarker (GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex); GpStatus GdipPathIterNextPathType (GpPathIterator *iterator, INT *resultCount, BYTE *pathType, INT *startIndex, INT *endIndex); GpStatus GdipPathIterNextSubpathPath (GpPathIterator *iterator, INT *resultCount, GpPath *path, BOOL *isClosed); GpStatus GdipPathIterNextSubpath (GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex, BOOL *isClosed); GpStatus GdipPathIterEnumerate (GpPathIterator *iterator, INT *resultCount, GpPointF *points, BYTE *types, INT count); GpStatus GdipPathIterRewind (GpPathIterator *iterator); /* missing API GdipPathIterIsValid */ #endif libgdiplus-4.2/src/jpegcodec.h0000664000175000017500000000207612377405421013335 00000000000000/* * jpegcodec.h : Contains function declarations for encoding decoding jpeg images * * Authors: * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) */ #ifndef _JPEGCODEC_H #define _JPEGCODEC_H #include "bitmap-private.h" #include "bmpcodec.h" GpStatus gdip_load_jpeg_image_from_file (FILE *fp, const char *filename, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_jpeg_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; GpStatus gdip_save_jpeg_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; GpStatus gdip_save_jpeg_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; ImageCodecInfo *gdip_getcodecinfo_jpeg () GDIP_INTERNAL; UINT gdip_get_encoder_parameter_list_size_jpeg () GDIP_INTERNAL; GpStatus gdip_fill_encoder_parameter_list_jpeg (EncoderParameters *eps, UINT size) GDIP_INTERNAL; #endif /* _JPEGCODEC_H */ libgdiplus-4.2/src/emfplus.c0000664000175000017500000001311612377405421013055 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #include "emfplus.h" //#define DEBUG_EMFPLUS_ALL #ifdef DEBUG_EMFPLUS_ALL #define DEBUG_EMFPLUS #define DEBUG_EMFPLUS_2 #define DEBUG_EMFPLUS_3 #define DEBUG_EMFPLUS_NOTIMPLEMENTED #endif /* http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/Header.html */ static GpStatus EmfPlusHeader (MetafilePlayContext *context, WORD flags, BYTE* data, int size) { #ifdef DEBUG_EMFPLUS /* if flags == 1, EmfPlusDual (GDI and GDI+), else EmfPlusOnly (GDI+) */ printf ("\nEmfPlusHeader flags %X", flags); printf ("\n\tData Size %d", GETDW(DWP1)); printf ("\n\tObject Header %X", GETDW(DWP2)); printf ("\n\tVersion %d", GETDW(DWP3)); printf ("\n\tHorizontal Resolution %d", GETDW(DWP4)); printf ("\n\tVertical Resolution %d", GETDW(DWP5)); #endif context->metafile->metafile_header.Type = (flags & 1) ? METAFILETYPE_EMFPLUSDUAL : METAFILETYPE_EMFPLUSONLY; /* ObjectHeader, not Version, is returned to be compatible with GDI+ */ context->metafile->metafile_header.Version = GETDW(DWP2); /* Horizontal and Vertical Resolution aren't reported correctly by GDI+ (generally 0) */ return Ok; } /* http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/EndOfFile.html */ static GpStatus EmfPlusEndOfFile (MetafilePlayContext *context, WORD flags, BYTE* data, int size) { #ifdef DEBUG_EMFPLUS printf ("EmfPlusRecordTypeEndOfFile flags %X", flags); #endif return Ok; } /* http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/FillRects.html */ static GpStatus EmfPlusFillRects (MetafilePlayContext *context, WORD flags, BYTE* data, int size) { GpStatus status = Ok; GpSolidFill *solid = NULL; GpBrush *brush = NULL; #ifdef DEBUG_EMFPLUS printf ("EmfPlusRecordTypeFillRects flags %X", flags, size); printf ("\n\tColor: 0x%X", GETDW(DWP2)); printf ("\n\t#rect: %d", GETDW(DWP3)); #endif BOOL use_int16 = (flags & 0x4000); BOOL use_color = (flags & 0x8000); DWORD num = GETDW(DWP3); int i = 0; int n = 3; if (use_color) { status = GdipCreateSolidFill (GETDW(DWP2), &solid); if (status != Ok) return status; brush = (GpBrush*)solid; } else { /* TODO - get brush from index */ } while ((i++ < num) && (status == Ok)) { float x, y, w, h; if (use_int16) { DWORD xy = GETDW(DWP(n)); n++; x = (xy >> 16); y = (WORD)xy; DWORD wh = GETDW(DWP(n)); n++; w = (wh >> 16); h = (WORD)wh; } else { x = (float) GETDW(DWP(n)); n++; y = (float) GETDW(DWP(n)); n++; w = (float) GETDW(DWP(n)); n++; h = (float) GETDW(DWP(n)); n++; } #ifdef DEBUG_EMFPLUS_2 printf ("\n\t\t%d - x %g, y %g, w %g, h %g", i, x, y, w, h); #endif status = GdipFillRectangle (context->graphics, brush, x, y, w, h); } if (solid) GdipDeleteBrush (brush); /* brush == a GpBrush* typecasted solid, if used */ return status; } GpStatus gdip_metafile_play_emfplus_block (MetafilePlayContext *context, BYTE* data, int length) { GpStatus status = Ok; BYTE *end = data + length; #ifdef DEBUG_EMFPLUS int i = 1, j; #endif /* special case to update the header informations (we're not really playing the metafile) */ if (!context->graphics) { DWORD record = GETDW(EMF_FUNCTION); WORD func = (WORD)record; if (func == EmfPlusRecordTypeHeader) { WORD flags = (record >> 16); DWORD size = GETDW(EMF_RECORDSIZE); return EmfPlusHeader (context, flags, data, size); } /* no header, continue */ return Ok; } /* reality check - each record is, at minimum, 8 bytes long (when size == 0) */ while (data < end - EMF_MIN_RECORD_SIZE) { DWORD record = GETDW(EMF_FUNCTION); WORD func = (WORD)record; WORD flags = (record >> 16); DWORD size = GETDW(EMF_RECORDSIZE); int params = (size - EMF_MIN_RECORD_SIZE) / sizeof (DWORD); #ifdef DEBUG_EMFPLUS printf ("\n\tEMF+[#%d] size %d ", i++, size); #endif switch (func) { case EmfPlusRecordTypeHeader: status = EmfPlusHeader (context, flags, data, size); break; case EmfPlusRecordTypeEndOfFile: return EmfPlusEndOfFile (context, flags, data, size); case EmfPlusRecordTypeFillRects: status = EmfPlusFillRects (context, flags, data, size); break; default: /* unprocessed records, ignore the data */ #ifdef DEBUG_EMFPLUS_NOTIMPLEMENTED printf ("Unimplemented_%d (", func); for (j = 0; j < params; j++) { printf (" %d", GETDW(DWP(j))); } printf (" )"); #endif break; } if (status != Ok) { g_warning ("EMF+ parsing interupted, status %d returned from function %d.", status, func); goto cleanup; } data += size; } cleanup: return status; } libgdiplus-4.2/src/graphics-path.h0000664000175000017500000001566312377405421014152 00000000000000/* * graphics-path.h * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Duncan Mak (duncan@ximian.com) * Ravindra (rkumar@novell.com) * Sebastien Pouliot * * Copyright (C) 2003, 2006-2007 Novell, Inc (http://www.novell.com) */ #ifndef __GRAPHICS_PATH_H__ #define __GRAPHICS_PATH_H__ GpStatus GdipCreatePath (GpFillMode brushMode, GpPath **path); GpStatus GdipCreatePath2 (GDIPCONST GpPointF *points, GDIPCONST BYTE *types, INT count, GpFillMode fillMode, GpPath **path); GpStatus GdipCreatePath2I (GDIPCONST GpPoint *points, GDIPCONST BYTE *types, INT count, GpFillMode fillMode, GpPath **path); GpStatus GdipClonePath (GpPath *path, GpPath **clonePath); GpStatus GdipDeletePath (GpPath *path); GpStatus GdipResetPath (GpPath *path); GpStatus GdipGetPointCount (GpPath *path, INT *count); GpStatus GdipGetPathTypes (GpPath *path, BYTE *types, INT count); GpStatus GdipGetPathPoints (GpPath *path, GpPointF *points, INT count); GpStatus GdipGetPathPointsI (GpPath *path, GpPoint *points, INT count); GpStatus GdipGetPathData (GpPath *path, GpPathData *pathData); GpStatus GdipGetPathFillMode (GpPath *path, GpFillMode *fillmode); GpStatus GdipSetPathFillMode (GpPath *path, GpFillMode fillmode); GpStatus GdipStartPathFigure (GpPath *path); GpStatus GdipClosePathFigure (GpPath *path); GpStatus GdipClosePathFigures (GpPath *path); GpStatus GdipSetPathMarker (GpPath *path); GpStatus GdipClearPathMarker (GpPath *path); GpStatus GdipReversePath (GpPath *path); GpStatus GdipGetPathLastPoint (GpPath *path, GpPointF *lastPoint); GpStatus GdipAddPathLine (GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2); GpStatus GdipAddPathLine2 (GpPath *path, GDIPCONST GpPointF *points, INT count); GpStatus GdipAddPathArc (GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); GpStatus GdipAddPathBezier (GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); GpStatus GdipAddPathBeziers (GpPath *path, GDIPCONST GpPointF *points, INT count); GpStatus GdipAddPathCurve (GpPath *path, GDIPCONST GpPointF *points, INT count); GpStatus GdipAddPathCurve2 (GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension); GpStatus GdipAddPathCurve3 (GpPath *path, GDIPCONST GpPointF *points, INT count, INT offset, INT numberOfSegments, REAL tension); GpStatus GdipAddPathClosedCurve (GpPath *path, GDIPCONST GpPointF *points, INT count); GpStatus GdipAddPathClosedCurve2 (GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension); GpStatus GdipAddPathRectangle (GpPath *path, REAL x, REAL y, REAL width, REAL height); GpStatus GdipAddPathRectangles (GpPath *path, GDIPCONST GpRectF *rects, INT count); GpStatus GdipAddPathEllipse (GpPath *path, REAL x, REAL y, REAL width, REAL height); GpStatus GdipAddPathPie (GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); GpStatus GdipAddPathPolygon (GpPath *path, GDIPCONST GpPointF *points, INT count); GpStatus GdipAddPathPath (GpPath *path, GDIPCONST GpPath *addingPath, BOOL connect); GpStatus GdipAddPathString (GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST GpRectF *layoutRect, GDIPCONST GpStringFormat *format); GpStatus GdipAddPathLineI (GpPath *path, INT x1, INT y1, INT x2, INT y2); GpStatus GdipAddPathLine2I (GpPath *path, GDIPCONST GpPoint *points, INT count); GpStatus GdipAddPathArcI (GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); GpStatus GdipAddPathBezierI (GpPath *path, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); GpStatus GdipAddPathBeziersI (GpPath *path, GDIPCONST GpPoint *points, INT count); GpStatus GdipAddPathCurveI (GpPath *path, GDIPCONST GpPoint *points, INT count); GpStatus GdipAddPathCurve2I (GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension); GpStatus GdipAddPathCurve3I (GpPath *path, GDIPCONST GpPoint *points, INT count, INT offset, INT numberOfSegments, REAL tension); GpStatus GdipAddPathClosedCurveI (GpPath *path, GDIPCONST GpPoint *points, INT count); GpStatus GdipAddPathClosedCurve2I (GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension); GpStatus GdipAddPathRectangleI (GpPath *path, INT x, INT y, INT width, INT height); GpStatus GdipAddPathRectanglesI (GpPath *path, GDIPCONST GpRect *rects, INT count); GpStatus GdipAddPathEllipseI (GpPath *path, INT x, INT y, INT width, INT height); GpStatus GdipAddPathPieI (GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); GpStatus GdipAddPathPolygonI (GpPath *path, GDIPCONST GpPoint *points, INT count); GpStatus GdipAddPathStringI (GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST GpRect *layoutRect, GDIPCONST GpStringFormat *format); GpStatus GdipFlattenPath (GpPath *path, GpMatrix *matrix, REAL flatness); GpStatus GdipWindingModeOutline (GpPath *path, GpMatrix *matrix, REAL flatness); GpStatus GdipWidenPath (GpPath *nativePath, GpPen *pen, GpMatrix *matrix, REAL flatness); GpStatus GdipWarpPath (GpPath *nativePath, GpMatrix *matrix, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, WarpMode warpMode, REAL flatness); GpStatus GdipTransformPath (GpPath* path, GpMatrix *matrix); GpStatus GdipGetPathWorldBounds (GpPath *path, GpRectF *bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen); GpStatus GdipGetPathWorldBoundsI (GpPath *path, GpRect *bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen); GpStatus GdipIsVisiblePathPoint (GpPath *path, REAL x, REAL y, GpGraphics *graphics, BOOL *result); GpStatus GdipIsVisiblePathPointI (GpPath *path, INT x, INT y, GpGraphics *graphics, BOOL *result); GpStatus GdipIsOutlineVisiblePathPoint (GpPath *path, REAL x, REAL y, GpPen *pen, GpGraphics *graphics, BOOL *result); GpStatus GdipIsOutlineVisiblePathPointI (GpPath *path, INT x, INT y, GpPen *pen, GpGraphics *graphics, BOOL *result); #endif libgdiplus-4.2/src/imageattributes.c0000664000175000017500000003245612377405421014603 00000000000000/* * Copyright (c) 2004-2005 Ximian * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Jordi Mas i Hernandez , 2004-2005 * Sebastien Pouliot * */ #include "imageattributes-private.h" #include "bitmap-private.h" static void gdip_init_image_attribute (GpImageAttribute* attr) { attr->colormap = NULL; attr->colormap_elem = 0; attr->gamma_correction = 0.0f; attr->key_colorlow = 0; attr->key_colorhigh = 0; attr->key_enabled = FALSE; attr->colormatrix = NULL; attr->graymatrix = NULL; attr->colormatrix_flags = ColorMatrixFlagsDefault; attr->colormatrix_enabled = FALSE; } static void gdip_dispose_image_attribute (GpImageAttribute* attr) { if (attr->colormap) { GdipFree (attr->colormap); attr->colormap = NULL; } if (attr->colormatrix) { GdipFree (attr->colormatrix); attr->colormatrix = NULL; } if (attr->graymatrix) { GdipFree (attr->graymatrix); attr->graymatrix = NULL; } } static GpImageAttribute* gdip_get_image_attribute (GpImageAttributes* attr, ColorAdjustType type) { switch (type) { case ColorAdjustTypeDefault: return &attr->def; case ColorAdjustTypeBitmap: return &attr->bitmap; case ColorAdjustTypeBrush: return &attr->brush; case ColorAdjustTypePen: return &attr->pen; case ColorAdjustTypeText: return &attr->text; default: return NULL; } } void gdip_process_bitmap_attributes (GpBitmap *bitmap, void **dest, GpImageAttributes* attr, BOOL *allocated) { GpImageAttribute *imgattr, *def; GpImageAttribute *colormap, *gamma, *trans, *cmatrix; GpBitmap *bmpdest; int x,y, cnt; ARGB color; BYTE *color_p = (BYTE*) &color; *allocated = FALSE; bmpdest = NULL; if (!bitmap || !dest || !attr) return; imgattr = gdip_get_image_attribute (attr, ColorAdjustTypeBitmap); if (!imgattr) return; def = gdip_get_image_attribute (attr, ColorAdjustTypeDefault); if (imgattr->colormap_elem) { colormap = imgattr; } else { colormap = def; } if (imgattr->gamma_correction) { gamma = imgattr; } else { gamma = def; } if (imgattr->key_enabled) { trans = imgattr; } else { trans = def; } if (imgattr->colormatrix_enabled && imgattr->colormatrix) { cmatrix = imgattr; } else { cmatrix = def; } if (colormap->colormap_elem || gamma->gamma_correction || trans->key_enabled || (cmatrix->colormatrix_enabled && cmatrix->colormatrix != NULL)) { bitmap->active_bitmap->pixel_format = PixelFormat32bppARGB; bmpdest = gdip_bitmap_new_with_frame(NULL, FALSE); gdip_bitmapdata_clone(bitmap->active_bitmap, &bmpdest->frames[0].bitmap, 1); bmpdest->frames[0].count = 1; gdip_bitmap_setactive(bmpdest, NULL, 0); *dest = bmpdest->active_bitmap->scan0; *allocated = TRUE; } /* We use get/set pixel instead of direct buffer manipulation because it's a good way of keeping the pixel logic in a single place */ /* Color mapping */ if (colormap->colormap_elem) { for (y = 0; y active_bitmap->height; y++) { for (x = 0; x active_bitmap->width; x++) { ColorMap* clrmap = colormap->colormap; int found; GdipBitmapGetPixel (bmpdest, x, y, &color); for (cnt = 0; cnt < colormap->colormap_elem; cnt++, clrmap++) { if (color == clrmap->oldColor.Argb) { color = clrmap->newColor.Argb; GdipBitmapSetPixel (bmpdest, x, y, color); break; } } } } } /* Gamma correction */ if (gamma->gamma_correction) { for (y = 0; y < bitmap->active_bitmap->height; y++) { for (x = 0; x < bitmap->active_bitmap->width; x++) { BYTE r,g,b,a; GdipBitmapGetPixel (bmpdest, x, y, &color); a = (color & 0xff000000) >> 24; r = (color & 0x00ff0000) >> 16; g = (color & 0x0000ff00) >> 8; b = (color & 0x000000ff); /* FIXME: This is not the right gamma GDI + correction algorithm */ /* r = (int) powf (r, (1 / gamma->gamma_correction)); g = (int) powf (g, (1 / gamma->gamma_correction)); b = (int) powf (b, (1 / gamma->gamma_correction)); a = (int) powf (a, (1 / gamma->gamma_correction));*/ color = b | (g << 8) | (r << 16) | (a << 24); GdipBitmapSetPixel (bmpdest, x, y, color); } } } /* Apply transparency range */ if (trans->key_enabled) { for (y = 0; y < bitmap->active_bitmap->height; y++) { for (x = 0; x < bitmap->active_bitmap->width; x++) { GdipBitmapGetPixel (bmpdest, x, y, &color); if (color >= trans->key_colorlow && color <= trans->key_colorhigh) { color = color & 0x00ffffff; /* Alpha = 0 */ GdipBitmapSetPixel (bmpdest, x, y, color); } } } } /* Apply Color Matrix */ if (cmatrix->colormatrix_enabled && cmatrix->colormatrix) { BitmapData *data = bmpdest->active_bitmap; BYTE *v = ((BYTE*)data->scan0); ARGB *scan; ColorMatrixFlags flags = cmatrix->colormatrix_flags; ColorMatrix *cm; for (y = 0; y < data->height; y++) { scan = (ARGB*) v; for (x = 0; x < data->width; x++) { BYTE r,g,b,a; int r_new,g_new,b_new,a_new; get_pixel_bgra (*scan, b, g, r, a); /* by default the matrix applies to all colors, including grays */ if ((flags != ColorMatrixFlagsDefault) && (b == g) && (b == r)) { if (flags == ColorMatrixFlagsSkipGrays) { /* does not apply */ scan++; continue; } /* ColorMatrixFlagsAltGray */ cm = cmatrix->graymatrix; } else { cm = cmatrix->colormatrix; } a_new = (r * cm->m[0][3] + g * cm->m[1][3] + b * cm->m[2][3] + a * cm->m[3][3] + (255 * cm->m[4][3])); if (a_new == 0) { /* 100% transparency, don't waste time computing other values (pre-mul will always be 0) */ *scan++ = 0; } else { r_new = (r * cm->m[0][0] + g * cm->m[1][0] + b * cm->m[2][0] + a * cm->m[3][0] + (255 * cm->m[4][0])); g_new = (r * cm->m[0][1] + g * cm->m[1][1] + b * cm->m[2][1] + a * cm->m[3][1] + (255 * cm->m[4][1])); b_new = (r * cm->m[0][2] + g * cm->m[1][2] + b * cm->m[2][2] + a * cm->m[3][2] + (255 * cm->m[4][2])); r = (r_new > 0xff) ? 0xff : (BYTE) r_new; g = (g_new > 0xff) ? 0xff : (BYTE) g_new; b = (b_new > 0xff) ? 0xff : (BYTE) b_new; /* remember that Cairo use pre-multiplied alpha, e.g. 50% red == 0x80800000 not 0x80ff0000 */ a = (BYTE) a_new; if (a < 0xff) { r = pre_multiplied_table [r][a]; g = pre_multiplied_table [g][a]; b = pre_multiplied_table [b][a]; } set_pixel_bgra (color_p, 0, b, g, r, a); *scan++ = color; } } v += data->stride; } } if (bmpdest != NULL) { bmpdest->active_bitmap->scan0 = NULL; gdip_bitmap_dispose(bmpdest); } } /* coverity[+alloc : arg-*0] */ GpStatus GdipCreateImageAttributes (GpImageAttributes **imageattr) { GpImageAttributes *result; if (!imageattr) return InvalidParameter; result = (GpImageAttributes *) GdipAlloc (sizeof (GpImageAttributes)); if (!result) { *imageattr = NULL; return OutOfMemory; } gdip_init_image_attribute (&result->def); gdip_init_image_attribute (&result->bitmap); gdip_init_image_attribute (&result->brush); gdip_init_image_attribute (&result->pen); gdip_init_image_attribute (&result->text); result->color = 0; result->wrapmode = WrapModeClamp; *imageattr = result; return Ok; } /* coverity[+alloc : arg-*1] */ GpStatus GdipCloneImageAttributes (GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr) { GpImageAttributes *result; if (!imageattr || !cloneImageattr) return InvalidParameter; result = (GpImageAttributes *) GdipAlloc (sizeof (GpImageAttributes)); if (!result) { *cloneImageattr = NULL; return OutOfMemory; } memcpy (result, imageattr, sizeof (GpImageAttributes)); *cloneImageattr = result; return Ok; } GpStatus GdipDisposeImageAttributes (GpImageAttributes *imageattr) { if (!imageattr) return InvalidParameter; gdip_dispose_image_attribute (&imageattr->def); gdip_dispose_image_attribute (&imageattr->bitmap); gdip_dispose_image_attribute (&imageattr->brush); gdip_dispose_image_attribute (&imageattr->pen); gdip_dispose_image_attribute (&imageattr->text); GdipFree (imageattr); return Ok; } GpStatus GdipSetImageAttributesThreshold ( GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, float threshold) { return NotImplemented; } GpStatus GdipSetImageAttributesGamma (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, float gamma) { GpImageAttribute *imgattr; if (!imageattr) return InvalidParameter; imgattr = gdip_get_image_attribute (imageattr, type); if (!imgattr) return InvalidParameter; if (enableFlag) imgattr->gamma_correction = gamma; else imgattr->gamma_correction = 0.0f; return Ok; } GpStatus GdipSetImageAttributesNoOp (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag) { GpImageAttribute *imgattr; if (!imageattr) return InvalidParameter; imgattr = gdip_get_image_attribute (imageattr, type); if (!imgattr) return InvalidParameter; imgattr->no_op = enableFlag; return Ok; } GpStatus GdipSetImageAttributesColorKeys (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh) { GpImageAttribute *imgattr; if (!imageattr) return InvalidParameter; imgattr = gdip_get_image_attribute (imageattr, type); if (!imgattr) return InvalidParameter; imgattr->key_colorlow = colorLow; imgattr->key_colorhigh = colorHigh; imgattr->key_enabled = enableFlag; return Ok; } GpStatus GdipSetImageAttributesOutputChannelColorProfile (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST WCHAR *colorProfileFilename) { return NotImplemented; } GpStatus GdipSetImageAttributesRemapTable (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, UINT mapSize, GDIPCONST ColorMap *map) { GpImageAttribute *imgattr; if (!imageattr || !map) return InvalidParameter; imgattr = gdip_get_image_attribute (imageattr, type); if (!imgattr) return InvalidParameter; if (!enableFlag) { /* Acts as clean */ GdipFree (imgattr->colormap); imgattr->colormap = NULL; imgattr->colormap_elem = 0; return Ok; } if (imgattr->colormap) GdipFree (imgattr->colormap); /* Copy colormap table*/ if (mapSize > 0) { int size = mapSize * sizeof (ColorMap); imgattr->colormap = GdipAlloc (size); if (!imgattr->colormap) return OutOfMemory; memcpy (imgattr->colormap, map, size); } else { imgattr->colormap = NULL; } imgattr->colormap_elem = mapSize; return Ok; } /* According to Microsoft documentation: clamp: This parameter has no effect in Microsoft® Windows® GDI+ version 1.0 */ GpStatus GdipSetImageAttributesWrapMode (GpImageAttributes *imageattr, WrapMode wrap, ARGB argb, BOOL clamp) { if (!imageattr) return InvalidParameter; imageattr->wrapmode = wrap; imageattr->color = argb; return Ok; } GpStatus GdipGetImageAttributesAdjustedPalette (GpImageAttributes *imageattr, ColorPalette *colorPalette, ColorAdjustType type) { return NotImplemented; } GpStatus GdipSetImageAttributesColorMatrix (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix, GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags) { GpImageAttribute *imgattr; if (!imageattr || (!colorMatrix && enableFlag) || (flags < ColorMatrixFlagsDefault)) return InvalidParameter; if (flags > (grayMatrix ? ColorMatrixFlagsAltGray : ColorMatrixFlagsSkipGrays)) return InvalidParameter; imgattr = gdip_get_image_attribute (imageattr, type); if (!imgattr) return InvalidParameter; if (colorMatrix) { if (!imgattr->colormatrix) { imgattr->colormatrix = GdipAlloc (sizeof (ColorMatrix)); if (!imgattr->colormatrix) return OutOfMemory; } memcpy (imgattr->colormatrix, colorMatrix, sizeof (ColorMatrix)); } if (grayMatrix) { if (!imgattr->graymatrix) { imgattr->graymatrix = GdipAlloc (sizeof (ColorMatrix)); if (!imgattr->graymatrix) return OutOfMemory; } memcpy (imgattr->graymatrix, grayMatrix, sizeof (ColorMatrix)); } imgattr->colormatrix_flags = flags; imgattr->colormatrix_enabled = enableFlag; return Ok; } GpStatus GdipSetImageAttributesOutputChannel (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags) { return NotImplemented; } libgdiplus-4.2/src/wmfcodec.h0000664000175000017500000000600512377405421013175 00000000000000/* * Copyright (C) 2007 Novell, Inc (http://www.novell.com) * * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Sebastien Pouliot */ #ifndef __WMFCODEC_H__ #define __WMFCODEC_H__ #include "gdiplus-private.h" #include "graphics-private.h" #include "metafile-private.h" #define WMF_MIN_RECORD_SIZE 6 #define WMF_CHECK_PARAMS(x) do { \ if (params < (x)) goto cleanup; \ } while (0) #define RECORDSIZE 0 #define FUNCTION 4 #define WP1 6 #define WP2 8 #define WP3 10 #define WP4 12 #define WP5 14 #define WP6 16 #define WP7 18 #define WP8 20 #define WP9 22 #define WP10 24 #define WP11 26 #define WP12 28 #define WP(y) (4 + ((y) << 1)) #define METAFILE_RECORD_SAVEDC 0x001E #define METAFILE_RECORD_SETBKMODE 0x0102 #define METAFILE_RECORD_SETMAPMODE 0x0103 #define METAFILE_RECORD_SETROP2 0x0104 #define METAFILE_RECORD_SETRELABS 0x0105 #define METAFILE_RECORD_SETPOLYFILLMODE 0x0106 #define METAFILE_RECORD_SETSTRETCHBLTMODE 0x0107 #define METAFILE_RECORD_RESTOREDC 0x0127 #define METAFILE_RECORD_SELECTOBJECT 0x012D #define METAFILE_RECORD_SETTEXTALIGN 0x012E #define METAFILE_RECORD_DELETEOBJECT 0x01F0 #define METAFILE_RECORD_SETBKCOLOR 0x0201 #define METAFILE_RECORD_SETWINDOWORG 0x020B #define METAFILE_RECORD_SETWINDOWEXT 0x020C #define METAFILE_RECORD_LINETO 0x0213 #define METAFILE_RECORD_MOVETO 0x0214 #define METAFILE_RECORD_CREATEPENINDIRECT 0x02FA #define METAFILE_RECORD_CREATEBRUSHINDIRECT 0x02FC #define METAFILE_RECORD_POLYGON 0x0324 #define METAFILE_RECORD_POLYLINE 0x0325 #define METAFILE_RECORD_POLYPOLYGON 0x0538 #define METAFILE_RECORD_ARC 0x0817 #define METAFILE_RECORD_STRETCHDIBITS 0x0F43 #define gdip_read_wmf_data gdip_read_bmp_data GpStatus gdip_load_wmf_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; GpStatus gdip_load_wmf_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; /* no save functions as the WMF "codec" is a decoder only */ ImageCodecInfo* gdip_getcodecinfo_wmf () GDIP_INTERNAL; #endif libgdiplus-4.2/TODO0000664000175000017500000000430212377405421011134 00000000000000This file has a list of functionality not yet implemented or issues that have to be fixed in libgdiplus. ---- Functionality not implemented * Image formats - WMF and EMF. We have limited support metafiles. ---- Not implemented / partially implemented functions * Handle functions Functions that use or create Win32 handles and are not yet implemented (except for window and device needed in System.Windows.Forms.) GdipCreateBitmapFromResource GdipCreateFontFromDC GdipCreateFromHWND * Generic functions GdipBeginContainer2 GdipBeginContainerI GdipGetPixelOffsetMode [2] GdipGetTextContrast [2] GdipSetPixelOffsetMode [2] GdipSetTextContrast [2] GdipTransformPoints GdipTransformPointsI * Image handeling GdipSetImageAttributesThreshold GdipSetImageAttributesOutputChannelColorProfile GdipGetImageAttributesAdjustedPalette GdipSetImageAttributesOutputChannel GdipLoadImageFromStream GdipSaveImageToStream GdipSaveAdd GdipSaveAddImage * Pens and brushes GdipSetPenDashCap197819 [2] GdipGetPenDashCap197819 [2] GdipSetPenCustomStartCap [3] GdipGetPenCustomStartCap [3] GdipSetPenCustomEndCap [3] GdipGetPenCustomEndCap [3] * Functions related to paths GdipAddString [1] GdipAddStringI [1] GdipIsOutlineVisiblePathPoint [4] GdipIsOutlineVisiblePathPointI [4] GdipIsVisiblePathPoint [4] GdipIsVisiblePathPointI [4] GdipWindingModeOutline GdipWidenPath GdipWarpPath Notes [1] Partially implemented. LayoutRect and StringFormat are ignored. [2] Function exists (return Ok) but doesn't do anything (visually or not) [3] Function exists (return Ok) but only display a warning on the console [4] Partially implemented. GpGraphics is ignored. ---- Known Limitations * Maximum of 32bpp GDI+ supports bitmaps with more than 32bpp. http://bugzilla.ximian.com/show_bug.cgi?id=80693 * Coordinates limitations GDI+ supports 32bips of precision (Cairo is limited to 15bits) http://bugzilla.ximian.com/show_bug.cgi?id=79729 * Cairo doesn't support 8-bit pseudocolor visuals http://bugzilla.ximian.com/show_bug.cgi?id=77937 * Cairo doesn't implement cairo_stroke_to_path GdipWidenPath implementation depends on this feature. http://bugzilla.ximian.com/show_bug.cgi?id=78110 ---- last updated: August 9th, 2007 libgdiplus-4.2/libgdiplus.pc.in0000664000175000017500000000044012377405421013532 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libgdiplus Description: GDI+ implementation Version: @VERSION@ Requires: glib-2.0 gmodule-2.0 gthread-2.0 Libs: -L${libdir} -lgdiplus @GDIPLUS_PKG_LIBS@ Cflags: -I${includedir} @GDIPLUS_PKG_CFLAGS@ libgdiplus-4.2/aclocal.m40000664000175000017500000130037412635563135012321 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl 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 $CC]) 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. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname 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(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR libgdiplus-4.2/AUTHORS0000664000175000017500000000031312377405421011512 00000000000000The following people made libgdiplus happen: Alexandre Pigolkine Duncan Mak Jordi Mas Mark Steele Miguel de Icaza Ravindra Kumar Vladimir Vukicevic Sanjay Gupta Peter Bartok Hisham Mardam Bey libgdiplus-4.2/Makefile.in0000664000175000017500000007040212635563136012522 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = libgdiplus.pc libgdiplus0.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/libgdiplus.pc.in $(srcdir)/libgdiplus0.spec.in \ AUTHORS COPYING ChangeLog INSTALL NEWS README TODO compile \ config.guess config.sub install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@ BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_DIR = @CAIRO_DIR@ CAIRO_LIBS = @CAIRO_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ FONTCONFIG_CONFIG = @FONTCONFIG_CONFIG@ FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ FREETYPE2_LIBS = @FREETYPE2_LIBS@ FREETYPE_CONFIG = @FREETYPE_CONFIG@ GDIPLUS_CFLAGS = @GDIPLUS_CFLAGS@ GDIPLUS_LIBS = @GDIPLUS_LIBS@ GDIPLUS_PKG_CFLAGS = @GDIPLUS_PKG_CFLAGS@ GDIPLUS_PKG_LIBS = @GDIPLUS_PKG_LIBS@ GDIPLUS_PKG_REQ = @GDIPLUS_PKG_REQ@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEXIF_CFLAGS = @LIBEXIF_CFLAGS@ LIBEXIF_LIBS = @LIBEXIF_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PANGO_CFLAGS = @PANGO_CFLAGS@ PANGO_LIBS = @PANGO_LIBS@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = @CAIRO_DIR@ src tests DIST_SUBDIRS = src tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libgdiplus.pc DISTCLEANFILES = libgdiplus.pc EXTRA_DIST = libgdiplus.pc.in LICENSE MPL-1.1.html all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 libgdiplus.pc: $(top_builddir)/config.status $(srcdir)/libgdiplus.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ libgdiplus0.spec: $(top_builddir)/config.status $(srcdir)/libgdiplus0.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --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) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-generic \ distclean-hdr distclean-libtool distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-pkgconfigDATA \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-pkgconfigDATA .PRECIOUS: Makefile # 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: libgdiplus-4.2/configure.ac0000664000175000017500000003114212635563126012740 00000000000000AC_INIT(libgdiplus, [4.2], [https://bugzilla.xamarin.com/enter_bug.cgi?product=Class%20Libraries&component=libgdiplus]) AC_CONFIG_SRCDIR([README]) AC_CANONICAL_SYSTEM AC_CANONICAL_HOST AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE AM_PROG_LIBTOOL AC_C_BIGENDIAN AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "x$PKG_CONFIG" = "xno"; then AC_MSG_ERROR([You need to install pkg-config]) fi GLIB_REQUIRED_VERSION="2.2.3" PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION) GDIPLUS_LIBS="`pkg-config --libs glib-2.0 `" GDIPLUS_CFLAGS="`pkg-config --cflags glib-2.0 `" CAIRO_REQUIRED_VERSION="1.6.4" PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED_VERSION) # Optional use (experimental and unsupported) of Pango's text rendering on top of Cairo AC_ARG_WITH(pango, [ --with-pango],[text_v=pango],[text_v=cairo]) CAIRO_DIR="" CAIRO_LIBS="`pkg-config --libs cairo `" CAIRO_CFLAGS="`pkg-config --cflags cairo `" cairo_info="`pkg-config --modversion cairo ` (system)" GDIPLUS_PKG_REQ="cairo" if test $text_v = "pango"; then PANGO_REQUIRED_VERSION="1.10" PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION) PANGO_LIBS="`pkg-config --libs pangocairo `" PANGO_CFLAGS="`pkg-config --cflags pangocairo `" AC_DEFINE(USE_PANGO_RENDERING,1,[Use Pango to measure and draw text (INCOMPLETE and UNSUPPORTED)]) GDIPLUS_PKG_REQ="$GDIPLUS_PKG_REQ pangocairo-1.0" fi GDIPLUS_LIBS="$GDIPLUS_LIBS $CAIRO_LIBS $PANGO_LIBS" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $CAIRO_CFLAGS $PANGO_CFLAGS" # Fall back to using fontconfig/freetype-config if their .pc is not found PKG_CHECK_MODULES(FONTCONFIG, fontconfig, [fontconfig_pkgconfig=yes], [fontconfig_pkgconfig=no]) if test "x$FONTCONFIG" = "xno"; then AC_PATH_PROG(FONTCONFIG_CONFIG, fontconfig-config, no) if test "x$FONTCONFIG_CONFIG" = "xyes"; then FONTCONFIG_CFLAGS="`fontconfig-config --cflags`" FONTCONFIG_LIBS="`fontconfig-config --libs`" fi fi AC_CHECK_LIB(fontconfig, FcInit) AC_CHECK_FUNCS(FcFini) PKG_CHECK_MODULES(FREETYPE2, freetype2, [freetype2_pkgconfig=yes], freetype2_pkgconfig=no]) if test "x$FREETYPE2" = "xno"; then AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no) if test "x$FREETYPE_CONFIG" = "xyes"; then FREETYPE2_CFLAGS="`freetype-config --cflags`" FREETYPE2_LIBS="`freetype-config --libs`" fi fi GDIPLUS_LIBS="$GDIPLUS_LIBS $FONTCONFIG_LIBS $FREETYPE2_LIBS" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $FONTCONFIG_CFLAGS $FREETYPE2_CFLAGS" AC_CHECK_HEADERS(byteswap.h) AC_MSG_CHECKING([host threading settings]) case "$host" in *-*-mingw*|*-*-cygwin*) AC_DEFINE_UNQUOTED(CYGWIN,1,[Win32]) AC_CHECK_LIB(intl, gettext) ;; *-*-*netbsd*) AC_DEFINE_UNQUOTED(BSDOS,1,[NetBSD]) ;; *-*-*freebsd*) AC_DEFINE_UNQUOTED(BSDOS,1,[FreeBSD]) CFLAGS="-D_THREAD_SAFE $CFLAGS" ;; *-*-*openbsd*) AC_DEFINE_UNQUOTED(BSDOS,1,[OpenBSD]) CFLAGS="$CFLAGS" LIBS="$LIBS" ;; *-*-linux*) AC_DEFINE_UNQUOTED(LINUX,1,[Linux]) AC_CHECK_LIB(pthread, pthread_create) ;; *-*-solaris*) AC_DEFINE_UNQUOTED(SOLARIS,1,[Solaris]) AC_DEFINE_UNQUOTED(_REENTRANT,1,[For libc reentrancy]) CFLAGS="-pthreads $CFLAGS" ;; *-*-darwin*) AC_DEFINE_UNQUOTED(OSX,1,[OS X]) CFLAGS="-no-cpp-precomp $CFLAGS" LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS" no_x=yes ;; *) AC_MSG_RESULT(Unrecognized host $host) AC_DEFINE_UNQUOTED(OTHEROS,1,[Unknown]) ;; esac # Add xrender here so that we don't fail to find glib if we won't have xrender.pc if test "x$no_x" != "xyes"; then GDIPLUS_LIBS="$GDIPLUS_LIBS `pkg-config --libs xrender `" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS `pkg-config --cflags xrender `" fi # Apparently for BSD special handling needs to happen # See http://archives/neohapsis.com/archives/openbsd/2001-11/2142.html # by Miod Vallat AC_CACHE_CHECK( [if compiler recognizes -pthread], myapp_cv_gcc_pthread, ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pthread" AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([#include ], [void *p = pthread_create;], myapp_cv_gcc_pthread=yes, myapp_cv_gcc_pthread=no) AC_LANG_RESTORE CFLAGS=$ac_save_CFLAGS ) if test $myapp_cv_gcc_pthread = yes then myapp_threads="" CFLAGS="$CFLAGS -pthread" else AC_CHECK_LIB(pthread,pthread_create,myapp_threads=-lpthread, [AC_CHECK_LIB(c_r,pthread_create,myapp_threads=-lc_r)]) fi # sigsetjmp is a macro on some platforms, so can't use AC_CHECK_FUNCS AC_MSG_CHECKING(for sigsetjmp) AC_TRY_LINK([#include ], [ sigjmp_buf env; sigsetjmp(env, 0); ], gdip_ok=yes, gdip_ok=no) AC_MSG_RESULT($gdip_ok) if test "$gdip_ok" = "yes"; then AC_DEFINE(HAVE_SIGSETJMP, 1, sigsetjmp is available) fi # when possible hide stuff we don't want to export AC_MSG_CHECKING(for visibility __attribute__) AC_TRY_COMPILE([], [ void __attribute__ ((visibility ("hidden"))) doit (void) {} void main () { doit (); } ], [ have_visibility_hidden=yes AC_MSG_RESULT(yes) ], [ have_visibility_hidden=no AC_MSG_RESULT(no) ]) case "$host" in i*86-*-*) case $host_os in solaris*) # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. have_visibility_hidden=no esac ;; esac if test "x$have_visibility_hidden" = "xyes"; then AC_DEFINE(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute]) fi AC_ARG_WITH(libexif, [AC_HELP_STRING([--without-libexif], [disable EXIF support])]) dnl Test for libjpeg (this needs to be checked before libtiff, since libtiff depends on libjpeg) AC_ARG_WITH([libjpeg], AS_HELP_STRING([--with-libjpeg=PREFIX], [Prefix where libjpeg is installed, or 'no' to disable]), [libjpeg_prefix="$withval"], [libjpeg_prefix="${prefix}"]) if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then JPEG_CFLAGS="-I${libjpeg_prefix}/include" JPEG_LIBS="-L${libjpeg_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$JPEG_CFLAGS save_libs=$LIBS; LIBS=$JPEG_LIBS AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, jpeg_ok=yes, jpeg_ok=no AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***)) if test "$jpeg_ok" = yes; then AC_MSG_CHECKING([for jpeglib.h]) AC_TRY_CPP( [#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H #include ], jpeg_ok=yes, jpeg_ok=no) AC_MSG_RESULT($jpeg_ok) if test "$jpeg_ok" = yes; then JPEG='jpeg'; LIBJPEG='-L${libjpeg_prefix}/lib -ljpeg' else AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***) fi fi CFLAGS=$save_cflags LIBS=$save_libs fi if test x$JPEG != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBJPEG" AC_DEFINE(HAVE_LIBJPEG, 1, Define if jpeg support is available) else jpeg_ok="no (Get it from http://freshmeat.net/projects/libjpeg)" fi dnl Test for libtiff AC_ARG_WITH([libtiff], AS_HELP_STRING([--with-libtiff=PREFIX], [Prefix where libtiff is installed, or 'no' to disable]), [libtiff_prefix="$withval"], [libtiff_prefix="${prefix}"]) if test x$with_libtiff != xno && test -z "$LIBTIFF"; then TIFF_CFLAGS="-I${libjpeg_prefix}/include -I${libtiff_prefix}/include" TIFF_LIBS="-L${libjpeg_prefix}/lib -L${libtiff_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$TIFF_CFLAGS save_libs=$LIBS; LIBS=$TIFF_LIBS AC_CHECK_LIB(tiff, TIFFReadScanline, [AC_CHECK_HEADER(tiffio.h, TIFF='tiff'; LIBTIFF='-ltiff'; tiff_ok=yes, AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], [AC_CHECK_LIB(tiff, TIFFWriteScanline, [AC_CHECK_HEADER(tiffio.h, TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz'; tiff_ok=yes, AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], [AC_CHECK_LIB(tiff34, TIFFFlushData, [AC_CHECK_HEADER(tiffio.h, TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz'; tiff_ok=yes, AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -lz -lm)], -ljpeg -lz -lm)], -lm) CFLAGS=$save_cflags LIBS=$save_libs fi if test x$TIFF != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBTIFF" AC_DEFINE(HAVE_LIBTIFF, 1, Define if tiff support is available) else tiff_ok="no (Get it from http://www.libtiff.org/)" fi dnl Test for libgif or libungif AC_ARG_WITH([libgif], AS_HELP_STRING([--with-libgif=PREFIX], [Prefix where libgif is installed, or 'no' to disable]), [libgif_prefix="$withval"], [libgif_prefix="${prefix}"]) if test x$with_libgif != xno && test -z "$LIBGIF"; then GIF_CFLAGS="-I${libgif_prefix}/include" GIF_LIBS="-L${libgif_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$GIF_CFLAGS save_libs=$LIBS; LIBS=$GIF_LIBS AC_CHECK_LIB(gif, DGifOpenFileName, [AC_CHECK_HEADER(gif_lib.h, GIF='gif'; LIBGIF='-lgif'; gif_ok=yes, AC_MSG_WARN(*** GIF loader will not be built (giflibrary not found) ***))], AC_MSG_WARN(*** GIF loader will not be built (giflibrary not found) ***)) AC_CHECK_LIB(ungif, DGifOpenFileName, [AC_CHECK_HEADER(gif_lib.h, GIF='ungif'; LIBGIF='-lungif'; gif_ok=yes, AC_MSG_WARN(*** GIF loader will not be built (ungiflibrary not found) ***))], AC_MSG_WARN(*** GIF loader will not be built (ungiflibrary not found) ***)) CFLAGS=$save_cflags LIBS=$save_libs fi if test x$GIF != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBGIF" AC_DEFINE(HAVE_LIBGIF, 1, Define if gif support is available) else gif_ok="no (See http://sourceforge.net/projects/libgif)" fi dnl Test for libpng AC_MSG_CHECKING(for libpng14) if $PKG_CONFIG --exists libpng14 ; then AC_MSG_RESULT(yes) PNG='png' PNG_DEP_CFLAGS_PACKAGES=libpng14 LIBPNG=`$PKG_CONFIG --libs libpng14` else AC_MSG_CHECKING(for libpng12) if $PKG_CONFIG --exists libpng12 ; then AC_MSG_RESULT(yes) PNG='png' PNG_DEP_CFLAGS_PACKAGES=libpng12 LIBPNG=`$PKG_CONFIG --libs libpng12` else AC_MSG_RESULT(no) AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)], AC_MSG_ERROR(*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html.), -lz -lm) if test "$png_ok" = yes; then AC_MSG_CHECKING([for png_structp in png.h]) AC_TRY_COMPILE([#include ], [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;], png_ok=yes, png_ok=no) AC_MSG_RESULT($png_ok) if test "$png_ok" = yes; then PNG='png'; LIBPNG='-lpng -lz' else AC_MSG_ERROR(*** libpng12 found, but it is too old. See http://www.libpng.org/pub/png/libpng.html.) fi else AC_MSG_ERROR(*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html.) fi fi fi GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBPNG" AC_DEFINE(HAVE_LIBPNG, 1, Define if png support is available. Always defined.) dnl Test for libexif if test x$with_libexif != xno && test -z "$LIBEXIF"; then PKG_CHECK_MODULES(LIBEXIF, libexif, [libexif_pkgconfig=yes], libexif_pkgconfig=no]) if test x$libexif_pkgconfig = xyes ; then GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $LIBEXIF_CFLAGS" GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBEXIF_LIBS" AC_DEFINE(HAVE_LIBEXIF, 1, Define if libexif is available.) else libexif_pkgconfig="No. Get it from http://libexif.sourceforge.net/" fi else libexif_pkgconfig="No. You disabled it." fi AM_CONDITIONAL(HAVE_LIBEXIF, test x$libexif_pkgconfig = xyes) dnl dnl Produce a diagnostic, to reduce support time dnl AC_TRY_COMPILE([#include ], [],[x11_failed=false],[x11_failed=true]) if $x11_failed; then AC_ERROR("Failed to compile with X11/Xlib.h include. You must fix your compiler paths") fi GDIPLUS_PKG_LIBS="$GDIPLUS_LIBS" GDIPLUS_PKG_CFLAGS="$GDIPLUS_CFLAGS" AC_SUBST(GDIPLUS_LIBS) AC_SUBST(GDIPLUS_CFLAGS) AC_SUBST(GDIPLUS_PKG_LIBS) AC_SUBST(GDIPLUS_PKG_CFLAGS) AC_SUBST(GDIPLUS_PKG_REQ) AC_SUBST(CAIRO_DIR) AC_OUTPUT([ Makefile libgdiplus.pc libgdiplus0.spec src/Makefile tests/Makefile]) echo "---" echo "Configuration summary" echo "" echo " * Installation prefix = $prefix" echo " * Cairo = $cairo_info" echo " * Text = $text_v" echo " * EXIF tags = $libexif_pkgconfig" echo " * Codecs supported:" echo "" echo " - TIFF: $tiff_ok" echo " - JPEG: $jpeg_ok" echo " - GIF: $gif_ok" echo " - PNG: yes" echo "" echo " NOTE: if any of the above say 'no' you may install the" echo " corresponding development packages for them, rerun" echo " autogen.sh to include them in the build." echo "" echo "---" libgdiplus-4.2/compile0000755000175000017500000001624512550553153012030 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 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, see . # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libgdiplus-4.2/depcomp0000755000175000017500000005601612550553153012027 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libgdiplus-4.2/config.sub0000755000175000017500000010577512405615464012447 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-09-11' # 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 3 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, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 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-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -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 \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-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-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; 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 ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) 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 | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # 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 ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) 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 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libgdiplus-4.2/COPYING0000664000175000017500000000010012377405421011467 00000000000000Libgdiplus is available under the terms of the MIT X11 license. libgdiplus-4.2/README0000664000175000017500000000102512377405421011323 00000000000000libgdiplus: An Open Source implementation of the GDI+ API. This is part of the Mono project - http://mono-project.com Requirements: This requires the libraries used by the Cairo vector graphics library to build (freetype2, fontconfig, Xft2 and libpng, basically). To build: ./configure --prefix=YOUPREFIX make To install: make install Optional build options [UNSUPPORTED] --with-pango This builds libgdiplus using Pango to render (measure and draw) all of it's text. This requires Pango version 1.10 (or later). libgdiplus-4.2/config.h.in0000664000175000017500000000622412635563145012501 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* OpenBSD */ #undef BSDOS /* Win32 */ #undef CYGWIN /* Define to 1 if you have the header file. */ #undef HAVE_BYTESWAP_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `FcFini' function. */ #undef HAVE_FCFINI /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if libexif is available. */ #undef HAVE_LIBEXIF /* Define to 1 if you have the `fontconfig' library (-lfontconfig). */ #undef HAVE_LIBFONTCONFIG /* Define if gif support is available */ #undef HAVE_LIBGIF /* Define to 1 if you have the `intl' library (-lintl). */ #undef HAVE_LIBINTL /* Define if jpeg support is available */ #undef HAVE_LIBJPEG /* Define if png support is available. Always defined. */ #undef HAVE_LIBPNG /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define if tiff support is available */ #undef HAVE_LIBTIFF /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* sigsetjmp is available */ #undef HAVE_SIGSETJMP /* 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 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 /* Support for the visibility ("hidden") attribute */ #undef HAVE_VISIBILITY_HIDDEN /* Linux */ #undef LINUX /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* OS X */ #undef OSX /* Unknown */ #undef OTHEROS /* 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 home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Solaris */ #undef SOLARIS /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Use Pango to measure and draw text (INCOMPLETE and UNSUPPORTED) */ #undef USE_PANGO_RENDERING /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* For libc reentrancy */ #undef _REENTRANT libgdiplus-4.2/NEWS0000664000175000017500000000010712377405421011142 00000000000000See http://www.mono-project.com/Libgdiplus for the most recent details libgdiplus-4.2/install-sh0000755000175000017500000003452312550553153012455 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2013-12-25.23; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libgdiplus-4.2/test-driver0000755000175000017500000001104012550553153012634 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2014 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, see . # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libgdiplus-4.2/libgdiplus0.spec.in0000664000175000017500000000314412413741672014150 00000000000000%define real_name libgdiplus Name: libgdiplus0 Version: @VERSION@ Release: 0 License: LGPL v2.1 only ; MPL ; MIT License (or similar) Url: http://go-mono.org/ Source0: %{real_name}-%{version}.tar.bz2 Summary: Open Source Implementation of the GDI+ API Group: Development/Libraries/Other BuildRoot: %{_tmppath}/%{name}-%{version}-build Obsoletes: libgdiplus-devel Provides: libgdiplus-devel Obsoletes: libgdiplus Provides: libgdiplus BuildRequires: cairo-devel >= 1.6.4 BuildRequires: fontconfig-devel BuildRequires: giflib-devel BuildRequires: glib2-devel BuildRequires: libexif-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libtiff-devel %if 0%{?suse_version} BuildRequires: xorg-x11-libXrender-devel BuildRequires: freetype2-devel %else BuildRequires: libXrender-devel BuildRequires: freetype-devel %endif %description This is part of the Mono project. It is required when using Windows.Forms. %files %defattr(-, root, root) %_libdir/libgdiplus.so* %_libdir/pkgconfig/libgdiplus.pc %doc AUTHORS COPYING ChangeLog* NEWS README %prep %setup -q -n %{real_name}-%{version} %build export CFLAGS="$RPM_OPT_FLAGS" %configure make %install make install DESTDIR=%{buildroot} # Unwanted files: rm -f %{buildroot}%{_libdir}/libgdiplus.a rm -f %{buildroot}%{_libdir}/libgdiplus.la # Remove generic non-usefull INSTALL file... (appeases # suse rpmlint checks, saves 3kb) find . -name INSTALL | xargs rm -f %clean rm -rf "$RPM_BUILD_ROOT" %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %changelog libgdiplus-4.2/LICENSE0000664000175000017500000000014312377405421011450 00000000000000Libgdiplus is licensed under the terms of the GNU Library GPL or the Mozilla Public License 1.1. libgdiplus-4.2/MPL-1.1.html0000664000175000017500000006336512377405421012275 00000000000000 Mozilla Public License version 1.1
MOZILLA PUBLIC LICENSE
Version 1.1


1. Definitions.

    1.0.1. "Commercial Use" means distribution or otherwise making the Covered Code available to a third party.

    1.1. ''Contributor'' means each entity that creates or contributes to the creation of Modifications.

    1.2. ''Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.

    1.3. ''Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.

    1.4. ''Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data.

    1.5. ''Executable'' means Covered Code in any form other than Source Code.

    1.6. ''Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.

    1.7. ''Larger Work'' means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.

    1.8. ''License'' means this document.

    1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.

    1.9. ''Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:

      A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.

      B. Any new file that contains any part of the Original Code or previous Modifications.
       

    1.10. ''Original Code'' means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.

    1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation,  method, process, and apparatus claims, in any patent Licensable by grantor.

    1.11. ''Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.

    1.12. "You'' (or "Your")  means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You'' includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.

2. Source Code License.
    2.1. The Initial Developer Grant.
    The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
      (a)  under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and

      (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).

           
      (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.

      (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code;  or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
       

    2.2. Contributor Grant.
    Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
       
      (a)  under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and

      (b) under Patent Claims infringed by the making, using, or selling of  Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of  Modifications made by that Contributor with its Contributor Version (or portions of such combination).

      (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.

      (d)    Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2)  separate from the Contributor Version;  3)  for infringements caused by: i) third party modifications of Contributor Version or ii)  the combination of Modifications made by that Contributor with other software  (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.


3. Distribution Obligations.

    3.1. Application of License.
    The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.

    3.2. Availability of Source Code.
    Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.

    3.3. Description of Modifications.
    You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.

    3.4. Intellectual Property Matters

      (a) Third Party Claims.
      If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL'' which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.

      (b) Contributor APIs.
      If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file.
       

              (c)    Representations.
      Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.


    3.5. Required Notices.
    You must duplicate the notice in Exhibit A in each file of the Source Code.  If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice.  If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A.  You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code.  You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.

    3.6. Distribution of Executable Versions.
    You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.

    3.7. Larger Works.
    You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.

4. Inability to Comply Due to Statute or Regulation.
    If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
5. Application of this License.
    This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
    6.1. New Versions.
    Netscape Communications Corporation (''Netscape'') may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.

    6.2. Effect of New Versions.
    Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License.

    6.3. Derivative Works.
    If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)

7. DISCLAIMER OF WARRANTY.
    COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
    8.1.  This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.

    8.2.  If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant")  alleging that:

    (a)  such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i)  agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant.  If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.

    (b)  any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.

    8.3.  If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.

    8.4.  In the event of termination under Sections 8.1 or 8.2 above,  all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.

9. LIMITATION OF LIABILITY.
    UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
    The Covered Code is a ''commercial item,'' as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and ''commercial computer software documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
11. MISCELLANEOUS.
    This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
    As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
    Initial Developer may designate portions of the Covered Code as “Multiple-Licensed”.  “Multiple-Licensed” means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the MPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.


EXHIBIT A -Mozilla Public License.

    ``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
    http://www.mozilla.org/MPL/

    Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
    ANY KIND, either express or implied. See the License for the specific language governing rights and
    limitations under the License.

    The Original Code is ______________________________________.

    The Initial Developer of the Original Code is ________________________. Portions created by
     ______________________ are Copyright (C) ______ _______________________. All Rights
    Reserved.

    Contributor(s): ______________________________________.

    Alternatively, the contents of this file may be used under the terms of the _____ license (the  “[___] License”), in which case the provisions of [______] License are applicable  instead of those above.  If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting  the provisions above and replace  them with the notice and other provisions required by the [___] License.  If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the [___] License."

    [NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.]

    libgdiplus-4.2/missing0000755000175000017500000001533012550553153012043 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libgdiplus-4.2/Makefile.am0000664000175000017500000000032012377405421012474 00000000000000SUBDIRS = @CAIRO_DIR@ src tests DIST_SUBDIRS = src tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA= libgdiplus.pc DISTCLEANFILES= libgdiplus.pc EXTRA_DIST = libgdiplus.pc.in LICENSE MPL-1.1.html libgdiplus-4.2/config.guess0000755000175000017500000012355012405615464012773 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-03-23' # 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 3 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, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. 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 1992-2014 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 case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # 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 tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_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'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`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/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${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-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi 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 ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac 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: libgdiplus-4.2/configure0000775000175000017500000164656512635563136012410 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for libgdiplus 4.2. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://bugzilla.xamarin.com/enter_bug.cgi?product=Class%20Libraries&component=libgdiplus $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # 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'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libgdiplus' PACKAGE_TARNAME='libgdiplus' PACKAGE_VERSION='4.2' PACKAGE_STRING='libgdiplus 4.2' PACKAGE_BUGREPORT='https://bugzilla.xamarin.com/enter_bug.cgi?product=Class%20Libraries&component=libgdiplus' PACKAGE_URL='' ac_unique_file="README" # 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='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS CAIRO_DIR GDIPLUS_PKG_REQ GDIPLUS_PKG_CFLAGS GDIPLUS_PKG_LIBS GDIPLUS_CFLAGS GDIPLUS_LIBS HAVE_LIBEXIF_FALSE HAVE_LIBEXIF_TRUE LIBEXIF_LIBS LIBEXIF_CFLAGS FREETYPE_CONFIG FREETYPE2_LIBS FREETYPE2_CFLAGS FONTCONFIG_CONFIG FONTCONFIG_LIBS FONTCONFIG_CFLAGS PANGO_LIBS PANGO_CFLAGS CAIRO_LIBS CAIRO_CFLAGS BASE_DEPENDENCIES_LIBS BASE_DEPENDENCIES_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LIBTOOL MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_shared enable_static with_pic enable_fast_install enable_dependency_tracking with_gnu_ld with_sysroot enable_libtool_lock with_pango with_libexif with_libjpeg with_libtiff with_libgif ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR BASE_DEPENDENCIES_CFLAGS BASE_DEPENDENCIES_LIBS CAIRO_CFLAGS CAIRO_LIBS PANGO_CFLAGS PANGO_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE2_CFLAGS FREETYPE2_LIBS LIBEXIF_CFLAGS LIBEXIF_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libgdiplus 4.2 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/libgdiplus] --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 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 case $ac_init_help in short | recursive ) echo "Configuration of libgdiplus 4.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-pango --without-libexif disable EXIF support --with-libjpeg=PREFIX Prefix where libjpeg is installed, or 'no' to disable --with-libtiff=PREFIX Prefix where libtiff is installed, or 'no' to disable --with-libgif=PREFIX Prefix where libgif is installed, or 'no' to disable Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path BASE_DEPENDENCIES_CFLAGS C compiler flags for BASE_DEPENDENCIES, overriding pkg-config BASE_DEPENDENCIES_LIBS linker flags for BASE_DEPENDENCIES, overriding pkg-config CAIRO_CFLAGS C compiler flags for CAIRO, overriding pkg-config CAIRO_LIBS linker flags for CAIRO, overriding pkg-config PANGO_CFLAGS C compiler flags for PANGO, overriding pkg-config PANGO_LIBS linker flags for PANGO, overriding pkg-config FONTCONFIG_CFLAGS C compiler flags for FONTCONFIG, overriding pkg-config FONTCONFIG_LIBS linker flags for FONTCONFIG, overriding pkg-config FREETYPE2_CFLAGS C compiler flags for FREETYPE2, overriding pkg-config FREETYPE2_LIBS linker flags for FREETYPE2, overriding pkg-config LIBEXIF_CFLAGS C compiler flags for LIBEXIF, overriding pkg-config LIBEXIF_LIBS linker flags for LIBEXIF, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libgdiplus configure 4.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------------------------------------------------------------------------- ## ## Report this to https://bugzilla.xamarin.com/enter_bug.cgi?product=Class%20Libraries&component=libgdiplus ## ## -------------------------------------------------------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libgdiplus $as_me 4.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$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 as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&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 && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&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` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&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` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; 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.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file 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 $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P 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. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libgdiplus' VERSION='4.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_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 do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_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_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_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 fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_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_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } 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. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" 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 # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$PKG_CONFIG" = "xno"; then as_fn_error $? "You need to install pkg-config" "$LINENO" 5 fi GLIB_REQUIRED_VERSION="2.2.3" if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BASE_DEPENDENCIES" >&5 $as_echo_n "checking for BASE_DEPENDENCIES... " >&6; } if test -n "$BASE_DEPENDENCIES_CFLAGS"; then pkg_cv_BASE_DEPENDENCIES_CFLAGS="$BASE_DEPENDENCIES_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BASE_DEPENDENCIES_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$BASE_DEPENDENCIES_LIBS"; then pkg_cv_BASE_DEPENDENCIES_LIBS="$BASE_DEPENDENCIES_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BASE_DEPENDENCIES_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then BASE_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1` else BASE_DEPENDENCIES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BASE_DEPENDENCIES_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION) were not met: $BASE_DEPENDENCIES_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables BASE_DEPENDENCIES_CFLAGS and BASE_DEPENDENCIES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables BASE_DEPENDENCIES_CFLAGS and BASE_DEPENDENCIES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else BASE_DEPENDENCIES_CFLAGS=$pkg_cv_BASE_DEPENDENCIES_CFLAGS BASE_DEPENDENCIES_LIBS=$pkg_cv_BASE_DEPENDENCIES_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi GDIPLUS_LIBS="`pkg-config --libs glib-2.0 `" GDIPLUS_CFLAGS="`pkg-config --cflags glib-2.0 `" CAIRO_REQUIRED_VERSION="1.6.4" pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAIRO" >&5 $as_echo_n "checking for CAIRO... " >&6; } if test -n "$CAIRO_CFLAGS"; then pkg_cv_CAIRO_CFLAGS="$CAIRO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= \$CAIRO_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "cairo >= $CAIRO_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= $CAIRO_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CAIRO_LIBS"; then pkg_cv_CAIRO_LIBS="$CAIRO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= \$CAIRO_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "cairo >= $CAIRO_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= $CAIRO_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cairo >= $CAIRO_REQUIRED_VERSION" 2>&1` else CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cairo >= $CAIRO_REQUIRED_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CAIRO_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (cairo >= $CAIRO_REQUIRED_VERSION) were not met: $CAIRO_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables CAIRO_CFLAGS and CAIRO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables CAIRO_CFLAGS and CAIRO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else CAIRO_CFLAGS=$pkg_cv_CAIRO_CFLAGS CAIRO_LIBS=$pkg_cv_CAIRO_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # Optional use (experimental and unsupported) of Pango's text rendering on top of Cairo # Check whether --with-pango was given. if test "${with_pango+set}" = set; then : withval=$with_pango; text_v=pango else text_v=cairo fi CAIRO_DIR="" CAIRO_LIBS="`pkg-config --libs cairo `" CAIRO_CFLAGS="`pkg-config --cflags cairo `" cairo_info="`pkg-config --modversion cairo ` (system)" GDIPLUS_PKG_REQ="cairo" if test $text_v = "pango"; then PANGO_REQUIRED_VERSION="1.10" pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANGO" >&5 $as_echo_n "checking for PANGO... " >&6; } if test -n "$PANGO_CFLAGS"; then pkg_cv_PANGO_CFLAGS="$PANGO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pango >= \$PANGO_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "pango >= $PANGO_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PANGO_CFLAGS=`$PKG_CONFIG --cflags "pango >= $PANGO_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PANGO_LIBS"; then pkg_cv_PANGO_LIBS="$PANGO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pango >= \$PANGO_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "pango >= $PANGO_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PANGO_LIBS=`$PKG_CONFIG --libs "pango >= $PANGO_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PANGO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pango >= $PANGO_REQUIRED_VERSION" 2>&1` else PANGO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pango >= $PANGO_REQUIRED_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PANGO_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (pango >= $PANGO_REQUIRED_VERSION) were not met: $PANGO_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables PANGO_CFLAGS and PANGO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables PANGO_CFLAGS and PANGO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else PANGO_CFLAGS=$pkg_cv_PANGO_CFLAGS PANGO_LIBS=$pkg_cv_PANGO_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi PANGO_LIBS="`pkg-config --libs pangocairo `" PANGO_CFLAGS="`pkg-config --cflags pangocairo `" $as_echo "#define USE_PANGO_RENDERING 1" >>confdefs.h GDIPLUS_PKG_REQ="$GDIPLUS_PKG_REQ pangocairo-1.0" fi GDIPLUS_LIBS="$GDIPLUS_LIBS $CAIRO_LIBS $PANGO_LIBS" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $CAIRO_CFLAGS $PANGO_CFLAGS" # Fall back to using fontconfig/freetype-config if their .pc is not found pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTCONFIG" >&5 $as_echo_n "checking for FONTCONFIG... " >&6; } if test -n "$FONTCONFIG_CFLAGS"; then pkg_cv_FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$FONTCONFIG_LIBS"; then pkg_cv_FONTCONFIG_LIBS="$FONTCONFIG_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fontconfig" 2>&1` else FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fontconfig" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$FONTCONFIG_PKG_ERRORS" >&5 fontconfig_pkgconfig=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fontconfig_pkgconfig=no else FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fontconfig_pkgconfig=yes fi if test "x$FONTCONFIG" = "xno"; then # Extract the first word of "fontconfig-config", so it can be a program name with args. set dummy fontconfig-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_FONTCONFIG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $FONTCONFIG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_FONTCONFIG_CONFIG="$FONTCONFIG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_FONTCONFIG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FONTCONFIG_CONFIG" && ac_cv_path_FONTCONFIG_CONFIG="no" ;; esac fi FONTCONFIG_CONFIG=$ac_cv_path_FONTCONFIG_CONFIG if test -n "$FONTCONFIG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FONTCONFIG_CONFIG" >&5 $as_echo "$FONTCONFIG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$FONTCONFIG_CONFIG" = "xyes"; then FONTCONFIG_CFLAGS="`fontconfig-config --cflags`" FONTCONFIG_LIBS="`fontconfig-config --libs`" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FcInit in -lfontconfig" >&5 $as_echo_n "checking for FcInit in -lfontconfig... " >&6; } if ${ac_cv_lib_fontconfig_FcInit+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfontconfig $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char FcInit (); int main () { return FcInit (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_fontconfig_FcInit=yes else ac_cv_lib_fontconfig_FcInit=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fontconfig_FcInit" >&5 $as_echo "$ac_cv_lib_fontconfig_FcInit" >&6; } if test "x$ac_cv_lib_fontconfig_FcInit" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBFONTCONFIG 1 _ACEOF LIBS="-lfontconfig $LIBS" fi for ac_func in FcFini do : ac_fn_c_check_func "$LINENO" "FcFini" "ac_cv_func_FcFini" if test "x$ac_cv_func_FcFini" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FCFINI 1 _ACEOF fi done pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE2" >&5 $as_echo_n "checking for FREETYPE2... " >&6; } if test -n "$FREETYPE2_CFLAGS"; then pkg_cv_FREETYPE2_CFLAGS="$FREETYPE2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5 ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FREETYPE2_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$FREETYPE2_LIBS"; then pkg_cv_FREETYPE2_LIBS="$FREETYPE2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5 ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FREETYPE2_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then FREETYPE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "freetype2" 2>&1` else FREETYPE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "freetype2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$FREETYPE2_PKG_ERRORS" >&5 freetype2_pkgconfig=no] elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } freetype2_pkgconfig=no] else FREETYPE2_CFLAGS=$pkg_cv_FREETYPE2_CFLAGS FREETYPE2_LIBS=$pkg_cv_FREETYPE2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } freetype2_pkgconfig=yes fi if test "x$FREETYPE2" = "xno"; then # Extract the first word of "freetype-config", so it can be a program name with args. set dummy freetype-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_FREETYPE_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $FREETYPE_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_FREETYPE_CONFIG="$FREETYPE_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_FREETYPE_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FREETYPE_CONFIG" && ac_cv_path_FREETYPE_CONFIG="no" ;; esac fi FREETYPE_CONFIG=$ac_cv_path_FREETYPE_CONFIG if test -n "$FREETYPE_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_CONFIG" >&5 $as_echo "$FREETYPE_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$FREETYPE_CONFIG" = "xyes"; then FREETYPE2_CFLAGS="`freetype-config --cflags`" FREETYPE2_LIBS="`freetype-config --libs`" fi fi GDIPLUS_LIBS="$GDIPLUS_LIBS $FONTCONFIG_LIBS $FREETYPE2_LIBS" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $FONTCONFIG_CFLAGS $FREETYPE2_CFLAGS" for ac_header in byteswap.h do : ac_fn_c_check_header_mongrel "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default" if test "x$ac_cv_header_byteswap_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BYTESWAP_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking host threading settings" >&5 $as_echo_n "checking host threading settings... " >&6; } case "$host" in *-*-mingw*|*-*-cygwin*) cat >>confdefs.h <<_ACEOF #define CYGWIN 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5 $as_echo_n "checking for gettext in -lintl... " >&6; } if ${ac_cv_lib_intl_gettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gettext (); int main () { return gettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_gettext=yes else ac_cv_lib_intl_gettext=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext" >&5 $as_echo "$ac_cv_lib_intl_gettext" >&6; } if test "x$ac_cv_lib_intl_gettext" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBINTL 1 _ACEOF LIBS="-lintl $LIBS" fi ;; *-*-*netbsd*) cat >>confdefs.h <<_ACEOF #define BSDOS 1 _ACEOF ;; *-*-*freebsd*) cat >>confdefs.h <<_ACEOF #define BSDOS 1 _ACEOF CFLAGS="-D_THREAD_SAFE $CFLAGS" ;; *-*-*openbsd*) cat >>confdefs.h <<_ACEOF #define BSDOS 1 _ACEOF CFLAGS="$CFLAGS" LIBS="$LIBS" ;; *-*-linux*) cat >>confdefs.h <<_ACEOF #define LINUX 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" fi ;; *-*-solaris*) cat >>confdefs.h <<_ACEOF #define SOLARIS 1 _ACEOF cat >>confdefs.h <<_ACEOF #define _REENTRANT 1 _ACEOF CFLAGS="-pthreads $CFLAGS" ;; *-*-darwin*) cat >>confdefs.h <<_ACEOF #define OSX 1 _ACEOF CFLAGS="-no-cpp-precomp $CFLAGS" LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS" no_x=yes ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unrecognized host $host" >&5 $as_echo "Unrecognized host $host" >&6; } cat >>confdefs.h <<_ACEOF #define OTHEROS 1 _ACEOF ;; esac # Add xrender here so that we don't fail to find glib if we won't have xrender.pc if test "x$no_x" != "xyes"; then GDIPLUS_LIBS="$GDIPLUS_LIBS `pkg-config --libs xrender `" GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS `pkg-config --cflags xrender `" fi # Apparently for BSD special handling needs to happen # See http://archives/neohapsis.com/archives/openbsd/2001-11/2142.html # by Miod Vallat { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler recognizes -pthread" >&5 $as_echo_n "checking if compiler recognizes -pthread... " >&6; } if ${myapp_cv_gcc_pthread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pthread" 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { void *p = pthread_create; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : myapp_cv_gcc_pthread=yes else myapp_cv_gcc_pthread=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS=$ac_save_CFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $myapp_cv_gcc_pthread" >&5 $as_echo "$myapp_cv_gcc_pthread" >&6; } if test $myapp_cv_gcc_pthread = yes then myapp_threads="" CFLAGS="$CFLAGS -pthread" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : myapp_threads=-lpthread else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } if ${ac_cv_lib_c_r_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_r_pthread_create=yes else ac_cv_lib_c_r_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : myapp_threads=-lc_r fi fi fi # sigsetjmp is a macro on some platforms, so can't use AC_CHECK_FUNCS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsetjmp" >&5 $as_echo_n "checking for sigsetjmp... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { sigjmp_buf env; sigsetjmp(env, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gdip_ok=yes else gdip_ok=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdip_ok" >&5 $as_echo "$gdip_ok" >&6; } if test "$gdip_ok" = "yes"; then $as_echo "#define HAVE_SIGSETJMP 1" >>confdefs.h fi # when possible hide stuff we don't want to export { $as_echo "$as_me:${as_lineno-$LINENO}: checking for visibility __attribute__" >&5 $as_echo_n "checking for visibility __attribute__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { void __attribute__ ((visibility ("hidden"))) doit (void) {} void main () { doit (); } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_visibility_hidden=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else have_visibility_hidden=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext case "$host" in i*86-*-*) case $host_os in solaris*) # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. have_visibility_hidden=no esac ;; esac if test "x$have_visibility_hidden" = "xyes"; then $as_echo "#define HAVE_VISIBILITY_HIDDEN 1" >>confdefs.h fi # Check whether --with-libexif was given. if test "${with_libexif+set}" = set; then : withval=$with_libexif; fi # Check whether --with-libjpeg was given. if test "${with_libjpeg+set}" = set; then : withval=$with_libjpeg; libjpeg_prefix="$withval" else libjpeg_prefix="${prefix}" fi if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then JPEG_CFLAGS="-I${libjpeg_prefix}/include" JPEG_LIBS="-L${libjpeg_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$JPEG_CFLAGS save_libs=$LIBS; LIBS=$JPEG_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_destroy_decompress in -ljpeg" >&5 $as_echo_n "checking for jpeg_destroy_decompress in -ljpeg... " >&6; } if ${ac_cv_lib_jpeg_jpeg_destroy_decompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ljpeg $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char jpeg_destroy_decompress (); int main () { return jpeg_destroy_decompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_jpeg_jpeg_destroy_decompress=yes else ac_cv_lib_jpeg_jpeg_destroy_decompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_destroy_decompress" >&5 $as_echo "$ac_cv_lib_jpeg_jpeg_destroy_decompress" >&6; } if test "x$ac_cv_lib_jpeg_jpeg_destroy_decompress" = xyes; then : jpeg_ok=yes else jpeg_ok=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** JPEG loader will not be built (JPEG library not found) ***" >&5 $as_echo "$as_me: WARNING: *** JPEG loader will not be built (JPEG library not found) ***" >&2;} fi if test "$jpeg_ok" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeglib.h" >&5 $as_echo_n "checking for jpeglib.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : jpeg_ok=yes else jpeg_ok=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jpeg_ok" >&5 $as_echo "$jpeg_ok" >&6; } if test "$jpeg_ok" = yes; then JPEG='jpeg'; LIBJPEG='-L${libjpeg_prefix}/lib -ljpeg' else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** JPEG loader will not be built (JPEG header file not found) ***" >&5 $as_echo "$as_me: WARNING: *** JPEG loader will not be built (JPEG header file not found) ***" >&2;} fi fi CFLAGS=$save_cflags LIBS=$save_libs fi if test x$JPEG != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBJPEG" $as_echo "#define HAVE_LIBJPEG 1" >>confdefs.h else jpeg_ok="no (Get it from http://freshmeat.net/projects/libjpeg)" fi # Check whether --with-libtiff was given. if test "${with_libtiff+set}" = set; then : withval=$with_libtiff; libtiff_prefix="$withval" else libtiff_prefix="${prefix}" fi if test x$with_libtiff != xno && test -z "$LIBTIFF"; then TIFF_CFLAGS="-I${libjpeg_prefix}/include -I${libtiff_prefix}/include" TIFF_LIBS="-L${libjpeg_prefix}/lib -L${libtiff_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$TIFF_CFLAGS save_libs=$LIBS; LIBS=$TIFF_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFReadScanline in -ltiff" >&5 $as_echo_n "checking for TIFFReadScanline in -ltiff... " >&6; } if ${ac_cv_lib_tiff_TIFFReadScanline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltiff -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TIFFReadScanline (); int main () { return TIFFReadScanline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tiff_TIFFReadScanline=yes else ac_cv_lib_tiff_TIFFReadScanline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFReadScanline" >&5 $as_echo "$ac_cv_lib_tiff_TIFFReadScanline" >&6; } if test "x$ac_cv_lib_tiff_TIFFReadScanline" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default" if test "x$ac_cv_header_tiffio_h" = xyes; then : TIFF='tiff'; LIBTIFF='-ltiff'; tiff_ok=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&5 $as_echo "$as_me: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFWriteScanline in -ltiff" >&5 $as_echo_n "checking for TIFFWriteScanline in -ltiff... " >&6; } if ${ac_cv_lib_tiff_TIFFWriteScanline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltiff -ljpeg -lz -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TIFFWriteScanline (); int main () { return TIFFWriteScanline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tiff_TIFFWriteScanline=yes else ac_cv_lib_tiff_TIFFWriteScanline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFWriteScanline" >&5 $as_echo "$ac_cv_lib_tiff_TIFFWriteScanline" >&6; } if test "x$ac_cv_lib_tiff_TIFFWriteScanline" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default" if test "x$ac_cv_header_tiffio_h" = xyes; then : TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz'; tiff_ok=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&5 $as_echo "$as_me: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFFlushData in -ltiff34" >&5 $as_echo_n "checking for TIFFFlushData in -ltiff34... " >&6; } if ${ac_cv_lib_tiff34_TIFFFlushData+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltiff34 -lz -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TIFFFlushData (); int main () { return TIFFFlushData (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tiff34_TIFFFlushData=yes else ac_cv_lib_tiff34_TIFFFlushData=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff34_TIFFFlushData" >&5 $as_echo "$ac_cv_lib_tiff34_TIFFFlushData" >&6; } if test "x$ac_cv_lib_tiff34_TIFFFlushData" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default" if test "x$ac_cv_header_tiffio_h" = xyes; then : TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz'; tiff_ok=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&5 $as_echo "$as_me: WARNING: *** TIFF loader will not be built (TIFF header files not found) ***" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** TIFF plug-in will not be built (TIFF library not found) ***" >&5 $as_echo "$as_me: WARNING: *** TIFF plug-in will not be built (TIFF library not found) ***" >&2;} fi fi fi CFLAGS=$save_cflags LIBS=$save_libs fi if test x$TIFF != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBTIFF" $as_echo "#define HAVE_LIBTIFF 1" >>confdefs.h else tiff_ok="no (Get it from http://www.libtiff.org/)" fi # Check whether --with-libgif was given. if test "${with_libgif+set}" = set; then : withval=$with_libgif; libgif_prefix="$withval" else libgif_prefix="${prefix}" fi if test x$with_libgif != xno && test -z "$LIBGIF"; then GIF_CFLAGS="-I${libgif_prefix}/include" GIF_LIBS="-L${libgif_prefix}/lib" save_cflags=$CFLAGS; CFLAGS=$GIF_CFLAGS save_libs=$LIBS; LIBS=$GIF_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DGifOpenFileName in -lgif" >&5 $as_echo_n "checking for DGifOpenFileName in -lgif... " >&6; } if ${ac_cv_lib_gif_DGifOpenFileName+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgif $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char DGifOpenFileName (); int main () { return DGifOpenFileName (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gif_DGifOpenFileName=yes else ac_cv_lib_gif_DGifOpenFileName=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_DGifOpenFileName" >&5 $as_echo "$ac_cv_lib_gif_DGifOpenFileName" >&6; } if test "x$ac_cv_lib_gif_DGifOpenFileName" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default" if test "x$ac_cv_header_gif_lib_h" = xyes; then : GIF='gif'; LIBGIF='-lgif'; gif_ok=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (giflibrary not found) ***" >&5 $as_echo "$as_me: WARNING: *** GIF loader will not be built (giflibrary not found) ***" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (giflibrary not found) ***" >&5 $as_echo "$as_me: WARNING: *** GIF loader will not be built (giflibrary not found) ***" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DGifOpenFileName in -lungif" >&5 $as_echo_n "checking for DGifOpenFileName in -lungif... " >&6; } if ${ac_cv_lib_ungif_DGifOpenFileName+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lungif $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char DGifOpenFileName (); int main () { return DGifOpenFileName (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ungif_DGifOpenFileName=yes else ac_cv_lib_ungif_DGifOpenFileName=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ungif_DGifOpenFileName" >&5 $as_echo "$ac_cv_lib_ungif_DGifOpenFileName" >&6; } if test "x$ac_cv_lib_ungif_DGifOpenFileName" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default" if test "x$ac_cv_header_gif_lib_h" = xyes; then : GIF='ungif'; LIBGIF='-lungif'; gif_ok=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (ungiflibrary not found) ***" >&5 $as_echo "$as_me: WARNING: *** GIF loader will not be built (ungiflibrary not found) ***" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** GIF loader will not be built (ungiflibrary not found) ***" >&5 $as_echo "$as_me: WARNING: *** GIF loader will not be built (ungiflibrary not found) ***" >&2;} fi CFLAGS=$save_cflags LIBS=$save_libs fi if test x$GIF != x; then GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBGIF" $as_echo "#define HAVE_LIBGIF 1" >>confdefs.h else gif_ok="no (See http://sourceforge.net/projects/libgif)" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng14" >&5 $as_echo_n "checking for libpng14... " >&6; } if $PKG_CONFIG --exists libpng14 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } PNG='png' PNG_DEP_CFLAGS_PACKAGES=libpng14 LIBPNG=`$PKG_CONFIG --libs libpng14` else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng12" >&5 $as_echo_n "checking for libpng12... " >&6; } if $PKG_CONFIG --exists libpng12 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } PNG='png' PNG_DEP_CFLAGS_PACKAGES=libpng12 LIBPNG=`$PKG_CONFIG --libs libpng12` else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_read_info in -lpng" >&5 $as_echo_n "checking for png_read_info in -lpng... " >&6; } if ${ac_cv_lib_png_png_read_info+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpng -lz -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char png_read_info (); int main () { return png_read_info (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_png_png_read_info=yes else ac_cv_lib_png_png_read_info=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_read_info" >&5 $as_echo "$ac_cv_lib_png_png_read_info" >&6; } if test "x$ac_cv_lib_png_png_read_info" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default" if test "x$ac_cv_header_png_h" = xyes; then : png_ok=yes else png_ok=no fi else as_fn_error $? "*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html." "$LINENO" 5 fi if test "$png_ok" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_structp in png.h" >&5 $as_echo_n "checking for png_structp in png.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : png_ok=yes else png_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $png_ok" >&5 $as_echo "$png_ok" >&6; } if test "$png_ok" = yes; then PNG='png'; LIBPNG='-lpng -lz' else as_fn_error but it is too old. See http://www.libpng.org/pub/png/libpng.html. "*** libpng12 found" "$LINENO" 5 fi else as_fn_error $? "*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html." "$LINENO" 5 fi fi fi GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBPNG" $as_echo "#define HAVE_LIBPNG 1" >>confdefs.h if test x$with_libexif != xno && test -z "$LIBEXIF"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEXIF" >&5 $as_echo_n "checking for LIBEXIF... " >&6; } if test -n "$LIBEXIF_CFLAGS"; then pkg_cv_LIBEXIF_CFLAGS="$LIBEXIF_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libexif\""; } >&5 ($PKG_CONFIG --exists --print-errors "libexif") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBEXIF_CFLAGS=`$PKG_CONFIG --cflags "libexif" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBEXIF_LIBS"; then pkg_cv_LIBEXIF_LIBS="$LIBEXIF_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libexif\""; } >&5 ($PKG_CONFIG --exists --print-errors "libexif") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBEXIF_LIBS=`$PKG_CONFIG --libs "libexif" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBEXIF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libexif" 2>&1` else LIBEXIF_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libexif" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBEXIF_PKG_ERRORS" >&5 libexif_pkgconfig=no] elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } libexif_pkgconfig=no] else LIBEXIF_CFLAGS=$pkg_cv_LIBEXIF_CFLAGS LIBEXIF_LIBS=$pkg_cv_LIBEXIF_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } libexif_pkgconfig=yes fi if test x$libexif_pkgconfig = xyes ; then GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $LIBEXIF_CFLAGS" GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBEXIF_LIBS" $as_echo "#define HAVE_LIBEXIF 1" >>confdefs.h else libexif_pkgconfig="No. Get it from http://libexif.sourceforge.net/" fi else libexif_pkgconfig="No. You disabled it." fi if test x$libexif_pkgconfig = xyes; then HAVE_LIBEXIF_TRUE= HAVE_LIBEXIF_FALSE='#' else HAVE_LIBEXIF_TRUE='#' HAVE_LIBEXIF_FALSE= fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : x11_failed=false else x11_failed=true fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if $x11_failed; then as_fn_error $? "\"Failed to compile with X11/Xlib.h include. You must fix your compiler paths\"" "$LINENO" 5 fi GDIPLUS_PKG_LIBS="$GDIPLUS_LIBS" GDIPLUS_PKG_CFLAGS="$GDIPLUS_CFLAGS" ac_config_files="$ac_config_files Makefile libgdiplus.pc libgdiplus0.spec src/Makefile tests/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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_LIBEXIF_TRUE}" && test -z "${HAVE_LIBEXIF_FALSE}"; then as_fn_error $? "conditional \"HAVE_LIBEXIF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libgdiplus $as_me 4.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ libgdiplus config.status 4.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 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' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "libgdiplus.pc") CONFIG_FILES="$CONFIG_FILES libgdiplus.pc" ;; "libgdiplus0.spec") CONFIG_FILES="$CONFIG_FILES libgdiplus0.spec" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers 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= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo "---" echo "Configuration summary" echo "" echo " * Installation prefix = $prefix" echo " * Cairo = $cairo_info" echo " * Text = $text_v" echo " * EXIF tags = $libexif_pkgconfig" echo " * Codecs supported:" echo "" echo " - TIFF: $tiff_ok" echo " - JPEG: $jpeg_ok" echo " - GIF: $gif_ok" echo " - PNG: yes" echo "" echo " NOTE: if any of the above say 'no' you may install the" echo " corresponding development packages for them, rerun" echo " autogen.sh to include them in the build." echo "" echo "---" libgdiplus-4.2/tests/0000775000175000017500000000000012635563145011674 500000000000000libgdiplus-4.2/tests/ChangeLog0000664000175000017500000000361512377405421013366 000000000000002007-10-04 Sebastien Pouliot * testgdi.c: Fix segfault. Patch by Yoichi NAKAYAMA. 2007-07-31 Sebastien Pouliot * Makefile.am: Add two new tests; * testclip.c: New test case for #83129 by Yves Bastide. * testreversepath.c: New test case for #81859 by Yves Bastide. 2007-06-21 Sebastien Pouliot * testbits.c, testgdi.c: Fix #81845 to allow using with C++ compilers and -Werror. Patch by Yves Bastide. 2007-06-21 Sebastien Pouliot * testbits.cs: Fix Rgb|Argb definitions. Patch by Yves Bastide. 2007-04-24 Sebastien Pouliot * testbits.cs: Use public header file. Comment stuff that use private API (stuff is not exposed anymore). * testgdi.c: Use public header file and fix warnings. 2007-04-03 Sebastien Pouliot * testgdi.c: Adjust sample as private symbol gdip_graphics_new isn't exported anymore outside libgdiplus. 2006-04-19 Peter Dennis Bartok * testbits.cs: Updated to match new BitmapData and Bitmap structs 2006-02-28 Peter Dennis Bartok * testbits.cs: Fixed bug #144798 (Novell Bugzilla) 2005-10-07 Wade Berrier * testgdi.c: Added missing printf argument 2004-06-11 Sanjay Gupta * test.bmp, test.gif, test.png: Added files to prevent seg fault. * testgdi.c: Minor modification of adding print stmts. 2004-04-23 Vladimir Vukicevic * Makefile.am: removed $(NULL), to deal with older/non-gnu make 2004-04-19 Vladimir Vukicevic * Makefile.am: Added testbits.c * testbits.c: Test LockBits functionality 2004-04-04 Vladimir Vukicevic * testgdi.c: Make the test actually check return values, so that problems can be caught during testing. * testgdi.c: initial commit libgdiplus-4.2/tests/Makefile.in0000664000175000017500000010351412635563136013665 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = testgdi$(EXEEXT) testbits$(EXEEXT) testclip$(EXEEXT) \ testreversepath$(EXEEXT) TESTS = testbits$(EXEEXT) testclip$(EXEEXT) testreversepath$(EXEEXT) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_testbits_OBJECTS = testbits.$(OBJEXT) testbits_OBJECTS = $(am_testbits_OBJECTS) am__DEPENDENCIES_1 = $(top_builddir)/src/libgdiplus.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_testclip_OBJECTS = testclip.$(OBJEXT) testclip_OBJECTS = $(am_testclip_OBJECTS) am_testgdi_OBJECTS = testgdi.$(OBJEXT) testgdi_OBJECTS = $(am_testgdi_OBJECTS) am_testreversepath_OBJECTS = testreversepath.$(OBJEXT) testreversepath_OBJECTS = $(am_testreversepath_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(testbits_SOURCES) $(testclip_SOURCES) $(testgdi_SOURCES) \ $(testreversepath_SOURCES) DIST_SOURCES = $(testbits_SOURCES) $(testclip_SOURCES) \ $(testgdi_SOURCES) $(testreversepath_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@ BASE_DEPENDENCIES_LIBS = @BASE_DEPENDENCIES_LIBS@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_DIR = @CAIRO_DIR@ CAIRO_LIBS = @CAIRO_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ FONTCONFIG_CONFIG = @FONTCONFIG_CONFIG@ FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ FREETYPE2_LIBS = @FREETYPE2_LIBS@ FREETYPE_CONFIG = @FREETYPE_CONFIG@ GDIPLUS_CFLAGS = @GDIPLUS_CFLAGS@ GDIPLUS_LIBS = @GDIPLUS_LIBS@ GDIPLUS_PKG_CFLAGS = @GDIPLUS_PKG_CFLAGS@ GDIPLUS_PKG_LIBS = @GDIPLUS_PKG_LIBS@ GDIPLUS_PKG_REQ = @GDIPLUS_PKG_REQ@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEXIF_CFLAGS = @LIBEXIF_CFLAGS@ LIBEXIF_LIBS = @LIBEXIF_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = $(GDIPLUS_LIBS) LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PANGO_CFLAGS = @PANGO_CFLAGS@ PANGO_LIBS = @PANGO_LIBS@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir)/src \ -I$(top_srcdir)/src \ $(GDIPLUS_CFLAGS) DEPS = \ $(top_builddir)/src/libgdiplus.la LDADDS = \ $(top_builddir)/src/libgdiplus.la \ -lm testgdi_DEPENDENCIES = $(TEST_DEPS) testgdi_LDADD = $(LDADDS) testgdi_SOURCES = \ testgdi.c testbits_DEPENDENCIES = $(TEST_DEPS) testbits_LDADD = $(LDADDS) testbits_SOURCES = \ testbits.c testclip_SOURCES = \ testclip.c testclip_DEPENDENCIES = $(TEST_DEPS) testclip_LDADD = $(LDADDS) testreversepath_SOURCES = \ testreversepath.c testreversepath_DEPENDENCIES = $(TEST_DEPS) testreversepath_LDADD = $(LDADDS) EXTRA_DIST = \ $(testgdi_SOURCES) \ $(testbits_SOURCES) \ $(testclip_SOURCES) \ $(testreversepath_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testbits$(EXEEXT): $(testbits_OBJECTS) $(testbits_DEPENDENCIES) $(EXTRA_testbits_DEPENDENCIES) @rm -f testbits$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testbits_OBJECTS) $(testbits_LDADD) $(LIBS) testclip$(EXEEXT): $(testclip_OBJECTS) $(testclip_DEPENDENCIES) $(EXTRA_testclip_DEPENDENCIES) @rm -f testclip$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testclip_OBJECTS) $(testclip_LDADD) $(LIBS) testgdi$(EXEEXT): $(testgdi_OBJECTS) $(testgdi_DEPENDENCIES) $(EXTRA_testgdi_DEPENDENCIES) @rm -f testgdi$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testgdi_OBJECTS) $(testgdi_LDADD) $(LIBS) testreversepath$(EXEEXT): $(testreversepath_OBJECTS) $(testreversepath_DEPENDENCIES) $(EXTRA_testreversepath_DEPENDENCIES) @rm -f testreversepath$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testreversepath_OBJECTS) $(testreversepath_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testbits.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testclip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testgdi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreversepath.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? testbits.log: testbits$(EXEEXT) @p='testbits$(EXEEXT)'; \ b='testbits'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testclip.log: testclip$(EXEEXT) @p='testclip$(EXEEXT)'; \ b='testclip'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testreversepath.log: testreversepath$(EXEEXT) @p='testreversepath$(EXEEXT)'; \ b='testreversepath'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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: libgdiplus-4.2/tests/testreversepath.c0000664000175000017500000002036212377405421015206 00000000000000#ifdef WIN32 #ifndef __cplusplus #error Please compile with a C++ compiler. #endif #include #include #else #include #endif #include #include #include #define C(func) assert(func == Ok) #ifdef WIN32 using namespace Gdiplus; using namespace DllExports; #endif static void check_reverse_points(const GpPointF *p1, const GpPointF *p2, int count) { p2 += count; while (count--) { p2--; assert (p1->X == p2->X); assert (p1->Y == p2->Y); p1++; } } static void test_gdip_reversepath() { GpPath *path; int count; int reverse_count; BYTE types[100]; GpPointF points[100]; BYTE reverse_types[100]; GpPointF reverse_points[100]; // Create a path C (GdipCreatePath (FillModeAlternate, &path)); C (GdipGetPointCount (path, &count)); assert (count == 0); // Reverse an empty path C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == 0); // Path with one line C (GdipAddPathLine (path, 0, 10, 1, 11)); C (GdipGetPointCount (path, &count)); assert (count == 2); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == PathPointTypeLine); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == PathPointTypeStart); assert (reverse_types[1] == PathPointTypeLine); GdipResetPath (path); // Closed path with one line C (GdipAddPathLine (path, 0, 10, 1, 11)); C (GdipClosePathFigure (path)); C (GdipGetPointCount (path, &count)); assert (count == 2); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == (PathPointTypeLine | PathPointTypeCloseSubpath)); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == PathPointTypeStart); assert (reverse_types[1] == (PathPointTypeLine | PathPointTypeCloseSubpath)); GdipResetPath (path); // Rectangle C (GdipAddPathRectangle (path, 200, 201, 60, 61)); C (GdipGetPointCount (path, &count)); assert (count == 4); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == PathPointTypeLine); assert (types[2] == PathPointTypeLine); assert (types[3] == (PathPointTypeLine | PathPointTypeCloseSubpath)); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == PathPointTypeStart); assert (reverse_types[1] == PathPointTypeLine); assert (reverse_types[2] == PathPointTypeLine); assert (reverse_types[3] == (PathPointTypeLine | PathPointTypeCloseSubpath)); GdipResetPath (path); // Rectangle, marker C (GdipAddPathRectangle (path, 200, 201, 60, 61)); C (GdipSetPathMarker (path)); C (GdipGetPointCount (path, &count)); assert (count == 4); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == PathPointTypeLine); assert (types[2] == PathPointTypeLine); assert (types[3] == (PathPointTypeLine | PathPointTypeCloseSubpath | PathPointTypePathMarker)); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == PathPointTypeStart); assert (reverse_types[1] == PathPointTypeLine); assert (reverse_types[2] == PathPointTypeLine); assert (reverse_types[3] == (PathPointTypeLine | PathPointTypeCloseSubpath)); GdipResetPath (path); // Elipse and rectangle C (GdipAddPathEllipse (path, 50, 51, 50, 100)); C (GdipAddPathRectangle (path, 200, 201, 60, 61)); C (GdipGetPointCount (path, &count)); assert (count == 17); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[13] == PathPointTypeStart); assert (types[14] == PathPointTypeLine); assert (types[15] == PathPointTypeLine); assert (types[16] == (PathPointTypeLine | PathPointTypeCloseSubpath)); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == types[13]); assert (reverse_types[1] == (types[16] & ~PathPointTypeCloseSubpath)); assert (reverse_types[2] == types[15]); assert (reverse_types[3] == (types[14] | PathPointTypeCloseSubpath)); GdipResetPath (path); // Line, marker, bezier C (GdipAddPathLine (path, 0, 1, 2, 3)); C (GdipSetPathMarker (path)); C (GdipClosePathFigure (path)); C (GdipAddPathBezier (path, 5, 6, 7, 8, 9, 10, 11, 12)); C (GdipClosePathFigure (path)); C (GdipGetPointCount (path, &count)); assert (count == 6); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == (PathPointTypeLine | PathPointTypePathMarker | PathPointTypeCloseSubpath)); assert (types[2] == PathPointTypeStart); assert (types[3] == PathPointTypeBezier); assert (types[4] == PathPointTypeBezier); assert (types[5] == (PathPointTypeBezier | PathPointTypeCloseSubpath)); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == types[2]); assert (reverse_types[1] == types[4]); assert (reverse_types[2] == types[3]); assert (reverse_types[3] == (types[5] | PathPointTypePathMarker)); assert (reverse_types[4] == types[0]); assert (reverse_types[5] == (types[1] & ~PathPointTypePathMarker)); GdipResetPath (path); // Line, marker, line, bezier C (GdipAddPathLine (path, 0, 1, 2, 3)); C (GdipSetPathMarker (path)); C (GdipStartPathFigure (path)); C (GdipAddPathLine (path, 20, 21, 22, 23)); C (GdipAddPathBezier (path, 5, 6, 7, 8, 9, 10, 11, 12)); C (GdipGetPointCount (path, &count)); assert (count == 8); C (GdipGetPathTypes (path, types, count)); C (GdipGetPathPoints (path, points, count)); assert (types[0] == PathPointTypeStart); assert (types[1] == (PathPointTypeLine | PathPointTypePathMarker)); assert (types[2] == PathPointTypeStart); assert (types[3] == PathPointTypeLine); assert (types[4] == PathPointTypeLine); assert (types[5] == PathPointTypeBezier); assert (types[6] == PathPointTypeBezier); assert (types[7] == PathPointTypeBezier); C (GdipReversePath (path)); C (GdipGetPointCount (path, &reverse_count)); assert (reverse_count == count); C (GdipGetPathTypes (path, reverse_types, count)); C (GdipGetPathPoints (path, reverse_points, count)); check_reverse_points (points, reverse_points, count); assert (reverse_types[0] == PathPointTypeStart); assert (reverse_types[1] == PathPointTypeBezier); assert (reverse_types[2] == PathPointTypeBezier); assert (reverse_types[3] == PathPointTypeBezier); assert (reverse_types[4] == PathPointTypeLine); assert (reverse_types[5] == (PathPointTypeLine | PathPointTypePathMarker)); assert (reverse_types[6] == PathPointTypeStart); assert (reverse_types[7] == PathPointTypeLine); C (GdipDeletePath (path)); } int main(int argc, char**argv) { GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); test_gdip_reversepath(); GdiplusShutdown(gdiplusToken); return 0; } libgdiplus-4.2/tests/testgdi.c0000664000175000017500000001031312377405421013414 00000000000000/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- * * testgdi.c : simple test hack * * Authors: * Vladimir Vukicevic * * Based on cairo test code. * * Modify the body of win_draw() to test your own code. */ #include #include #include #include #include "GdiPlusFlat.h" #include typedef struct win { Display *dpy; int scr; Window win; GC gc; int width, height; KeyCode quit_code; } win_t; static void win_init(win_t *win); static void win_deinit(win_t *win); static void win_draw(win_t *win); static void win_handle_events(win_t *win); #define CHECK_GDIP_ST(st) do { if(st != Ok) { g_print("got st: %d expected Ok", st); } } while (0) static void win_draw(win_t *win) { GpGraphics *gp; GpStatus st; GpImage *img; gunichar2 *unis; XClearWindow(win->dpy, win->win); GdipCreateFromXDrawable_linux (win->win, win->dpy, &gp); { GpPen *pen; GpSolidFill *brush; int a = 255; int r = 255; int g = 0; int b = 0; GdipCreatePen1 (a << 24 | r << 16 | g << 8 | b, 10, UnitPixel, &pen); GdipDrawRectangle (gp, pen, 10, 10, 60, 60); GdipDrawLine (gp, pen, 0, 0, 100, 100); GdipCreateSolidFill (a << 24 | r << 16 | g << 8 | b, &brush); printf ("%d\n",GdipFillEllipse (gp, (GpBrush*)brush, 40, 40, 50, 75)); // return; } unis = g_utf8_to_utf16 ("test.jpg", -1, NULL, NULL, NULL); st = GdipLoadImageFromFile (unis, &img); CHECK_GDIP_ST(st); st = GdipDrawImage (gp, img, 0, 0); CHECK_GDIP_ST(st); g_free (unis); GdipDisposeImage (img); img = NULL; printf("jpg drawn \n"); unis = g_utf8_to_utf16 ("test.tif", -1, NULL, NULL, NULL); st = GdipLoadImageFromFile (unis, &img); CHECK_GDIP_ST(st); st = GdipDrawImage (gp, img, 100, 0); CHECK_GDIP_ST(st); g_free (unis); GdipDisposeImage (img); img = NULL; printf("tif drawn \n"); unis = g_utf8_to_utf16 ("test.gif", -1, NULL, NULL, NULL); st = GdipLoadImageFromFile (unis, &img); CHECK_GDIP_ST(st); st = GdipDrawImage (gp, img, 200, 0); CHECK_GDIP_ST(st); g_free (unis); GdipDisposeImage (img); img = NULL; printf("gif drawn \n"); unis = g_utf8_to_utf16 ("test.png", -1, NULL, NULL, NULL); st = GdipLoadImageFromFile (unis, &img); CHECK_GDIP_ST(st); st = GdipDrawImage (gp, img, 0, 100); CHECK_GDIP_ST(st); g_free (unis); GdipDisposeImage (img); img = NULL; printf("png drawn \n"); unis = g_utf8_to_utf16 ("test.bmp", -1, NULL, NULL, NULL); st = GdipLoadImageFromFile (unis, &img); CHECK_GDIP_ST(st); st = GdipDrawImage (gp, img, 200, 100); CHECK_GDIP_ST(st); g_free (unis); GdipDisposeImage (img); img = NULL; printf("bmp drawn \n"); } int main(int argc, char *argv[]) { win_t win; GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); win.dpy = XOpenDisplay(0); if (win.dpy == NULL) { fprintf(stderr, "Failed to open display\n"); return 1; } win_init(&win); win_draw(&win); win_handle_events(&win); win_deinit(&win); XCloseDisplay(win.dpy); GdiplusShutdown(gdiplusToken); return 0; } static void win_init(win_t *win) { Window root; win->width = 400; win->height = 400; root = DefaultRootWindow(win->dpy); win->scr = DefaultScreen(win->dpy); win->win = XCreateSimpleWindow(win->dpy, root, 0, 0, win->width, win->height, 0, BlackPixel(win->dpy, win->scr), BlackPixel(win->dpy, win->scr)); win->quit_code = XKeysymToKeycode(win->dpy, XStringToKeysym("Q")); XSelectInput(win->dpy, win->win, KeyPressMask |StructureNotifyMask |ExposureMask); XMapWindow(win->dpy, win->win); } static void win_deinit(win_t *win) { XDestroyWindow(win->dpy, win->win); } static void win_handle_events(win_t *win) { XEvent xev; while (1) { XNextEvent(win->dpy, &xev); switch(xev.type) { case KeyPress: { XKeyEvent *kev = &xev.xkey; if (kev->keycode == win->quit_code) { return; } } break; case ConfigureNotify: { XConfigureEvent *cev = &xev.xconfigure; win->width = cev->width; win->height = cev->height; } break; case Expose: { XExposeEvent *eev = &xev.xexpose; if (eev->count == 0) win_draw(win); } break; } } } libgdiplus-4.2/tests/testbits.c0000664000175000017500000001311512377405421013615 00000000000000#include #include #include #include #include "GdiPlusFlat.h" static int status_counter = 0; #define CHECK_STATUS(x) do { if (status != Ok) { printf ("status[%d] == %d!\n", status_counter++, status); if(x) { exit(-1); } } else { printf ("status[%d] == Ok\n", status_counter++); } } while (0) /* FIXME: * libgdiplus version is larger than it should be. The library writes * to the extended fields, overwriting other data if the non-extended * version is used. This causes the failure of this test because other * parts of the stack are unexpectedly overwritten. */ typedef union { BitmapData origBitmapData; /* This structure is from src/bitmap-private.h */ struct { unsigned int width; unsigned int height; int stride; int pixel_format; BYTE *scan0; unsigned int reserved; /* the rest of the structure isn't part of MS GDI+ definition */ ColorPalette *palette; int property_count; /* Number of properties */ PropertyItem *property; /* Properties associated with image */ float dpi_horz; /* */ float dpi_vert; /* */ ImageFlags image_flags; /* Alpha, ColorSpace, etc. */ unsigned int left; /* left display coordinate of frame */ unsigned int top; /* top display coordinate of frame */ unsigned int x; /* LockBits: left coordinate of locked rectangle */ unsigned int y; /* LockBits: top coordinate of locked rectangle */ int transparent; /* Index of transparent color (<24bit only) */ } extendedBitmapData; } IncompatibleBitmapData; int main (int argc, char **argv) { GpBitmap *bitmap; IncompatibleBitmapData d, q; Rect r; int i, j; unsigned long *lptr; unsigned char *cptr; BYTE *scan0 = (BYTE*) GdipAlloc(10 * 10 * 4); GpStatus status = GdipCreateBitmapFromScan0 (10, 10, 10 * 4, PixelFormat32bppARGB, scan0, &bitmap); CHECK_STATUS(1); printf ("Full rectangle, no format conversion, read only\n"); r.X = 0; r.Y = 0; r.Width = 10; r.Height = 10; status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead, PixelFormat32bppARGB, &d.origBitmapData); CHECK_STATUS(1); printf ("Attempt to re-lock (should fail)\n"); status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead, PixelFormat32bppARGB, &q.origBitmapData); CHECK_STATUS(0); printf ("Unlock\n"); status = GdipBitmapUnlockBits (bitmap, &d.origBitmapData); CHECK_STATUS(1); /* lptr = (unsigned long *) bitmap->active_bitmap->scan0; for (j = 0; j < 10; j++) { for (i = 0; i < 10; i++) { *lptr++ = j | j << 8 | i << 16 | i << 24; } } */ memset (&d, 0x00, sizeof (BitmapData)); printf ("\nHalf rectangle, no format conversion, read only\n"); r.X = 5; r.Y = 5; r.Width = 5; r.Height = 5; status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead, PixelFormat32bppARGB, &d.origBitmapData); CHECK_STATUS(1); for (j = 0; j < 5; j++) { lptr = (unsigned long *) d.origBitmapData.Scan0 + j * d.origBitmapData.Stride; printf ("%d: ", j); for (i = 0; i < 5; i++) { printf ("%08lx ", *lptr++); } printf ("\n"); } printf ("Modifying (setting to 0xff)\n"); memset (d.origBitmapData.Scan0, 0xff, d.origBitmapData.Stride * d.origBitmapData.Height); printf ("Unlocking\n"); status = GdipBitmapUnlockBits (bitmap, &d.origBitmapData); CHECK_STATUS(1); /* printf ("Original data after unlock (shouldn't be 0xffffffff): 0x%08x\n", ((unsigned long *)(bitmap->active_bitmap->scan0))[55]); if (((unsigned long *)(bitmap->active_bitmap->scan0))[55] == 0xffffffff) printf ("==> FAIL!\n"); */ memset (&d, 0x00, sizeof (BitmapData)); printf ("\nHalf rectangle, 32bpp ARGB -> 32bpp RGB, read only\n"); r.X = 5; r.Y = 5; r.Width = 5; r.Height = 5; status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead, PixelFormat32bppRGB, &d.origBitmapData); CHECK_STATUS(1); lptr = (unsigned long *) d.origBitmapData.Scan0; for (j = 0; j < 5; j++) { printf ("%d: ", j); for (i = 0; i < 5; i++) { printf ("%08lx ", *lptr++); } printf ("\n"); } status = GdipBitmapUnlockBits (bitmap, &d.origBitmapData); CHECK_STATUS(1); memset (&d, 0x00, sizeof (BitmapData)); printf ("\nHalf rectangle, 32bpp ARGB -> 24bpp RGB, read/write only\n"); r.X = 5; r.Y = 5; r.Width = 5; r.Height = 5; status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead | ImageLockModeWrite, PixelFormat24bppRGB, &d.origBitmapData); CHECK_STATUS(1); for (j = 0; j < 5; j++) { cptr = (unsigned char *) (d.origBitmapData.Scan0 + (j * d.origBitmapData.Stride)); printf ("%d: ", j); for (i = 0; i < 5; i++) { printf ("%02x%02x%02x ", cptr[0], cptr[1], cptr[2]); cptr += 3; } printf ("\n"); } printf ("Modifying (setting to 0xaabbcc)\n"); for (j = 0; j < 5; j++) { cptr = (unsigned char *) (d.origBitmapData.Scan0 + (j * d.origBitmapData.Stride)); for (i = 0; i < 5; i++) { *cptr++ = 0xcc; *cptr++ = 0xbb; *cptr++ = 0xaa; } } status = GdipBitmapUnlockBits (bitmap, &d.origBitmapData); CHECK_STATUS(1); /* printf ("Original data after Unlock (should be all 0xffaabbcc):\n"); for (j = 5; j < 10; j++) { lptr = (unsigned long *) (bitmap->active_bitmap->Scan0 + j * bitmap->active_bitmap->Stride) + 5; printf ("%d: ", j); for (i = 5; i < 10; i++) { printf ("%08x ", *lptr++); } printf ("\n"); } */ GdipFree (scan0); return 0; } libgdiplus-4.2/tests/testclip.c0000664000175000017500000000755412377405421013615 00000000000000#ifdef WIN32 #ifndef __cplusplus #error Please compile with a C++ compiler. #endif #include #include #else #include #endif #include #include #include #define C(func) assert(func == Ok) #ifdef WIN32 using namespace Gdiplus; using namespace DllExports; #endif struct bm { BitmapData data; char spoil1[128]; // Space eaten at by the real BitmapData ... }; static void test_gdip_clip() { GpBitmap *bitmap = 0; GpBitmap *other_bitmap = 0; GpGraphics *graphics; GpRegion *clip; GpPath *path; GpPath *other_path; static const int width = 100; static const int height = 100; BYTE *scan0 = (BYTE*) GdipAlloc (width * height * 4); BOOL is_infinite = 0; GpRectF rect; GpRect recti; struct bm bm; struct bm other_bm; rect.X = 0.; rect.Y = 0.; rect.Width = width; rect.Height = height; recti.X = 0; recti.Y = 0; recti.Width = width; recti.Height = height; // Create bitmap C (GdipCreateBitmapFromScan0 (width, height, width * 4, PixelFormat32bppARGB, scan0, &bitmap)); // Get graphics C (GdipGetImageGraphicsContext (bitmap, &graphics)); // Check the clipping region is infinite C (GdipCreateRegion(&clip)); C (GdipGetClip (graphics, clip)); C (GdipIsInfiniteRegion(clip, graphics, &is_infinite)); assert(is_infinite); // Create a path C (GdipCreatePath (FillModeAlternate, &path)); C (GdipAddPathEllipse (path, 0, 0, 3, 2)); C (GdipAddPathBezier (path, 30, 30, 70, 175, 210, 220, 20, 60)); C (GdipAddPathRectangle (path, 200, 200, 60, 60)); C (GdipAddPathArc (path, 0, 0, 150, 120, 30, 120)); C (GdipAddPathEllipse (path, 50, 50, 50, 100)); // Save the infinite clip C (GdipGetClip (graphics, clip)); // Set the path as the clipping region C (GdipSetClipPath (graphics, path, CombineModeReplace)); // Clear the clipped image (foreground) C (GdipGraphicsClear (graphics, 0x8000ff00)); // Reset the clip C (GdipResetClip(graphics)); // Clone the image for future use C (GdipCloneBitmapArea (0., 0., (float)width, (float)height, PixelFormat32bppARGB, bitmap, &other_bitmap)); // Set the path as the clipping region C (GdipSetClipPath (graphics, path, CombineModeExclude)); C (GdipGetClip (graphics, clip)); C (GdipIsInfiniteRegion (clip, graphics, &is_infinite)); assert(!is_infinite); // Clear the clipped image (background) C (GdipGraphicsClear (graphics, 0x80ff0000)); // Now onto the second image // Get the graphics C (GdipGetImageGraphicsContext (other_bitmap, &graphics)); // Get the infinite clip C (GdipGetClip (graphics, clip)); // Dup the path C (GdipClonePath (path, &other_path)); // Add the bounds to it C (GdipGetRegionBounds (clip, graphics, &rect)); C (GdipAddPathRectangles (other_path, &rect, 1)); // Reverse the path C (GdipReversePath (other_path)); // Clip using the reversed path C (GdipSetClipPath (graphics, other_path, CombineModeReplace)); // Clear the clipped image (background) C (GdipGraphicsClear (graphics, 0x80ff0000)); // Compare the two images C (GdipBitmapLockBits (bitmap, &recti, ImageLockModeRead, PixelFormat32bppARGB, &bm.data)); C (GdipBitmapLockBits (other_bitmap, &recti, ImageLockModeRead, PixelFormat32bppARGB, &other_bm.data)); assert (bm.data.Width == other_bm.data.Width); assert (bm.data.Height == other_bm.data.Height); { int *p = (int*)bm.data.Scan0; int *other_p = (int*)other_bm.data.Scan0; int i; for (i = 0; i < width * height; ++i) assert(*p++ == *other_p++); } C (GdipBitmapUnlockBits (bitmap, &bm.data)); C (GdipBitmapUnlockBits (other_bitmap, &other_bm.data)); C (GdipDeleteRegion (clip)); C (GdipDeleteGraphics (graphics)); C (GdipDisposeImage (bitmap)); GdipFree (scan0); } int main(int argc, char**argv) { GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); test_gdip_clip(); GdiplusShutdown(gdiplusToken); return 0; } libgdiplus-4.2/tests/Makefile.am0000664000175000017500000000166112614365567013661 00000000000000## Makefile.am for libgdiplus/tests LIBS = $(GDIPLUS_LIBS) INCLUDES = \ -I$(top_srcdir) \ -I$(top_builddir)/src \ -I$(top_srcdir)/src \ $(GDIPLUS_CFLAGS) DEPS = \ $(top_builddir)/src/libgdiplus.la LDADDS = \ $(top_builddir)/src/libgdiplus.la \ -lm noinst_PROGRAMS = \ testgdi testbits testclip testreversepath testgdi_DEPENDENCIES = $(TEST_DEPS) testgdi_LDADD = $(LDADDS) testgdi_SOURCES = \ testgdi.c testbits_DEPENDENCIES = $(TEST_DEPS) testbits_LDADD = $(LDADDS) testbits_SOURCES = \ testbits.c testclip_SOURCES = \ testclip.c testclip_DEPENDENCIES = $(TEST_DEPS) testclip_LDADD = $(LDADDS) testreversepath_SOURCES = \ testreversepath.c testreversepath_DEPENDENCIES = $(TEST_DEPS) testreversepath_LDADD = $(LDADDS) EXTRA_DIST = \ $(testgdi_SOURCES) \ $(testbits_SOURCES) \ $(testclip_SOURCES) \ $(testreversepath_SOURCES) TESTS = \ testbits \ testclip \ testreversepath \ $(NULL) libgdiplus-4.2/ltmain.sh0000644000175000017500000105203012635563135012270 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 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. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1.11" TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2